diff --git a/assets/Script/JiaZai.ts b/assets/Script/JiaZai.ts index 4ebe705..9d3466b 100644 --- a/assets/Script/JiaZai.ts +++ b/assets/Script/JiaZai.ts @@ -197,8 +197,9 @@ export default class JiaZai extends cc.Component { // //打开heath弹窗 // this.openHeath(); this.uploadToCloud(cc.fx.GameConfig.GM_INFO.level + 1); - // this.rewarded(); - // this.getMonthlyCardValidityDays(); + this.rewarded(); + this.getMonthlyCardValidityDays(); + console.log('月卡剩余天数 (零点刷新):', cc.fx.GameConfig.GM_INFO.monthTime); Utils.getMonthlyCard((data) => { if (data.code == 1) { cc.fx.GameConfig.GM_INFO.hp_Max = 7; @@ -480,8 +481,10 @@ export default class JiaZai extends cc.Component { if (!this.shopNode) { // 第一次使用,创建节点 + this.shopNode = cc.instantiate(JiaZai.cachedShopPrefab); this.node.addChild(this.shopNode); + this.shopNode.getComponent("shop").init(); } else { // 非第一次使用,直接激活节点 this.shopNode.active = true; @@ -913,7 +916,7 @@ export default class JiaZai extends cc.Component { const remainingDays = Math.max(0, days); cc.fx.GameConfig.GM_INFO.monthTime = remainingDays; - console.log('月卡剩余天数 (零点刷新):', remainingDays); + // console.log('月卡剩余天数 (零点刷新):', cc.fx.GameConfig.GM_INFO.monthTime ); } else { } }); diff --git a/assets/Script/SceneManager.ts b/assets/Script/SceneManager.ts index 3e8ff46..6055c16 100644 --- a/assets/Script/SceneManager.ts +++ b/assets/Script/SceneManager.ts @@ -361,6 +361,7 @@ export default class SceneManager extends cc.Component { // 第一次使用,创建节点 this.shopNode = cc.instantiate(SceneManager.cachedShopPrefab); this.node.addChild(this.shopNode); + this.shopNode.getComponent("shop").init(); } else { // 非第一次使用,直接激活节点 this.shopNode.active = true; diff --git a/assets/Script/monthlyCard.ts b/assets/Script/monthlyCard.ts index fd31ef8..b7ccb91 100644 --- a/assets/Script/monthlyCard.ts +++ b/assets/Script/monthlyCard.ts @@ -142,6 +142,11 @@ export default class NewClass extends cc.Component { } start() { + const jiazaiNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点 + const jiazaiComp = jiazaiNode.getComponent(JiaZai); + if (jiazaiComp) { + jiazaiComp.getMonthlyCardValidityDays(); + } Utils.getMonthlyCard((data) => { if (data.msg == "不在有效期") { this.monthCardBtn.active = true; @@ -149,6 +154,7 @@ export default class NewClass extends cc.Component { } else { this.monthCardBtn.active = false; this.monthCardBtn2.active = true; + NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true); } }) diff --git a/assets/shop/script/shop.ts b/assets/shop/script/shop.ts index 574c7a6..4af1192 100644 --- a/assets/shop/script/shop.ts +++ b/assets/shop/script/shop.ts @@ -79,6 +79,7 @@ export default class NewClass extends cc.Component { this.stopPowerTime(); this.updatePower(); this.setHealthInfo(true); + this.updateIcon(); } //打开商店界面 openShop() {