This commit is contained in:
tothvillar
2026-07-09 15:04:14 +08:00
commit e896e2ead4
1180 changed files with 115132 additions and 0 deletions
+156
View File
@@ -0,0 +1,156 @@
cc.Class({
extends: cc.Component,
properties: {},
init: function () {
cc.global = this;
cc.playerData = {};
cc.global.PlayerData = {};
cc.global.level = 1;
cc.global.historyMaxLevel = 1;
cc.global.coin = 0;
cc.global.gameModel = "";
cc.global.levelDate = null;
cc.global.levellist = [];
cc.global.gem = 0;
cc.global.power = 10;
cc.global.powerRecoverTime = 0;
cc.global.soundValueData = {
musicValue: 1,
effectValue: 1
};
cc.global.offenderIndex = 0;
cc.global.levelData = [];
cc.global.lastOnLineTime = 0;
cc.global.signInfo = {
days: 0,
allow: true
};
cc.global.firstGame = true;
cc.global.needGuidance = false;
cc.global.guidance = 0;
cc.global.firstToHome = true;
cc.global.nowChoseBigIndex = -1;
cc.global.nowChoseSmallIndex = -1;
cc.global.gamewin = false;
cc.global.game1_levelOrder = [1, 51, 21, 54, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 50, 18, 19, 20, 53, 52, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49];
cc.global.game2_levelOrder = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70];
this.initPlayerData();
cc.global.levelLimit = [];
},
initPlayerData: function () {
cc.playerData.game1_level = 1;
cc.playerData.game2_level = 1;
cc.playerData.LevelMaxData = 30;
cc.playerData.hande_DATA = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
cc.playerData.handeType = 1;
cc.playerData.coin = 200;
cc.playerData.power = 10;
this.getPlayerData();
},
onTaskUpdate: function (e) {
console.log("更新任务:", e);
cc.global.taskInfo[e].progress.now++;
cc.sys.localStorage.setItem("taskInfo", JSON.stringify(cc.global.taskInfo));
},
onTransitionPosition: function (e, o, t) {
var i = e.convertToWorldSpaceAR(t);
return o.convertToNodeSpaceAR(i);
},
onNumberFormatting: function (e) {
e = e.toString();
return new cc.Numerical(e).getDetails().display;
},
onVibrateShort: function () {
console.log("震动...........");
window.qq && window.qq.vibrateLong({
success: function (e) {}
});
window.tt && window.tt.vibrateLong({
success: function (e) {}
});
window.swan && window.swan.vibrateLong({
success: function (e) {}
});
window.qg && window.qg.vibrateLong({
success: function (e) {}
});
window.wx && window.wx.vibrateLong({
success: function (e) {}
});
},
setCoinNum: function (e) {
cc.playerData.coin += e;
cc.global.savePlayerData();
},
LoadPreFtabData: function (e, o) {
console.log("预制体11111");
cc.loader.loadRes(e, function (t, i) {
if (t) {
console.log("预制体22222" + t);
} else if (i instanceof cc.Prefab) {
var n = "";
var a = e.split("/");
n = a.length <= 0 ? e : a[a.length - 1];
if (cc.director.getScene().getChildByName(n)) {
console.log("预制体22222444444444444");
} else {
var c = cc.instantiate(i);
c.callBack = o;
c.parent = cc.director.getScene();
c.zIndex = 1;
}
} else {
console.log("预制体222223333333333333");
}
});
},
typingAni: function (e, o, t) {
if (this.work) {
this.work = true;
this.unschedule(this.func, this);
} else {
this.work = true;
}
var i = "";
var n = o.split("");
var a = n.length;
var c = 0;
this.func = function () {
i += n[c];
e.string = i;
if (++c == a) {
this.unschedule(this.func, this);
t && t();
this.work = false;
}
}.bind(this);
this.schedule(this.func, .1, cc.macro.REPEAT_FOREVER, 0);
},
timeFormat: function (e) {
e *= 1e3;
Math.floor(e / 1e3 / 60 / 60 / 24);
Math.floor(e / 1e3 / 60 / 60 % 24);
return Math.floor(e / 1e3 / 60 % 60) + ":" + Math.floor(e / 1e3 % 60);
},
randomArray: function (e) {
e.sort(function (e, o) {
if (Math.random() > .5) {
return -1;
} else {
return 1;
}
});
},
savePlayerData: function () {
cc.sys.localStorage.setItem("playerData_hhds", JSON.stringify(cc.playerData));
},
getPlayerData: function (e) {
var o = cc.sys.localStorage.getItem("playerData_hhds");
if (o) {
cc.playerData = JSON.parse(o);
} else {
cc.sys.localStorage.setItem("playerData_hhds", JSON.stringify(cc.playerData));
}
e && e();
}
});