#============================================================================== # 本脚本来自[url]www.66rpg.com[/url],转载和使用请保留此信息 #============================================================================== #============================================================================== # ■ Scene_File #------------------------------------------------------------------------------ # 存档画面及读档画面的超级类。 # 脚本优化: SailCat #============================================================================== class Scene_File #-------------------------------------------------------------------------- # ● 常量 (存档页数) #-------------------------------------------------------------------------- MaxPages = 25 #-------------------------------------------------------------------------- # ● 初始化对像 # help_text : 帮助窗口显示的字符串 #-------------------------------------------------------------------------- def initialize(help_text) @help_text = help_text @slots = MaxPages * 4 end #-------------------------------------------------------------------------- # ● 主处理 #-------------------------------------------------------------------------- def main # 生成帮助窗口 @help_window = Window_Help.new @help_window.set_text(@help_text) @file_index = $game_temp.last_file_index # 生成存档文件窗口 @savefile_windows = [] # 选择最后操作的文件 for i in @file_index / 4 * 4..@file_index / 4 * 4 + 3 load_window(i) @savefile_windows[i].visible = true end @savefile_windows[@file_index].selected = true # 执行过渡 Graphics.transition # 主循环 loop do # 刷新游戏画面 Graphics.update # 刷新输入信息 Input.update # 刷新画面 update # 如果画面被切换的话就中断循环 if $scene != self break end end # 准备过渡 Graphics.freeze # 释放窗口 @help_window.dispose for i in @savefile_windows i.dispose end end #-------------------------------------------------------------------------- # ● 刷新画面 #-------------------------------------------------------------------------- def update # 刷新窗口 @help_window.update for i in @savefile_windows i.update if i.visible end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 调用过程 on_decision (定义继承目标) on_decision(make_filename(@file_index)) $game_temp.last_file_index = @file_index return end # 按下 B 键的情况下 if Input.trigger?(Input::B) # 调用过程 on_cancel (定义继承目标) on_cancel return end # 按下方向键下的情况下 if Input.repeat?(Input::DOWN) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 光标向下移动 @savefile_windows[@file_index].selected = false @file_index = (@file_index + 1) % @slots # 翻到下一页的情况下 if @file_index % 4 == 0 for index in @file_index / 4 * 4..@file_index / 4 * 4 + 3 @savefile_windows[(index + @slots - 4) % @slots].visible = false load_window(index) @savefile_windows[index].visible = true end end @savefile_windows[@file_index].selected = true return end # 按下方向键上的情况下 if Input.repeat?(Input::UP) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 光标向上移动 @savefile_windows[@file_index].selected = false @file_index = (@file_index + @slots - 1) % @slots # 翻到上一页的情况下 if @file_index % 4 == 3 for index in @file_index / 4 * 4..@file_index / 4 * 4 + 3 @savefile_windows[(index + 4) % @slots].visible = false load_window(index) @savefile_windows[index].visible = true end end @savefile_windows[@file_index].selected = true return end # 按下方向键左或者 L 的情况下 if Input.repeat?(Input::LEFT) or Input.trigger?(Input::L) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 前翻一页 @savefile_windows[@file_index].selected = false @file_index = (@file_index + @slots - 4) % @slots for index in @file_index / 4 * 4..@file_index / 4 * 4 + 3 @savefile_windows[(index + 4) % @slots].visible = false load_window(index) @savefile_windows[index].visible = true end @savefile_windows[@file_index].selected = true return end # 按下方向键右或者 R 的情况下 if Input.repeat?(Input::RIGHT) or Input.trigger?(Input::R) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 前翻一页 @savefile_windows[@file_index].selected = false @file_index = (@file_index + 4) % @slots for index in @file_index / 4 * 4..@file_index / 4 * 4 + 3 @savefile_windows[(index + @slots - 4) % @slots].visible = false load_window(index) @savefile_windows[index].visible = true end @savefile_windows[@file_index].selected = true return end end #-------------------------------------------------------------------------- # ● 生成文件名 # file_index : 文件名的索引 (0~n) #-------------------------------------------------------------------------- def make_filename(file_index) return "Save#{file_index + 1}.rxdata" end #-------------------------------------------------------------------------- # ● 载入当前页存档 # 避免因存档位过多造成的卡壳现象 #-------------------------------------------------------------------------- def load_window(i) if @savefile_windows[i] != nil return else @savefile_windows[i] = Window_SaveFile.new(i, make_filename(i)) end end end #============================================================================== # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息 #==============================================================================
QQ截图20130823203032.png (7.21 KB, 下载次数: 2)
QQ图片20130823234533.jpg (1.03 KB, 下载次数: 5)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |