赞 | 1 |
VIP | 127 |
好人卡 | 25 |
积分 | 5 |
经验 | 59654 |
最后登录 | 2020-12-3 |
在线时间 | 820 小时 |
卑微的梦
- 梦石
- 0
- 星屑
- 523
- 在线时间
- 820 小时
- 注册时间
- 2013-2-23
- 帖子
- 1185
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- #=============================================================================
- # 解谜用简单菜单 by 子弹君
- #=============================================================================
- #=============================================================================
- # 说明:
- # 连module都没设置我是不是很懒啊= =
- # 现在这个属于基础版本,未来有时间再优化吧
- #=============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- create_command_window
- end
- #--------------------------------------------------------------------------
- # ● 生成指令窗口
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_MenuCommand.new
- @command_window.set_handler(:item, method(:command_item))
- @command_window.set_handler(:save, method(:command_save))
- @command_window.set_handler(:game_end, method(:command_game_end))
- @command_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # ● 指令“物品”
- #--------------------------------------------------------------------------
- def command_item
- SceneManager.call(Scene_Item)
- end
- #--------------------------------------------------------------------------
- # ● 指令“存档”
- #--------------------------------------------------------------------------
- def command_save
- SceneManager.call(Scene_Save)
- end
- #--------------------------------------------------------------------------
- # ● 指令“结束游戏”
- #--------------------------------------------------------------------------
- def command_game_end
- SceneManager.call(Scene_End)
- end
- end
- class Window_MenuCommand < Window_Command
- #--------------------------------------------------------------------------
- # ● 初始化指令选择位置(类方法)
- #--------------------------------------------------------------------------
- def self.init_command_position
- @@last_command_symbol = nil
- end
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- update_placement
- select_last
- end
- #--------------------------------------------------------------------------
- # ● 获取窗口的宽度
- #--------------------------------------------------------------------------
- def window_width
- return 160
- end
- #--------------------------------------------------------------------------
- # ● 更新窗口的位置
- #--------------------------------------------------------------------------
- def update_placement
- self.x = (Graphics.width - width) / 2
- self.y = (Graphics.height - height) / 2
- end
- #--------------------------------------------------------------------------
- # ● 获取显示行数
- #--------------------------------------------------------------------------
- def visible_line_number
- item_max
- end
- #--------------------------------------------------------------------------
- # ● 生成指令列表
- #--------------------------------------------------------------------------
- def make_command_list
- add_main_commands
- add_original_commands
- add_save_command
- add_game_end_command
- end
- #--------------------------------------------------------------------------
- # ● 向指令列表添加主要的指令
- #--------------------------------------------------------------------------
- def add_main_commands
- add_command(Vocab::item, :item, main_commands_enabled)
- end
- #--------------------------------------------------------------------------
- # ● 添加存档指令
- #--------------------------------------------------------------------------
- def add_save_command
- add_command(Vocab::save, :save, save_enabled)
- end
- #--------------------------------------------------------------------------
- # ● 添加游戏结束指令
- #--------------------------------------------------------------------------
- def add_game_end_command
- add_command(Vocab::game_end, :game_end)
- end
- #--------------------------------------------------------------------------
- # ● 获取主要指令的有效状态
- #--------------------------------------------------------------------------
- def main_commands_enabled
- $game_party.exists
- end
- #--------------------------------------------------------------------------
- # ● 获取存档的有效状态
- #--------------------------------------------------------------------------
- def save_enabled
- !$game_system.save_disabled
- end
- #--------------------------------------------------------------------------
- # ● 按下确定键时的处理
- #--------------------------------------------------------------------------
- def process_ok
- @@last_command_symbol = current_symbol
- super
- end
- #--------------------------------------------------------------------------
- # ● 返回最后一个选项的位置
- #--------------------------------------------------------------------------
- def select_last
- select_symbol(@@last_command_symbol)
- end
- end
复制代码 |
|