月卡时间显示

This commit is contained in:
computer\尼卡 2025-08-01 10:45:57 +08:00
parent 6874b42304
commit 8d2d21e19c
4 changed files with 14 additions and 3 deletions

View File

@ -197,8 +197,9 @@ 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.rewarded();
// this.getMonthlyCardValidityDays(); this.getMonthlyCardValidityDays();
console.log('月卡剩余天数 (零点刷新):', cc.fx.GameConfig.GM_INFO.monthTime);
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;
@ -480,8 +481,10 @@ export default class JiaZai extends cc.Component {
if (!this.shopNode) { if (!this.shopNode) {
// 第一次使用,创建节点 // 第一次使用,创建节点
this.shopNode = cc.instantiate(JiaZai.cachedShopPrefab); this.shopNode = cc.instantiate(JiaZai.cachedShopPrefab);
this.node.addChild(this.shopNode); this.node.addChild(this.shopNode);
this.shopNode.getComponent("shop").init();
} else { } else {
// 非第一次使用,直接激活节点 // 非第一次使用,直接激活节点
this.shopNode.active = true; this.shopNode.active = true;
@ -913,7 +916,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('月卡剩余天数 (零点刷新):', remainingDays); // console.log('月卡剩余天数 (零点刷新):', cc.fx.GameConfig.GM_INFO.monthTime );
} else { } else {
} }
}); });

View File

@ -361,6 +361,7 @@ export default class SceneManager extends cc.Component {
// 第一次使用,创建节点 // 第一次使用,创建节点
this.shopNode = cc.instantiate(SceneManager.cachedShopPrefab); this.shopNode = cc.instantiate(SceneManager.cachedShopPrefab);
this.node.addChild(this.shopNode); this.node.addChild(this.shopNode);
this.shopNode.getComponent("shop").init();
} else { } else {
// 非第一次使用,直接激活节点 // 非第一次使用,直接激活节点
this.shopNode.active = true; this.shopNode.active = true;

View File

@ -142,6 +142,11 @@ export default class NewClass extends cc.Component {
} }
start() { start() {
const jiazaiNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
const jiazaiComp = jiazaiNode.getComponent(JiaZai);
if (jiazaiComp) {
jiazaiComp.getMonthlyCardValidityDays();
}
Utils.getMonthlyCard((data) => { Utils.getMonthlyCard((data) => {
if (data.msg == "不在有效期") { if (data.msg == "不在有效期") {
this.monthCardBtn.active = true; this.monthCardBtn.active = true;
@ -149,6 +154,7 @@ export default class NewClass extends cc.Component {
} 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);
} }
}) })

View File

@ -79,6 +79,7 @@ export default class NewClass extends cc.Component {
this.stopPowerTime(); this.stopPowerTime();
this.updatePower(); this.updatePower();
this.setHealthInfo(true); this.setHealthInfo(true);
this.updateIcon();
} }
//打开商店界面 //打开商店界面
openShop() { openShop() {