module CLD99
DISPOSE_ORIGINAL_MENU = true # 是否放弃原版菜单
SIGN_GAL_MENU = :X # 保留原版菜单时,简化菜单的进入按键
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 设置选项
#--------------------------------------------------------------------------
alias setup_choices_for_interpreter_store setup_choices
def setup_choices(params)
setup_choices_for_interpreter_store(params)
$game_message.choice_interpreter = self
end
def command_back(number = 1)
@index -= number
end
end
class Game_Message
attr_accessor :choice_interpreter
end
class Window_Message
#--------------------------------------------------------------------------
# ● 处理输入等待
#--------------------------------------------------------------------------
def input_pause
self.pause = true
wait(10)
pause_update until Input.trigger?(:B) || Input.trigger?(:C)
Input.update
self.pause = false
end
#--------------------------------------------------------------------------
# ● 处理选项的输入
#--------------------------------------------------------------------------
def input_choice
@choice_window.start
pause_update(choicing = true) while @choice_window.active
end
#--------------------------------------------------------------------------
# ● 处理数值的输入
#--------------------------------------------------------------------------
def input_number
@number_window.start
pause_update(choicing = true) while @number_window.active
end
#--------------------------------------------------------------------------
# ● 处理物品的选择
#--------------------------------------------------------------------------
def input_item
@item_window.start
pause_update(choicing = true) while @item_window.active
end
def pause_update(choicing = false)
Fiber.yield
call_gal_menu(choicing) if Input.trigger?(:X)
end
def call_gal_menu(choicing = false)
Sound.play_ok
if choicing
SceneManager.class_eval do
@stack.push(@scene)
@scene = Scene_GALMenu.new(choicing = true)
end
else
SceneManager.call(Scene_GALMenu)
end
end
end
class Scene_Map
#--------------------------------------------------------------------------
# ● 监听取消键的按下。如果菜单可用且地图上没有事件在运行,则打开菜单界面。
#--------------------------------------------------------------------------
alias update_call_menu_for_call_gal_menu update_call_menu
def update_call_menu
update_call_menu_for_call_gal_menu
if $game_system.menu_disabled || $game_map.interpreter.running?
@menu_calling = false
else
@menu_calling = Input.trigger?(CLD99::SIGN_GAL_MENU)
call_gal_menu if @menu_calling && !$game_player.moving?
end
end
def call_gal_menu
Sound.play_ok
SceneManager.call(Scene_GALMenu)
end
end
Scene_GALMenu = Scene_Menu.dup
class Scene_GALMenu
Window_GALMenuCommand = Window_MenuCommand.dup
class Window_GALMenuCommand
@@last_command_symbol = nil
def make_command_list
add_command(Vocab::save, :save, !$game_system.save_disabled)
add_command('读档', :load)
add_command(Vocab::game_end, :game_end)
end
end
def initialize(choicing = false)
@choicing = choicing
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_command_window
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_GALMenuCommand.new
@command_window.set_handler(:save, method(:command_save))
@command_window.set_handler(:load, method(:command_load))
@command_window.set_handler(:game_end, method(:command_game_end))
@command_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● 指令“存档”
#--------------------------------------------------------------------------
def command_save
if @choicing
$game_message.choices.clear
$game_message.choice_proc = nil
$game_message.choice_interpreter.command_back(3)
$game_message.choice_interpreter.execute_command
end
SceneManager.call(Scene_Save)
end
#--------------------------------------------------------------------------
# ● 指令“读档”
#--------------------------------------------------------------------------
def command_load
SceneManager.call(Scene_Load)
end
end
if CLD99::DISPOSE_ORIGINAL_MENU
Scene_Menu = Scene_GALMenu
class Scene_Map
def call_menu; end
end
end