本帖最后由 alexncf125 于 2020-9-19 09:33 编辑
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
「在保存之前将它们都转换为空数组」和「在保存成功后还原它们成原先的数组」写好了
「在加载成功后重新定义它们」的重新定义是什么意思??
重新定义没问题吗?会把旧的变成新的吧?
我的意思大概是:一开始是a 不知会不会转成的=>b 重新定义=>新的a |