scene menu改為
#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
#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
Window_MenuCommand改為
#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
#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
|