#==============================================================================
# ■ Window_ConfirmRun
#------------------------------------------------------------------------------
# 战斗界面中确定逃跑两个选项的窗口
#==============================================================================
class Window_ConfirmRun < Window_HorzCommand
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(yes, no)
@yes = yes
@no = no
super(544/2, 416/2) #
self.visible = false
self.active = false
@index = 0
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
add_command(@yes, :yes)
add_command(@no, :cancel)
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_ok
Input.update
call_ok_handler
end
#--------------------------------------------------------------------------
# ● 按下取消键时的处理
#--------------------------------------------------------------------------
def process_cancel
Input.update
call_cancel_handler
end
#--------------------------------------------------------------------------
# ● 启用窗口
#--------------------------------------------------------------------------
def activate
temp = self.y + self.height - Graphics.height
if temp > 0
self.y -= (temp + 12)
end
self.active = true
self
end
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 生成所有窗口
#--------------------------------------------------------------------------
def create_all_windows
create_message_window
create_scroll_text_window
create_log_window
create_status_window
create_info_viewport
create_party_command_window
create_actor_command_window
create_help_window
create_skill_window
create_item_window
create_actor_window
create_enemy_window
create_confirm_window
end
def create_confirm_window
@window_confirm = Window_ConfirmRun.new("逃跑", "我手贱")
@window_confirm.set_handler(:yes, method(:do_escape))
@window_confirm.set_handler(:cancel, method(:do_cancel))
@window_confirm.hide
end
def do_escape
turn_start unless BattleManager.process_escape
end
def do_cancel
Sound.play_cancel
@window_confirm.index = 0
@window_confirm.visible = false
@window_confirm.deactivate
@window_confirm.hide
@party_command_window.setup
end
#--------------------------------------------------------------------------
# ● 指令“撤退”
#--------------------------------------------------------------------------
def command_escape
@window_confirm.show
@window_confirm.activate
@window_confirm.visible = true
@window_confirm.refresh
end
end