class << DataManager alias m5_20131119_create_game_objects create_game_objects alias m5_20131119_make_save_contents make_save_contents alias m5_20131119_extract_save_contents extract_save_contents def create_game_objects m5_20131119_create_game_objects $debt = 0 end def make_save_contents m5_20131119_make_save_contents contents[:debt] = $debt contents end def extract_save_contents(contents) m5_20131119_extract_save_contents(contents) $debt = contents[:debt] end end
class << DataManager
alias m5_20131119_create_game_objects create_game_objects
alias m5_20131119_make_save_contents make_save_contents
alias m5_20131119_extract_save_contents extract_save_contents
def create_game_objects
m5_20131119_create_game_objects
$debt = 0
end
def make_save_contents
m5_20131119_make_save_contents
contents[:debt] = $debt
contents
end
def extract_save_contents(contents)
m5_20131119_extract_save_contents(contents)
$debt = contents[:debt]
end
end
↑存档的时候将你的全局变量保存进存档中 |