Compare commits

...

4 Commits

Author SHA1 Message Date
YZ\249929363 634de5cc35 Merge branch 'main' of https://git.sparkus.cn/yangzhao/cb 2025-07-31 18:26:49 +08:00
YZ\249929363 c9f365ce5e no message 2025-07-31 18:26:42 +08:00
YZ\249929363 9b4aed918d Merge branch 'main' of https://git.sparkus.cn/yangzhao/cb 2025-07-31 18:05:02 +08:00
YZ\249929363 ab279abf5c 暂存 2025-07-31 18:04:57 +08:00
4 changed files with 98 additions and 86 deletions

View File

@ -16731,12 +16731,10 @@
"setUi": {
"__id__": 96
},
"monthCardReward": {
"__id__": 322
},
"cardTime": {
"__id__": 341
},
"monthCardBtn": null,
"monthCardBtn2": null,
"monthCardTime": null,
"monthCard": null,
"_id": "0dna+7W/NMp6RyIrSQLx5u"
},
{

View File

@ -64,20 +64,14 @@ export default class JiaZai extends cc.Component {
setUi: cc.Node = null;
scheduleCallback2: any;
//月卡
// @property(cc.Node)
// monthCardBtn: cc.Node = null;
// @property(cc.Node)
// monthCardBtn2: cc.Node = null;
// @property(cc.Node)
// monthCardTime: cc.Node = null;
// @property(cc.Node)
// monthCard: cc.Node = null;
@property(cc.Node)
monthCardReward: cc.Node = null;
//剩余天数
monthCardBtn: cc.Node = null;
@property(cc.Node)
cardTime: cc.Node = null;
monthCardBtn2: cc.Node = null;
@property(cc.Node)
monthCardTime: cc.Node = null;
@property(cc.Node)
monthCard: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
onLoad() {
@ -137,7 +131,17 @@ export default class JiaZai extends cc.Component {
this.setFirstInfo();
cc.fx.GameConfig.GM_INFO.first = false;
}
cc.fx.GameConfig.LEVEL_INFO_init(true, 1000);
let power = cc.fx.GameTool.getUserPowerTime();
if (cc.fx.GameConfig.GM_INFO.hp < 1 && power == false) {
MiniGameSdk.API.showToast("体力值不足,无法进入好友关卡");
setTimeout(() => {
this.openHeath();
}, 1000);
return;
}
else {
cc.fx.GameConfig.LEVEL_INFO_init(true, 1000);
}
}
else {
if (cc.fx.GameConfig.GM_INFO.first) {
@ -193,9 +197,8 @@ export default class JiaZai extends cc.Component {
// //打开heath弹窗
// this.openHeath();
this.uploadToCloud(cc.fx.GameConfig.GM_INFO.level + 1);
this.getMonthlyCardValidityDays();
this.rewarded();
// this.rewarded();
// this.getMonthlyCardValidityDays();
Utils.getMonthlyCard((data) => {
if (data.code == 1) {
cc.fx.GameConfig.GM_INFO.hp_Max = 7;
@ -760,53 +763,63 @@ export default class JiaZai extends cc.Component {
openMonthCard() {
this.openMonthlyCard();
this.monthlyCardNode.getComponent("monthlyCard").home = 1;
// this.monthCard.active = true;
// Utils.getMonthlyCard((data) => {
// if (data.msg == "不在有效期") {
// this.monthCardBtn.active = true;
// this.monthCardBtn2.active = false;
// } else {
// this.monthCardBtn.active = false;
// this.monthCardBtn2.active = true;
// NumberToImage.numberToImageNodes(25, 35, 20, "month_", this.monthCardTime, true);
// }
// })
}
//关闭界面
// closeMonthCard() {
// Utils.getMonthlyCard((data) => {
// if (data.msg == "不在有效期") {
// this.monthCardBtn.active = true;
// this.monthCardBtn2.active = false;
// } else {
// this.monthCardBtn.active = false;
// this.monthCardBtn2.active = true;
// NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true);
// }
// })
// this.monthCard.active = false;
// this.rewarded();
closeMonthCard() {
Utils.getMonthlyCard((data) => {
if (data.msg == "不在有效期") {
this.monthCardBtn.active = true;
this.monthCardBtn2.active = false;
} else {
this.monthCardBtn.active = false;
this.monthCardBtn2.active = true;
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true);
}
})
this.monthCard.active = false;
this.rewarded();
// }
// //购买月卡
// buyMonthCard() {
// Utils.setMonthlyCard(0, (data) => {
// console.log("购买月卡'✅ ", data.code);
// if (data.code == 1) {
// let rewardData = [
// { type: "coin", count: 6000 },
// ]
// cc.fx.GameConfig.GM_INFO.hp_Max = 7;
// cc.fx.GameConfig.GM_INFO.hp = 7;
// cc.fx.GameTool.changeCoin(6000);
// setTimeout(() => {
// this.updateCoin();
// this.setHealthInfo(false);
// this.startTimeCutDown();
// this.openRewardWindow(rewardData, 1);
// }, 300);
// cc.fx.GameTool.setUserHealth(0, (data) => {
// cc.fx.GameTool.getHealth(null);
// })
// this.monthCardBtn.active = false;
// this.monthCardBtn2.active = true;
// NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true);
}
//购买月卡
buyMonthCard() {
Utils.setMonthlyCard(0, (data) => {
console.log("购买月卡'✅ ", data.code);
if (data.code == 1) {
let rewardData = [
{ type: "coin", count: 6000 },
]
cc.fx.GameConfig.GM_INFO.hp_Max = 7;
cc.fx.GameConfig.GM_INFO.hp = 7;
cc.fx.GameTool.changeCoin(6000);
setTimeout(() => {
this.updateCoin();
this.setHealthInfo(false);
this.startTimeCutDown();
this.openRewardWindow(rewardData, 1);
}, 300);
cc.fx.GameTool.setUserHealth(0, (data) => {
cc.fx.GameTool.getHealth(null);
})
this.monthCardBtn.active = false;
this.monthCardBtn2.active = true;
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true);
// }
// })
// }
}
})
}
rewarded() {
rewarded() {
Utils.monthGetReward((data) => {
if (data.data == null) {
console.log("到期");
@ -824,17 +837,33 @@ export default class JiaZai extends cc.Component {
this.startTimeCutDown();
}, 300);
}
if (data.data != null && data.code == 0) {
console.log("未到期已领取");
}
if (data.code == 1) {
this.monthCardReward.active = true;
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 40, 20, "month_", this.cardTime, true);
cc.fx.GameTool.changeCoin(500);
this.updateCoin();
let rewardData = [
{ type: "coin", count: 500 },
]
setTimeout(() => {
this.openRewardWindow(rewardData);
}, 500);
const dataTemp = {
change_reason: "month",
id: "1001",
num: 500,
compensate: false
}
cc.fx.GameTool.shushu_Track("resource_get", dataTemp);
}
})
}
//缓存弹窗
monthH() {
// return;
@ -884,8 +913,7 @@ export default class JiaZai extends cc.Component {
const remainingDays = Math.max(0, days);
cc.fx.GameConfig.GM_INFO.monthTime = remainingDays;
console.log('%c月卡剩余天数 (零点刷新): ' + remainingDays,
'color: green; font-weight: bold;');
console.log('月卡剩余天数 (零点刷新):', remainingDays);
} else {
}
});
@ -939,19 +967,5 @@ export default class JiaZai extends cc.Component {
}
}
onCardReward() {
cc.fx.GameTool.changeCoin(500);
this.updateCoin();
const dataTemp = {
change_reason: "month",
id: "1001",
num: 500,
compensate: false
}
cc.fx.GameTool.shushu_Track("resource_get", dataTemp);
this.monthCardReward.active = false;
}
// update (dt) {}
}

View File

@ -391,8 +391,8 @@
0,
0,
1,
2,
2,
1,
1,
1
]
},

View File

@ -1,7 +1,7 @@
{
"title": "ColorBlock",
"packageName": "org.cocos2d.demo",
"startScene": "2de37ca5-4d32-4e18-88c6-c12770e085e9",
"startScene": "9c08062d-4cf1-4b6e-a8ba-4a3881cc7e7d",
"excludeScenes": [],
"orientation": {
"landscapeRight": true,