#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