12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- module.exports = {
-
- initConfig:function() {
-
- this.name = "我的名字"
-
- this.login = false
-
-
- this.firstOpen = true
-
- this.score = 0;
-
- this.infiMode = false;
-
- var best = cc.sys.localStorage.getItem("save_best_score");
-
- if (best == null || best == "") {
- this.bestscore = 0
- } else {
- this.bestscore = parseInt (best)
- }
- best = cc.sys.localStorage.getItem("save_best_time");
-
- if (best == null || best == "") {
- this.besttime = 0;
- } else {
- this.besttime = parseInt (best);
- }
-
- console.log ("最高时间 = " + this.besttime + ", 最高分 = " + this.bestscore);
- },
-
-
- saveBestScore:function() {
-
- if (this.score > this.bestscore) {
- this.bestscore = this.score;
- cc.sys.localStorage.setItem("save_best_score", this.bestscore.toString())
- }
- },
-
- saveBestTime:function() {
-
- if (this.score > this.besttime) {
- this.besttime = this.score;
- cc.sys.localStorage.setItem("save_best_time", this.besttime.toString())
- }
- }
- };
- require("global").initConfig()
|