#============================================================================== # ■ VX-RGSS-2-load TitleCustom【ロード】 by Claimh #------------------------------------------------------------------------------ # USE_LOADが有効のときに使用します。 #------------------------------------------------------------------------------ # ロード画面から戻る際にロゴ等を表示されないようにできます。 # 基本的にScene_Fileの処理をそのままコピー #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # ● ロードフェーズ:総合フレーム更新 #-------------------------------------------------------------------------- def update_phase_load case @local_phase when 0; load_phase_initialize # 準備 when 1; load_phase_update # 操作フレーム更新 when 2; load_phase_terminate # 終了 end title_phase_update_titleback end #-------------------------------------------------------------------------- # ● ロードフェーズ:準備 #-------------------------------------------------------------------------- def load_phase_initialize # Load.initialize # テンポラリオブジェクトを再作成 $game_temp = Game_Temp.new # タイムスタンプが最新のファイルを選択 $game_temp.last_file_index = 0 latest_time = Time.at(0) for i in 0...Title_Custom::SAVE_FILE_MAX filename = save_file(i) if FileTest.exist?(filename) file = File.open(filename, "r") if file.mtime > latest_time latest_time = file.mtime $game_temp.last_file_index = i end file.close end end # start & create_savefile_windows # ヘルプウィンドウを作成 @help_window = Window_Help.new # @savefile_windows = [] for i in 0...Title_Custom::SAVE_FILE_MAX @savefile_windows.push(Window_SaveFile.new(i, save_file(i))) end @load_item_max = Title_Custom::SAVE_FILE_MAX # @load_index = load_phase_latest_file_index @help_window.set_text(Vocab::LoadMessage) @savefile_windows[@load_index].selected = true # @local_phase = 1 end #-------------------------------------------------------------------------- # ● タイムスタンプが最新のファイルを選択 #-------------------------------------------------------------------------- def load_phase_latest_file_index index = 0 latest_time = Time.at(0) for i in 0...@savefile_windows.size if @savefile_windows[i].time_stamp > latest_time latest_time = @savefile_windows[i].time_stamp index = i end end return index end #-------------------------------------------------------------------------- # ● ロードフェーズ:操作フレーム更新 #-------------------------------------------------------------------------- def load_phase_update # ウィンドウを更新 @help_window.update for i in @savefile_windows i.update end if Input.trigger?(Input::C) if @savefile_windows[@load_index].file_exist Sound.play_load load_phase_do_load else Sound.play_buzzer return end elsif Input.trigger?(Input::B) load_phase_on_cancel return else last_index = @load_index if Input.repeat?(Input::DOWN) load_phase_cursor_down(Input.trigger?(Input::DOWN)) end if Input.repeat?(Input::UP) load_phase_cursor_up(Input.trigger?(Input::UP)) end if @load_index != last_index Sound.play_cursor @savefile_windows[last_index].selected = false @savefile_windows[@load_index].selected = true end end end #-------------------------------------------------------------------------- # ● ロードの実行 #-------------------------------------------------------------------------- def load_phase_do_load file = File.open(@savefile_windows[@load_index].filename, "rb") load_phase_read_save_data(file) file.close $scene = Scene_Map.new RPG::BGM.fade(1500) Graphics.fadeout(60) Graphics.wait(40) @last_bgm.play @last_bgs.play # 終了 @phase = 0 load_phase_exit end #-------------------------------------------------------------------------- # ● セーブデータの読み込み # file : 読み込み用ファイルオブジェクト (オープン済み) #-------------------------------------------------------------------------- def load_phase_read_save_data(file) characters = Marshal.load(file) Graphics.frame_count = Marshal.load(file) @last_bgm = Marshal.load(file) @last_bgs = Marshal.load(file) $game_system = Marshal.load(file) $game_message = Marshal.load(file) $game_switches = Marshal.load(file) $game_variables = Marshal.load(file) $game_self_switches = Marshal.load(file) $game_actors = Marshal.load(file) $game_party = Marshal.load(file) $game_troop = Marshal.load(file) $game_map = Marshal.load(file) $game_player = Marshal.load(file) if $game_system.version_id != $data_system.version_id $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end end #-------------------------------------------------------------------------- # ● ロードフェーズ:キャンセル #-------------------------------------------------------------------------- def load_phase_on_cancel Sound.play_cancel @phase = PHASE_TITLE load_phase_exit end #-------------------------------------------------------------------------- # ● カーソルを下に移動 # wrap : ラップアラウンド許可 #-------------------------------------------------------------------------- def load_phase_cursor_down(wrap) if @load_index < @load_item_max - 1 or wrap @load_index = (@load_index + 1) % @load_item_max end end #-------------------------------------------------------------------------- # ● カーソルを上に移動 # wrap : ラップアラウンド許可 #-------------------------------------------------------------------------- def load_phase_cursor_up(wrap) if @load_index > 0 or wrap @load_index = (@load_index - 1 + @load_item_max) % @load_item_max end end #-------------------------------------------------------------------------- # ● ロードフェーズ:終了 #-------------------------------------------------------------------------- def load_phase_exit @local_phase = 0 # ウィンドウを解放 @help_window.dispose for i in @savefile_windows i.dispose end end end