This commit is contained in:
computer\尼卡 2025-08-08 15:29:50 +08:00
parent 2cc681c468
commit d8b9129410
2 changed files with 25 additions and 10 deletions

View File

@ -815,6 +815,9 @@ export default class GameManager extends cc.Component {
cc.fx.GameConfig.GM_INFO.hp_Max = 5;
cc.fx.GameConfig.GM_INFO.doubleCoin = 1;
}
//本地储存当前服务器时间
let dateStr = new Date(data.data.monthCardTime);
cc.fx.StorageMessage.setStorage("mCardDate", dateStr);
//console.log(cc.fx.GameConfig.GM_INFO.hp_Max, "00000000000");
}
//复活购买次数初始化

View File

@ -265,20 +265,13 @@ export default class JiaZai extends cc.Component {
console.log("________________1");
this.getMonthlyCardValidityDays();
this.rewarded();
console.log('月卡剩余天数 (零点刷新):', cc.fx.GameConfig.GM_INFO.monthTime);
Utils.getMonthlyCard((data) => {
if (data.code == 1) {
cc.fx.GameConfig.GM_INFO.hp_Max = 7;
cc.fx.GameConfig.GM_INFO.doubleCoin = 2;
} else {
cc.fx.GameConfig.GM_INFO.hp_Max = 5;
cc.fx.GameConfig.GM_INFO.doubleCoin = 1;
}
})
this.checkExpiration();
if (cc.fx.GameConfig.GM_INFO.level >= 16 && JiaZai.cachedMonthlyCardPrefab) {
this.monthH();
};
}
// 打开heath弹窗创建预制体并启动自己的倒计时
openHeath() {
let health = cc.instantiate(this.health);
@ -1093,6 +1086,25 @@ export default class JiaZai extends cc.Component {
cc.fx.GameTool.shushu_Track("resource_get", dataTemp);
}
//判断过期
checkExpiration() {
let dateStr = cc.fx.StorageMessage.getStorage("mCardDate");
if (dateStr) {
//将字符串转换为时间戳
let dateTime = new Date(dateStr).getTime();
//当前时间转换为时间戳
let currentTime = new Date().getTime();
if (dateTime > currentTime) {
cc.fx.GameConfig.GM_INFO.hp_Max = 7;
cc.fx.GameConfig.GM_INFO.doubleCoin = 2;
} else {
cc.fx.GameConfig.GM_INFO.hp_Max = 5;
cc.fx.GameConfig.GM_INFO.doubleCoin = 1;
}
console.log("月卡过期时间", dateTime, "当前时间", currentTime,);
}
}
//检测当日是否有分享行为,用不用主动获取分享关卡信息
checkShare() {
const otherInfo = cc.fx.StorageMessage.getStorage("otherLevel");