Auteur: Yukihiro matsumoto
#============================================
# ¡ Scene_Load
#----------------------------------------------
# @ƒ[ƒh‰æ–ʂ̈—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
#============================================
class Scene_Load < Scene_File
#------------------------------------------
# œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
#------------------------------------------
def initialize
# ƒeƒ“ƒ|ƒ‰ƒŠƒIƒuƒWƒFƒNƒg‚ðÄì¬
$game_temp = Game_Temp.new
# ƒ^ƒCƒ€ƒXƒ^ƒ“ƒv‚ªÅV‚̃tƒ@ƒCƒ‹‚ð‘I‘ð
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..3
filename = make_filename(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
super("Charger quelle partie?")
end
#------------------------------------------
# œ Œˆ’莞‚̈—
#------------------------------------------
def on_decision(filename)
# ƒtƒ@ƒCƒ‹‚ª‘¶Ý‚µ‚È‚¢ê‡
unless FileTest.exist?(filename)
# ƒuƒU[ SE ‚ð‰‰‘t
$game_system.se_play($data_system.buzzer_se)
return
end
# ƒ[ƒh SE ‚ð‰‰‘t
$game_system.se_play($data_system.load_se)
# ƒZ[ƒuƒf[ƒ^‚Ì‘‚«ž‚Ý
file = File.open(filename, "rb")
read_save_data(file)
file.close
# BGMABGS ‚𕜋A
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# ƒ}ƒbƒv‚ðXV (•À—ñƒCƒxƒ“ƒgŽÀs)
$game_map.update
# ƒ}ƒbƒv‰æ–Ê‚ÉØ‚è‘Ö‚¦
$scene = Scene_Map.new
end
#------------------------------------------
# œ ƒLƒƒƒ“ƒZƒ‹Žž‚̈—
#------------------------------------------
def on_cancel
# ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
$game_system.se_play($data_system.cancel_se)
# ƒ^ƒCƒgƒ‹‰æ–Ê‚ÉØ‚è‘Ö‚¦
$scene = Scene_Title.new
end
#------------------------------------------
# œ ƒZ[ƒuƒf[ƒ^‚Ì“Ç‚Ýž‚Ý
# file : “Ç‚Ýž‚Ý—pƒtƒ@ƒCƒ‹ƒIƒuƒWƒFƒNƒg (ƒI[ƒvƒ“Ï‚Ý)
#------------------------------------------
def read_save_data(file)
# ƒZ[ƒuƒtƒ@ƒCƒ‹•`‰æ—p‚̃Lƒƒƒ‰ƒNƒ^[ƒf[ƒ^‚ð“Ç‚Ýž‚Þ
characters = Marshal.load(file)
# ƒvƒŒƒCŽžŠÔŒv‘ª—p‚̃tƒŒ[ƒ€ƒJƒEƒ“ƒg‚ð“Ç‚Ýž‚Þ
Graphics.frame_count = Marshal.load(file)
# ŠeŽíƒQ[ƒ€ƒIƒuƒWƒFƒNƒg‚ð“Ç‚Ýž‚Þ
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = 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)
# ƒ}ƒWƒbƒNƒiƒ“ƒo[‚ªƒZ[ƒuŽž‚ƈقȂéê‡
# (ƒGƒfƒBƒ^‚Å•ÒW‚ª‰Á‚¦‚ç‚ê‚Ä‚¢‚éê‡)
if $game_system.magic_number != $data_system.magic_number
# ƒ}ƒbƒv‚ðƒŠƒ[ƒh
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# ƒp[ƒeƒBƒƒ“ƒo[‚ðƒŠƒtƒŒƒbƒVƒ…
$game_party.refresh
end
end |
|