加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 taroxd 于 2014-11-23 13:39 编辑
该脚本可能作为其他脚本的基础来使用。由于可能造成存档不兼容
#-------------------------------------------------------------------------- # ● require Taroxd基础设置 #-------------------------------------------------------------------------- Taroxd::Global = {} symbol = :taroxd_global #------------------------------------------------------------------------ # ● 新游戏 #------------------------------------------------------------------------ on_new_game = Taroxd::Global.method(:clear) #------------------------------------------------------------------------ # ● 存档 #------------------------------------------------------------------------ on_save = lambda do |contents| contents[symbol] = Taroxd::Global contents end #------------------------------------------------------------------------ # ● 读档 #------------------------------------------------------------------------ on_load = lambda do |contents| data = contents[symbol] Taroxd::Global.replace(data) if data end DataManager.singleton_def_before :setup_new_game, on_new_game DataManager.singleton_def_with :make_save_contents, on_save DataManager.singleton_def_after :extract_save_contents, on_load
#--------------------------------------------------------------------------
# ● require Taroxd基础设置
#--------------------------------------------------------------------------
Taroxd::Global = {}
symbol = :taroxd_global
#------------------------------------------------------------------------
# ● 新游戏
#------------------------------------------------------------------------
on_new_game = Taroxd::Global.method(:clear)
#------------------------------------------------------------------------
# ● 存档
#------------------------------------------------------------------------
on_save = lambda do |contents|
contents[symbol] = Taroxd::Global
contents
end
#------------------------------------------------------------------------
# ● 读档
#------------------------------------------------------------------------
on_load = lambda do |contents|
data = contents[symbol]
Taroxd::Global.replace(data) if data
end
DataManager.singleton_def_before :setup_new_game, on_new_game
DataManager.singleton_def_with :make_save_contents, on_save
DataManager.singleton_def_after :extract_save_contents, on_load
|