用法一样。第一段插在 Main 前,实际使用调用第二段
class Scene_Load def autoload filename = 'Save1.rxdata' unless FileTest.exist?(filename) return end # Read save data file = File.open(filename, "rb") read_save_data(file) file.close # Restore BGM and BGS $game_system.bgm_play($game_system.playing_bgm) $game_system.bgs_play($game_system.playing_bgs) # Update map (run parallel process event) $game_map.update # Switch to map screen $scene = Scene_Map.new end end
class Scene_Load
def autoload
filename = 'Save1.rxdata'
unless FileTest.exist?(filename)
return
end
# Read save data
file = File.open(filename, "rb")
read_save_data(file)
file.close
# Restore BGM and BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
end
load = Scene_Load.new load.autoload
load = Scene_Load.new
load.autoload
|