From 8d2d21e19cb2575059a15283490a11f339a7029a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?computer=5C=E5=B0=BC=E5=8D=A1?= <203267346@qq.com> Date: Fri, 1 Aug 2025 10:45:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=88=E5=8D=A1=E6=97=B6=E9=97=B4=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/JiaZai.ts | 9 ++++++--- assets/Script/SceneManager.ts | 1 + assets/Script/monthlyCard.ts | 6 ++++++ assets/shop/script/shop.ts | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) 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() {