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
+77
View File
@@ -0,0 +1,77 @@
cc.Class({
extends: cc.Component,
properties: {
contentNode: {
default: null,
type: cc.Node,
displayName: "签到内容节点"
},
qiandaoBtn: {
default: null,
type: cc.Node,
displayName: "普通签到按钮"
},
shuabeiBtn: {
default: null,
type: cc.Node,
displayName: "双倍领取按钮"
},
dayNode: null
},
start: function () {
cc.PlatformTools.executeShowBanner();
cc.PlatformTools.executeShowInterstitial();
this.onShowUI();
},
onShowUI: function () {
this.dayNode = this.contentNode.children;
var e = cc.global.signInfo.days;
if (0 == cc.global.signInfo.allow) {
console.log("今日已签到");
this.qiandaoBtn.active = false;
this.shuabeiBtn.active = false;
}
for (var o = 0; o < this.dayNode.length; o++) {
var t = this.dayNode[o].getChildByName("yilingqu");
t.active = false;
o < e && (t.active = true);
}
},
onSuccessSign: function (e) {
var o = cc.global.signInfo.days;
var t = cc.global.signInfo.allow;
console.log("days:" + o);
6 == o && 200 == e && (e += 200);
if (0 != t) {
GlobData.ShowAsk(" 签到成功\n 获得" + e + "个金币");
cc.global.signInfo.allow = false;
cc.global.signInfo.days++;
cc.playerData.coin += e;
cc.global.savePlayerData();
cc.sys.localStorage.setItem("signInfo", JSON.stringify(cc.global.signInfo));
this.onCloseUI();
} else {
console.log("今日已签到");
}
},
onClickBtnEvent: function (e) {
cc.global.Source.onPlayBtnEffect("buttonClick");
switch (e.target.name) {
case "qandaoBtn":
this.onSuccessSign(100);
break;
case "shuangbeiBtn":
var o = this;
cc.PlatformTools.executeShowAwardVideo(function () {
o.onSuccessSign(200);
}, function () {});
break;
case "CloseBtn":
this.onCloseUI();
}
},
onCloseUI: function () {
cc.global.Source.onPlayBtnEffect("buttonClick");
GlobData.GameBtnClose(this.node, true);
}
});