class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 打开菜单画面(修改为菜单直接进入物品界面)
#--------------------------------------------------------------------------
alias origin_call_menu call_menu
def call_menu
Sound.play_ok
SceneManager.call(Scene_Equip)
Window_MenuCommand::init_command_position
end
end
#encoding:utf-8
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 装备画面
#==============================================================================
class Scene_Equip < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def initialize(last_scene = :scene_map)
super
@last_scene = last_scene
end
def start
super
create_help_window
create_status_window
create_command_window
create_slot_window
create_item_window
create_origin_command_window
end
#--------------------------------------------------------------------------
# ● 生成状态窗口
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_EquipStatus.new(0, @help_window.height)
@status_window.viewport = @viewport
@status_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
wx = @status_window.width
wy = @help_window.height
ww = Graphics.width - @status_window.width
@equip_command_window = Window_EquipCommand.new(wx, wy, ww)
@equip_command_window.viewport = @viewport
@equip_command_window.help_window = @help_window
@equip_command_window.set_handler(:equip, method(:command_equip))
@equip_command_window.set_handler(:optimize, method(:command_optimize))
@equip_command_window.set_handler(:clear, method(:command_clear))
@equip_command_window.set_handler(:cancel, method(:return_scene))
@equip_command_window.set_handler(:pagedown, method(:next_actor))
@equip_command_window.set_handler(:pageup, method(:prev_actor))
end
#--------------------------------------------------------------------------
# ● 生成装备栏窗口
#--------------------------------------------------------------------------
def create_slot_window
wx = @status_window.width
#~ wy = @help_window.y + @help_window.height
wy =@equip_command_window.y + @equip_command_window.height
ww = Graphics.width - @status_window.width
@slot_window = Window_EquipSlot.new(wx, wy, ww)
@slot_window.viewport = @viewport
@slot_window.help_window = @help_window
@slot_window.status_window = @status_window
@slot_window.actor = @actor
@slot_window.set_handler(:ok, method(:on_slot_ok))
@slot_window.set_handler(:cancel, method(:on_slot_cancel))
end
#--------------------------------------------------------------------------
# ● 生成物品窗口
#--------------------------------------------------------------------------
def create_item_window
wx = 0
wy = @slot_window.y + @slot_window.height
ww = Graphics.width
wh = Graphics.height - wy
@item_window = Window_EquipItem.new(wx, wy, ww, wh)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.status_window = @status_window
@item_window.actor = @actor
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@slot_window.item_window = @item_window
end
#--------------------------------------------------------------------------
# ● 指令“更换装备”
#--------------------------------------------------------------------------
def command_equip
@slot_window.activate
@slot_window.select(0)
end
#--------------------------------------------------------------------------
# ● 指令“最强装备”
#--------------------------------------------------------------------------
def command_optimize
Sound.play_equip
@actor.optimize_equipments
@status_window.refresh
@slot_window.refresh
@equip_command_window.activate
end
#--------------------------------------------------------------------------
# ● 指令“全部卸下”
#--------------------------------------------------------------------------
def command_clear
Sound.play_equip
@actor.clear_equipments
@status_window.refresh
@slot_window.refresh
@equip_command_window.activate
end
#--------------------------------------------------------------------------
# ● 装备栏“确定”
#--------------------------------------------------------------------------
def on_slot_ok
@item_window.activate
@item_window.select(0)
end
#--------------------------------------------------------------------------
# ● 装备栏“取消”
#--------------------------------------------------------------------------
def on_slot_cancel
@slot_window.unselect
@equip_command_window.activate
end
#--------------------------------------------------------------------------
# ● 物品“确定”
#--------------------------------------------------------------------------
def on_item_ok
Sound.play_equip
@actor.change_equip(@slot_window.index, @item_window.item)
@slot_window.activate
@slot_window.refresh
@item_window.unselect
@item_window.refresh
end
#--------------------------------------------------------------------------
# ● 物品“取消”
#--------------------------------------------------------------------------
def on_item_cancel
@slot_window.activate
@item_window.unselect
end
#--------------------------------------------------------------------------
# ● 切换角色
#--------------------------------------------------------------------------
def on_actor_change
@status_window.actor = @actor
@slot_window.actor = @actor
@item_window.actor = @actor
@equip_command_window.activate
end
#--------------------------------------------------------------------------
# ● 生成指令窗口■
#--------------------------------------------------------------------------
def create_origin_command_window
@command_window = Window_MenuCommand.new
@command_window.set_handler(:item, method(:command_item))
@command_window.set_handler(:skill, method(:command_skill))
@command_window.set_handler(:equip, method(:command_equip))
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.select(0)
@command_window.active = @last_scene == :scene_map
end
#--------------------------------------------------------------------------
# ● 指令“物品”■
#--------------------------------------------------------------------------
def command_item
SceneManager.call(Scene_Item)#, :Scene_Equip)
@item_window.activate
@item_window.select(0)
end
#--------------------------------------------------------------------------
# ● 指令“技能”■
#--------------------------------------------------------------------------
def command_skill
SceneManager.call_new(Scene_Skill, :Scene_Equip)
end
end