#encoding:utf-8
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 装备画面
#==============================================================================
class Scene_Equip < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_help_window
@help_window.x = 544
create_status_window
create_slot_window
create_item_window
end
def create_background
@background_sprite = Sprite.new
@background_sprite.bitmap = Cache.title1("Menu_equip")
end
#--------------------------------------------------------------------------
# ● 生成状态窗口
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_EquipStatus.new(0, 0)
@status_window.viewport = @viewport
@status_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● 生成装备栏窗口
#--------------------------------------------------------------------------
def create_slot_window
wx = @status_window.width + 70
wy = 0
ww = Graphics.width - @status_window.width - 90
@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(:return_scene))
command_equip
end
#--------------------------------------------------------------------------
# ● 生成物品窗口
#--------------------------------------------------------------------------
def create_item_window
wx = @status_window.width + 70
wy = @slot_window.y + @slot_window.height - 40
ww = Graphics.width - 35
wh = Graphics.height + 60
@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 on_slot_ok
@item_window.activate
@item_window.select(0)
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
@slot_window.activate
end
end