本帖最后由 VIPArcher 于 2014-8-11 22:30 编辑
不知道你还需要吗?- #encoding:utf-8
- #==============================================================================
- # ■ Scene_Equip
- #------------------------------------------------------------------------------
- # 装备画面
- #==============================================================================
- class Scene_Equip < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_status_window
- create_slot_window
- create_item_window
- command_equip
- end
- #--------------------------------------------------------------------------
- # ● 生成状态窗口
- #--------------------------------------------------------------------------
- def create_status_window
- wx = @help_window.height + 50
- @status_window = Window_EquipStatus.new(0, wx)
- @status_window.height = Graphics.height - wx
- @status_window.viewport = @viewport
- @status_window.actor = @actor
- end
- #--------------------------------------------------------------------------
- # ● 生成装备栏窗口
- #--------------------------------------------------------------------------
- def create_slot_window
- wx = 0
- wy = @help_window.height
- ww = @status_window.width
- wh = 36
- @slot_window = Window_EquipSlot.new(wx, wy, ww)
- @slot_window.viewport = @viewport
- @slot_window.height = 50
- @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))
- @slot_window.set_handler(:pagedown, method(:next_actor))
- @slot_window.set_handler(:pageup, method(:prev_actor))
- end
- #--------------------------------------------------------------------------
- # ● 生成物品窗口
- #--------------------------------------------------------------------------
- def create_item_window
- wx = @status_window.width
- wy = @help_window.height
- ww = Graphics.width - wx
- 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
- @command_window.activate
- end
- #--------------------------------------------------------------------------
- # ● 指令“全部卸下”
- #--------------------------------------------------------------------------
- def command_clear
- Sound.play_equip
- @actor.clear_equipments
- @status_window.refresh
- @slot_window.refresh
- @command_window.activate
- end
- #--------------------------------------------------------------------------
- # ● 装备栏“确定”
- #--------------------------------------------------------------------------
- def on_slot_ok
- @item_window.activate
- @item_window.select(0)
- end
- #--------------------------------------------------------------------------
- # ● 装备栏“取消”
- #--------------------------------------------------------------------------
- def on_slot_cancel
- @slot_window.unselect
- @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
- command_equip
- end
- end
复制代码 你可能会用到
#装备画面中,显示可替换装备的窗口。只显示一列 class Window_EquipItem < Window_ItemList #-------------------------------------------------------------------------- # ● 获取列数 #-------------------------------------------------------------------------- def col_max return 1 end end
#装备画面中,显示可替换装备的窗口。只显示一列
class Window_EquipItem < Window_ItemList
#--------------------------------------------------------------------------
# ● 获取列数
#--------------------------------------------------------------------------
def col_max
return 1
end
end
|