目次 [show]
HTMLファイルに追記
本体改造しなくてもいいので安全だけど、テンプレートがわけわからんくなりがち。
例:f.test を表示したい場合
{{:stat.f.test}}
だけだと、f変数の配列が作成されてない初期データ(セーブ前のデータ)でエラーが出るので、stat.f
の有無で分岐しておく。
save.html / load.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{if stat.f}} | |
{{if stat.f.test}} | |
{{:stat.f.test}} <!--※変数--> | |
{{else}} | |
データが無い場合 <!--※f.test 変数が無い場合--> | |
{{/if}} | |
{{else}} | |
データが無い場合 <!--※f変数の配列自体が無い場合(初期値)--> | |
{{/if}} |
本体改造
改造が面倒だけど、テンプレートはスッキリ。
kag.menu.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doSave : function(num,cb) { | |
var array_save = this.getSaveData(); | |
var data = {}; | |
var that = this; | |
if (this.snap == null) { | |
this.snapSave(this.kag.stat.current_save_str, function() { | |
data = that.snap; | |
data.test = that.kag.stat.f.test; //←変数 f.test | |
data.save_date = $.getNowDate() + " " + $.getNowTime(); | |
array_save.data[num] = data; | |
$.setStorage(that.kag.config.projectID + "_tyrano_data", array_save, that.kag.config.configSave); | |
if(typeof cb=="function"){ | |
cb(); | |
} | |
}); | |
}else{ | |
if(typeof cb=="function"){ | |
cb(); | |
} | |
} | |
}, |
save.html / load.html
{{:test}} を追記
関連記事
スポンサーリンク