This commit is contained in:
YZ\249929363 2025-07-31 18:04:57 +08:00
parent e274e42ab1
commit ab279abf5c
3 changed files with 97 additions and 85 deletions

View File

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

View File

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

View File

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