Salve,sono qui per chiedervi come modificare lo scene_load in modo da permettere di caricare anche dal menù...Richiamandola con $scene_load.new,una volta entrati se premo esc torna al titolo al posto del menù...Siccome uso la stessa scene anche dal titolo volevo chiedervi se era possibile modificarla evitando di creare una scene load solo per il menù...
Ecco la scene_load:
#==============================================================================# ** Scene_Load#------------------------------------------------------------------------------# This class performs load screen processing.#============================================================================== class Scene_Load < Scene_File #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Remake temporary object $game_temp = Game_Temp.new # Timestamp selects new file $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("Quale slot vuoi caricare?") end #-------------------------------------------------------------------------- # * Decision Processing #-------------------------------------------------------------------------- def on_decision(filename) # If file doesn't exist unless FileTest.exist?(filename) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play load SE $game_system.se_play($data_system.load_se) # 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 #-------------------------------------------------------------------------- # * Cancel Processing #-------------------------------------------------------------------------- def on_cancel # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to title screen $scene = Scene_Title.new end #-------------------------------------------------------------------------- # * Read Save Data # file : file object for reading (opened) #-------------------------------------------------------------------------- def read_save_data(file) # Read character data for drawing save file characters = Marshal.load(file) # Read frame count for measuring play time Graphics.frame_count = Marshal.load(file) # Read each type of game object $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) Marshal.load($max_picture,file) # If magic number is different from when saving # (if editing was added with editor) if $game_system.magic_number != $data_system.magic_number # Load map $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end # Refresh party members $game_party.refresh endend
Credo che la modifica và fatta del def on_cancel..
Question
Squall_Leonheart
Salve,sono qui per chiedervi come modificare lo scene_load in modo da permettere di caricare anche dal menù...Richiamandola con $scene_load.new,una volta entrati se premo esc torna al titolo al posto del menù...Siccome uso la stessa scene anche dal titolo volevo chiedervi se era possibile modificarla evitando di creare una scene load solo per il menù...
Ecco la scene_load:
#==============================================================================# ** Scene_Load#------------------------------------------------------------------------------# This class performs load screen processing.#============================================================================== class Scene_Load < Scene_File #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Remake temporary object $game_temp = Game_Temp.new # Timestamp selects new file $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("Quale slot vuoi caricare?") end #-------------------------------------------------------------------------- # * Decision Processing #-------------------------------------------------------------------------- def on_decision(filename) # If file doesn't exist unless FileTest.exist?(filename) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play load SE $game_system.se_play($data_system.load_se) # 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 #-------------------------------------------------------------------------- # * Cancel Processing #-------------------------------------------------------------------------- def on_cancel # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to title screen $scene = Scene_Title.new end #-------------------------------------------------------------------------- # * Read Save Data # file : file object for reading (opened) #-------------------------------------------------------------------------- def read_save_data(file) # Read character data for drawing save file characters = Marshal.load(file) # Read frame count for measuring play time Graphics.frame_count = Marshal.load(file) # Read each type of game object $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) Marshal.load($max_picture,file) # If magic number is different from when saving # (if editing was added with editor) if $game_system.magic_number != $data_system.magic_number # Load map $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end # Refresh party members $game_party.refresh endendCredo che la modifica và fatta del def on_cancel..
Iscriviti sul mio canale youtube -
https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber
Seguimi su Instagram -
https://www.instagram.com/ancestralguitarist/
---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------
FACE CONTEST # 3
BANNER CONTEST #69
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now