class Scene_Save < Scene_File
alias old_on_savefile_ok_old on_savefile_ok
def on_savefile_ok
@quack_msgs = []
@qmsg_windows = []
old_on_savefile_ok_old
end
end
class Scene_Load < Scene_File
alias old_on_load_success_old on_load_success
def on_load_success
old_on_load_success_old
$game_message.quack_msg_make
end
end
class Scene_Save < Scene_File
alias old_on_savefile_ok_old on_savefile_ok
def on_savefile_ok
@quack_msgs = []
@qmsg_windows = []
old_on_savefile_ok_old
end
end
class Scene_Load < Scene_File
alias old_on_load_success_old on_load_success
def on_load_success
old_on_load_success_old
$game_message.quack_msg_make
end
end
我这样写不行喔...是要用instance_variable_get吗??module DataManager
class << self
alias quack_msg_save_game save_game
def save_game(index)
@temp_quack_msgs = []
@temp_qmsg_windows = []
$game_message.instance_variable_get(:@quack_msgs).each {|temp| @temp_quack_msgs.push(temp) }
$game_message.instance_variable_get(:@qmsg_windows).each {|temp| @temp_qmsg_windows.push(temp) }
$game_message.instance_variable_get(:@quack_msgs).clear
$game_message.instance_variable_get(:@qmsg_windows).clear
quack_msg_save_game(index)
@temp_quack_msgs.each {|temp| $game_message.instance_variable_get(:@quack_msgs).push(temp) }
@temp_qmsg_windows.each {|temp| $game_message.instance_variable_get(:@qmsg_windows).push(temp) }
end
end
end
module DataManager
class << self
alias quack_msg_save_game save_game
def save_game(index)
@temp_quack_msgs = []
@temp_qmsg_windows = []
$game_message.instance_variable_get(:@quack_msgs).each {|temp| @temp_quack_msgs.push(temp) }
$game_message.instance_variable_get(:@qmsg_windows).each {|temp| @temp_qmsg_windows.push(temp) }
$game_message.instance_variable_get(:@quack_msgs).clear
$game_message.instance_variable_get(:@qmsg_windows).clear
quack_msg_save_game(index)
@temp_quack_msgs.each {|temp| $game_message.instance_variable_get(:@quack_msgs).push(temp) }
@temp_qmsg_windows.each {|temp| $game_message.instance_variable_get(:@qmsg_windows).push(temp) }
end
end
end
「在保存之前将它们都转换为空数组」和「在保存成功后还原它们成原先的数组」写好了