赞 | 0 |
VIP | 8 |
好人卡 | 0 |
积分 | 31 |
经验 | 27987 |
最后登录 | 2017-7-21 |
在线时间 | 762 小时 |
Lv3.寻梦者
- 梦石
- 3
- 星屑
- 50
- 在线时间
- 762 小时
- 注册时间
- 2010-8-17
- 帖子
- 681
|
本帖最后由 嚴子 于 2011-8-4 19:21 编辑
档位无限,求认可- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Scene_File
- #——最大存档数量,一般我认为最多50足够了,20比较合适
- SAVEFILE_MAX = 99
- # -------------------
- def initialize(help_text)
- @help_text = help_text
- end
- # -------------------
- def main
- @help_window = Window_Help.new
- @help_window.set_text(@help_text)
- @savefile_windows = []
- @cursor_displace = 0
- for i in 0..3
- @savefile_windows.push(Window_SaveFile.new(i, make_filename(i), i))
- end
- @file_index = 0
- @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
- end
- if Input.trigger?(Input::C)
- on_decision(make_filename(@file_index))
- $game_temp.last_file_index = @file_index
- return
- end
- if Input.trigger?(Input::B)
- on_cancel
- return
- end
- if Input.repeat?(Input::DOWN)
- if Input.trigger?(Input::DOWN) or @file_index < SAVEFILE_MAX - 1
- if @file_index == SAVEFILE_MAX - 1
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- @cursor_displace += 1
- if @cursor_displace == 4
- @cursor_displace = 3
- for i in @savefile_windows
- i.dispose
- end
- @savefile_windows = []
- for i in 0..3
- f = i - 2 + @file_index
- name = make_filename(f)
- @savefile_windows.push(Window_SaveFile.new(f, name, i))
- @savefile_windows[i].selected = false
- end
- end
- $game_system.se_play($data_system.cursor_se)
- @file_index = (@file_index + 1)
- if @file_index == SAVEFILE_MAX
- @file_index = SAVEFILE_MAX - 1
- end
- for i in 0..3
- @savefile_windows[i].selected = false
- end
- @savefile_windows[@cursor_displace].selected = true
- return
- end
- end
- if Input.repeat?(Input::UP)
- if Input.trigger?(Input::UP) or @file_index > 0
- if @file_index == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- @cursor_displace -= 1
- if @cursor_displace == -1
- @cursor_displace = 0
- for i in @savefile_windows
- i.dispose
- end
- @savefile_windows = []
- for i in 0..3
- f = i - 1 + @file_index
- name = make_filename(f)
- @savefile_windows.push(Window_SaveFile.new(f, name, i))
- @savefile_windows[i].selected = false
- end
- end
- $game_system.se_play($data_system.cursor_se)
- @file_index = (@file_index - 1)
- if @file_index == -1
- @file_index = 0
- end
- for i in 0..3
- @savefile_windows[i].selected = false
- end
- @savefile_windows[@cursor_displace].selected = true
- return
- end
- end
- end
- # -------------------
- def make_filename(file_index)
- return "Save#{file_index + 1}.rxdata"
- end
- # -------------------
- end
-
- class Window_SaveFile < Window_Base
- # -------------------
- def initialize(file_index, filename, position)
- y = 64 + position * 104
- super(0, y, 640, 104)
- self.contents = Bitmap.new(width - 32, height - 32)
- @file_index = file_index
- @filename = "Save#{@file_index + 1}.rxdata"
- @time_stamp = Time.at(0)
- @file_exist = FileTest.exist?(@filename)
- if @file_exist
- file = File.open(@filename, "r")
- @time_stamp = file.mtime
- @characters = Marshal.load(file)
- @frame_count = Marshal.load(file)
- @game_system = Marshal.load(file)
- @game_switches = Marshal.load(file)
- @game_variables = Marshal.load(file)
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- end
- refresh
- @selected = false
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #在覆盖存档的时候弹出对话框提示
- class Scene_Save < Scene_File
- # -----------------------------
- def initialize
- super("储存到哪一个进度?")
- @confirm_window = Window_Base.new(120, 188, 400, 64)
- @confirm_window.contents = Bitmap.new(368, 32)
- string = "确定覆盖?"
- @confirm_window.contents.font.name = "黑体"
- @confirm_window.contents.font.size = 24
- @confirm_window.contents.draw_text(4, 0, 368, 32, string)
- @yes_no_window = Window_Command.new(100, ["是", "否"])
- @confirm_window.visible = false
- @confirm_window.z = 1500
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @yes_no_window.x = 270
- @yes_no_window.y = 252
- @yes_no_window.z = 1500
- @mode = 0
- end
- # -----------------------------
- def on_decision(filename)
- if FileTest.exist?(filename)
- @confirm_window.visible = true
- @yes_no_window.visible = true
- @yes_no_window.active = true
- @mode = 1
- else
- $game_system.se_play($data_system.save_se)
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- return
- end
- $scene = Scene_Menu.new(4)
- end
- end
- # -----------------------------
- def update
- if @mode == 0
- super
- else
- @help_window.update
- @yes_no_window.update
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- if @yes_no_window.index == 0
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @confirm_window.visible = false
- filename = make_filename(@file_index)
- $game_system.se_play($data_system.save_se)
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new(4)
- end
- else
- @confirm_window.visible = false
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @mode = 0
- end
- end
- if Input.trigger?(Input::B)
- @confirm_window.visible = false
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @mode = 0
- return
- end
- end
- end
- # -----------------------------
- def on_cancel
- $game_system.se_play($data_system.cancel_se)
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- return
- end
- $scene = Scene_Menu.new(4)
- end
- # -----------------------------
- def write_save_data(file)
- characters = []
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- characters.push([actor.character_name, actor.character_hue])
- end
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- $game_system.save_count += 1
- $game_system.magic_number = $data_system.magic_number
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- end
- end
- class Scene_File
- alias carol3_main main
- def main
- carol3_main
- if self.is_a?(Scene_Save)
- @confirm_window.dispose
- @yes_no_window.dispose
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 |
|