Project1

标题: 怎么简化对话栏,只剩下物品和退出游戏 [打印本页]

作者: YE子    时间: 2013-5-18 00:18
标题: 怎么简化对话栏,只剩下物品和退出游戏
本帖最后由 YE子 于 2013-5-19 09:58 编辑

因为做的是解密类的所以不需要什么装备等,求教
作者: 冰鎮史萊姆    时间: 2013-5-18 07:51
scene menu改為
[pre lang="ruby" line="1"]#encoding:utf-8
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
#  選單畫面
#==============================================================================

class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 開始處理
  #--------------------------------------------------------------------------
  def start
    super
    create_command_window
  end
  #--------------------------------------------------------------------------
  # ● 生成指令視窗
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_MenuCommand.new
    @command_window.set_handler(:item,      method(:command_item))
    @command_window.set_handler(:game_end,  method(:command_game_end))
    @command_window.set_handler(:cancel,    method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # ● 指令“物品”
  #--------------------------------------------------------------------------
  def command_item
    SceneManager.call(Scene_Item)
  end
  #--------------------------------------------------------------------------
  # ● 指令“結束游戲”
  #--------------------------------------------------------------------------
  def command_game_end
    SceneManager.call(Scene_End)
  end
end
[/pre]
Window_MenuCommand改為
[pre lang="ruby" line="1"]#encoding:utf-8
#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
#  選單畫面中顯示指令的視窗
#==============================================================================

class Window_MenuCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● 初始化指令選擇位置(類方法)
  #--------------------------------------------------------------------------
  def self.init_command_position
    @@last_command_symbol = nil
  end
  #--------------------------------------------------------------------------
  # ● 初始化物件
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    update_placement
    select_last
  end
  #--------------------------------------------------------------------------
  # ● 取得視窗的寬度
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # ● 取得顯示行數
  #--------------------------------------------------------------------------
  def visible_line_number
    item_max
  end
  #--------------------------------------------------------------------------
  # ● 生成指令清單
  #--------------------------------------------------------------------------
  def make_command_list
    add_main_commands
    add_game_end_command
  end
  #--------------------------------------------------------------------------
  # ● 向指令清單加入主要的指令
  #--------------------------------------------------------------------------
  def add_main_commands
    add_command(Vocab::item,   :item,   main_commands_enabled)
  end
  #--------------------------------------------------------------------------
  # ● 加入游戲結束指令
  #--------------------------------------------------------------------------
  def add_game_end_command
    add_command(Vocab::game_end, :game_end)
  end
  #--------------------------------------------------------------------------
  # ● 取得主要指令的有效狀態
  #--------------------------------------------------------------------------
  def main_commands_enabled
    $game_party.exists
  end
  #--------------------------------------------------------------------------
  # ● 按下確定鍵時的處理
  #--------------------------------------------------------------------------
  def process_ok
    @@last_command_symbol = current_symbol
    super
  end
  #--------------------------------------------------------------------------
  # ● 返回最後一個選項的位置
  #--------------------------------------------------------------------------
  def select_last
    select_symbol(@@last_command_symbol)
  end
    #--------------------------------------------------------------------------
  # ● 更新視窗的位置
  #--------------------------------------------------------------------------
  def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height - height) / 2
  end
end
[/pre]




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X5.0