设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1190|回复: 5
打印 上一主题 下一主题

呃菜单的设置问题如何设置两个选项的菜单效果

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
95
在线时间
2 小时
注册时间
2008-5-31
帖子
63
跳转到指定楼层
1
发表于 2008-6-1 00:39:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
class Window_Command_New < Window_Selectable
  def initialize(actors=4,enemynums=0)
    super(438, 20, 172, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = HS::OPACITY
    @commands = ["战斗","物品","魔法","状态","装备","队列","任务","系统"]
    @item_max = 8
    @column_max = 2
    @actors = actors
    @enemynums = enemynums
    draw_item(0, @enemynums==0 ? disabled_color : normal_color)
    draw_item(1, normal_color)
    draw_item(2, @actors==0 ? disabled_color : normal_color)
    draw_item(3, @actors==0 ? disabled_color : normal_color)
    draw_item(4, @actors==0 ? disabled_color : normal_color)
    draw_item(5, @actors==0 ? disabled_color : normal_color)
    draw_item(6, normal_color)
    draw_item(7, normal_color)
    self.index = 0
  end
  def draw_item(index, color)
    self.contents.font.color = color
    x = 4 + index % 2 * 70
    y = index / 2 * 32
    rect = Rect.new(x, y, 64, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], 1)
  end
  def update_cursor_rect
    x = 4 + index % 2 * 70
    y = index / 2 * 32
    self.cursor_rect.set(x, y, 64, 32)
  end
end

class Scene_Menu
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  def main
#   check_enemy_in_map($game_player.x,$game_player.y)
    cmd = Window_Command_New.new($game_party.actors.size)
    cmd.index = @menu_index
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      cmd.update
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      end
      if Input.trigger?(Input::C)
        case cmd.index
        when 0
          $game_system.se_play($data_system.buzzer_se)
        when 1
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Item.new
        when 2
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Skill.new
        when 3
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Status.new
        when 4
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Equip.new
        when 5
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Change_Turn.new
        when 6
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Charactor.new
        when 7
          print "自己安排什么 储存、读取、什么的等"
        end
      end
      if $scene != self
        break
      end
    end
    Graphics.freeze
    cmd.dispose
  end
end


引用上面这个脚本啊~~

就是when7的系统选项~如何添加储存~读取~离开游戏这三个选项进去~~我发现就添加两个以上的话就只能实现一个效果~~请教~!!谢谢各位大大
版务信息:本贴由楼主自主结贴~

Lv1.梦旅人

梦石
0
星屑
50
在线时间
27 小时
注册时间
2008-2-13
帖子
1740
2
发表于 2008-6-1 00:49:46 | 只看该作者
    class Window_Command_New < Window_Selectable
     def initialize(actors=4,enemynums=0)
       super(438, 20, 172, 160)
       self.contents = Bitmap.new(width - 32, height - 32)
       self.opacity = HS::OPACITY
       @commands = ["战斗","物品","魔法","状态","装备","队列","任务","系统"]
       @item_max = 8
       @column_max = 2
       @actors = actors
       @enemynums = enemynums
       draw_item(0, @enemynums==0 ? disabled_color : normal_color)
       draw_item(1, normal_color)
       draw_item(2, @actors==0 ? disabled_color : normal_color)
       draw_item(3, @actors==0 ? disabled_color : normal_color)
       draw_item(4, @actors==0 ? disabled_color : normal_color)
       draw_item(5, @actors==0 ? disabled_color : normal_color)
       draw_item(6, normal_color)
       draw_item(7, normal_color)
       self.index = 0
     end
     def draw_item(index, color)
       self.contents.font.color = color
       x = 4 + index % 2 * 70
       y = index / 2 * 32
       rect = Rect.new(x, y, 64, 32)
       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
       self.contents.draw_text(rect, @commands[index], 1)
     end
     def update_cursor_rect
       x = 4 + index % 2 * 70
       y = index / 2 * 32
       self.cursor_rect.set(x, y, 64, 32)
     end
    end

    class Scene_Menu
     def initialize(menu_index = 0)
       @menu_index = menu_index
     end
     def main
    #   check_enemy_in_map($game_player.x,$game_player.y)
       cmd = Window_Command_New.new($game_party.actors.size)
       cmd.index = @menu_index
       Graphics.transition
       loop do
         Graphics.update
         Input.update
         cmd.update
         if Input.trigger?(Input::B)
           $game_system.se_play($data_system.cancel_se)
           $scene = Scene_Map.new
         end
         if Input.trigger?(Input::C)
           case cmd.index
           when 0
             $game_system.se_play($data_system.buzzer_se)
           when 1
             $game_system.se_play($data_system.decision_se)
             $scene = Scene_Item.new
           when 2
             $game_system.se_play($data_system.decision_se)
             $scene = Scene_Skill.new
           when 3
             $game_system.se_play($data_system.decision_se)
             $scene = Scene_Status.new
           when 4
             $game_system.se_play($data_system.decision_se)
             $scene = Scene_Equip.new
           when 5
             $game_system.se_play($data_system.decision_se)
             $scene = Scene_Change_Turn.new
           when 6
             $game_system.se_play($data_system.decision_se)
             $scene = Scene_Charactor.new
           when 7
             $game_system.se_play($data_system.decision_se
             $scene = Scene_End.new
           end
         end
         if $scene != self
           break
         end
       end
       Graphics.freeze
       cmd.dispose
     end
    end


修改好了
好吧,果然换个签名就没人认识我了。我承认我被时间埋没了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
41 小时
注册时间
2008-3-5
帖子
2072
3
发表于 2008-6-1 00:52:34 | 只看该作者
一个萝卜一个坑,一个连接只能对应一个地方
改程序吧
when 7 改成
  1.       when 7  # 游戏结束
  2.         # 演奏确定 SE
  3.         $game_system.se_play($data_system.decision_se)
  4.         # 切换到游戏结束画面
  5.         $scene = Scene_End.new
  6.       end
复制代码

  1. #==============================================================================
  2. # ■ Scene_End
  3. #------------------------------------------------------------------------------
  4. #  处理游戏结束画面的类。
  5. #==============================================================================

  6. class Scene_End
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.     # 生成命令窗口
  12.     s4 = "保存"
  13.     s5 = "读取"
  14.     s1 = "返回标题画面"
  15.     s2 = "退出"
  16.     s3 = "取消"
  17.     @command_window = Window_Command.new(192, [s4, s5, s1, s2, s3])
  18.     @command_window.x = 320 - @command_window.width / 2
  19.     @command_window.y = 240 - @command_window.height / 2
  20.     # 执行过渡
  21.     Graphics.transition
  22.     # 主循环
  23.     loop do
  24.       # 刷新游戏画面
  25.       Graphics.update
  26.       # 刷新输入情报
  27.       Input.update
  28.       # 刷新画面
  29.       update
  30.       # 如果画面切换的话就中断循环
  31.       if $scene != self
  32.         break
  33.       end
  34.     end
  35.     # 准备过渡
  36.     Graphics.freeze
  37.     # 释放窗口
  38.     @command_window.dispose
  39.     # 如果在标题画面切换中的情况下
  40.     if $scene.is_a?(Scene_Title)
  41.       # 淡入淡出画面
  42.       Graphics.transition
  43.       Graphics.freeze
  44.     end
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 刷新画面
  48.   #--------------------------------------------------------------------------
  49.   def update
  50.     # 刷新命令窗口
  51.     @command_window.update
  52.     # 按下 B 键的情况下
  53.     if Input.trigger?(Input::B)
  54.       # 演奏取消 SE
  55.       $game_system.se_play($data_system.cancel_se)
  56.       # 切换到菜单画面
  57.       $scene = Scene_Menu.new(5)
  58.       return
  59.     end
  60.     # 按下 C 键的场合下
  61.     if Input.trigger?(Input::C)
  62.       # 命令窗口光标位置分支
  63.       case @command_window.index
  64.       when 0
  65.         command_to_save
  66.       when 1
  67.         command_to_load
  68.       when 2  # 返回标题画面
  69.         command_to_title
  70.       when 3  # 退出
  71.         command_shutdown
  72.       when 4  # 取消
  73.         command_cancel
  74.       end
  75.       return
  76.     end
  77.   end
  78.   
  79.   #--------------------------------------------------------------------------
  80.   # ● 选择命令 [返回标题画面] 时的处理
  81.   #--------------------------------------------------------------------------
  82.   def command_to_save
  83.     # 演奏确定 SE
  84.     $game_system.se_play($data_system.decision_se)
  85.     # 切换到菜单画面
  86.     $scene = Scene_Save.new
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 选择命令 [返回标题画面] 时的处理
  90.   #--------------------------------------------------------------------------
  91.   def command_to_load
  92.     # 演奏确定 SE
  93.     $game_system.se_play($data_system.decision_se)
  94.     # 切换到菜单画面
  95.     $scene = Scene_Load.new
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 选择命令 [返回标题画面] 时的处理
  99.   #--------------------------------------------------------------------------
  100.   def command_to_title
  101.     # 演奏确定 SE
  102.     $game_system.se_play($data_system.decision_se)
  103.     # 淡入淡出 BGM、BGS、ME
  104.     Audio.bgm_fade(800)
  105.     Audio.bgs_fade(800)
  106.     Audio.me_fade(800)
  107.     # 切换到标题画面
  108.     $scene = Scene_Title.new
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 选择命令 [退出] 时的处理
  112.   #--------------------------------------------------------------------------
  113.   def command_shutdown
  114.     # 演奏确定 SE
  115.     $game_system.se_play($data_system.decision_se)
  116.     # 淡入淡出 BGM、BGS、ME
  117.     Audio.bgm_fade(800)
  118.     Audio.bgs_fade(800)
  119.     Audio.me_fade(800)
  120.     # 退出
  121.     $scene = nil
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 选择命令 [取消] 时的处理
  125.   #--------------------------------------------------------------------------
  126.   def command_cancel
  127.     # 演奏确定 SE
  128.     $game_system.se_play($data_system.decision_se)
  129.     # 切换到菜单画面
  130.     $scene = Scene_Menu.new(5)
  131.   end
  132. end
复制代码

系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
你它囧一字母君谁记得……
当时那把剑离我的喉咙只有0.01工分。可是一柱香之后,这个女主人会深深的爱上我,虽然本人平生说了无数的谎话,可是这句最有效:“你应该这么做,我也应该死。
曾经有一取ID的机会放在我面前,我没有珍惜,等我失去的时候我才后悔莫及,人世间最痛苦的事莫过于此。你的剑在我的咽喉上割下去吧!不用再犹豫了!如果上天能够给我一个再来一次的机会,我绝对会取个汉字君。如果非要给这ID加点修饰的话,我希望是……红色加粗……

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
95
在线时间
2 小时
注册时间
2008-5-31
帖子
63
4
 楼主| 发表于 2008-6-1 01:02:16 | 只看该作者
以下引用hitlerson于2008-5-31 16:52:34的发言:

一个萝卜一个坑,一个连接只能对应一个地方
改程序吧
when 7 改成
      when 7  # 游戏结束
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到游戏结束画面
        $scene = Scene_End.new
      end


#==============================================================================
# ■ Scene_End
#------------------------------------------------------------------------------
#  处理游戏结束画面的类。
#==============================================================================

class Scene_End
  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main
    # 生成命令窗口
    s4 = "保存"
    s5 = "读取"
    s1 = "返回标题画面"
    s2 = "退出"
    s3 = "取消"
    @command_window = Window_Command.new(192, [s4, s5, s1, s2, s3])
    @command_window.x = 320 - @command_window.width / 2
    @command_window.y = 240 - @command_window.height / 2
    # 执行过渡
    Graphics.transition
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入情报
      Input.update
      # 刷新画面
      update
      # 如果画面切换的话就中断循环
      if $scene != self
        break
      end
    end
    # 准备过渡
    Graphics.freeze
    # 释放窗口
    @command_window.dispose
    # 如果在标题画面切换中的情况下
    if $scene.is_a?(Scene_Title)
      # 淡入淡出画面
      Graphics.transition
      Graphics.freeze
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    # 刷新命令窗口
    @command_window.update
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换到菜单画面
      $scene = Scene_Menu.new(5)
      return
    end
    # 按下 C 键的场合下
    if Input.trigger?(Input::C)
      # 命令窗口光标位置分支
      case @command_window.index
      when 0
        command_to_save
      when 1
        command_to_load
      when 2  # 返回标题画面
        command_to_title
      when 3  # 退出
        command_shutdown
      when 4  # 取消
        command_cancel
      end
      return
    end
  end
  
  #--------------------------------------------------------------------------
  # ● 选择命令 [返回标题画面] 时的处理
  #--------------------------------------------------------------------------
  def command_to_save
    # 演奏确定 SE
    $game_system.se_play($data_system.decision_se)
    # 切换到菜单画面
    $scene = Scene_Save.new
  end
  #--------------------------------------------------------------------------
  # ● 选择命令 [返回标题画面] 时的处理
  #--------------------------------------------------------------------------
  def command_to_load
    # 演奏确定 SE
    $game_system.se_play($data_system.decision_se)
    # 切换到菜单画面
    $scene = Scene_Load.new
  end
  #--------------------------------------------------------------------------
  # ● 选择命令 [返回标题画面] 时的处理
  #--------------------------------------------------------------------------
  def command_to_title
    # 演奏确定 SE
    $game_system.se_play($data_system.decision_se)
    # 淡入淡出 BGM、BGS、ME
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    # 切换到标题画面
    $scene = Scene_Title.new
  end
  #--------------------------------------------------------------------------
  # ● 选择命令 [退出] 时的处理
  #--------------------------------------------------------------------------
  def command_shutdown
    # 演奏确定 SE
    $game_system.se_play($data_system.decision_se)
    # 淡入淡出 BGM、BGS、ME
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    # 退出
    $scene = nil
  end
  #--------------------------------------------------------------------------
  # ● 选择命令 [取消] 时的处理
  #--------------------------------------------------------------------------
  def command_cancel
    # 演奏确定 SE
    $game_system.se_play($data_system.decision_se)
    # 切换到菜单画面
    $scene = Scene_Menu.new(5)
  end
end



谢谢两位大大
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
27 小时
注册时间
2008-2-13
帖子
1740
5
发表于 2008-6-1 01:08:40 | 只看该作者
那个要调坐标 - -
LZ参考:http://rpg.blue/web/htm/news567.htm做
好吧,果然换个签名就没人认识我了。我承认我被时间埋没了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
95
在线时间
2 小时
注册时间
2008-5-31
帖子
63
6
 楼主| 发表于 2008-6-1 01:12:01 | 只看该作者
以下引用havealook于2008-5-31 17:08:40的发言:

那个要调坐标 - -
LZ参考:http://rpg.blue/web/htm/news567.htm做

好的~感谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-8-2 12:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表