This commit is contained in:
YZ\249929363 2025-08-08 15:31:41 +08:00
commit 753d4c6a9a
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.hp_Max = 5;
cc.fx.GameConfig.GM_INFO.doubleCoin = 1; 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"); //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"); console.log("________________1");
this.getMonthlyCardValidityDays(); this.getMonthlyCardValidityDays();
this.rewarded(); this.rewarded();
console.log('月卡剩余天数 (零点刷新):', cc.fx.GameConfig.GM_INFO.monthTime); this.checkExpiration();
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;
}
})
if (cc.fx.GameConfig.GM_INFO.level >= 16 && JiaZai.cachedMonthlyCardPrefab) { if (cc.fx.GameConfig.GM_INFO.level >= 16 && JiaZai.cachedMonthlyCardPrefab) {
this.monthH(); this.monthH();
}; };
} }
// 打开heath弹窗创建预制体并启动自己的倒计时 // 打开heath弹窗创建预制体并启动自己的倒计时
openHeath() { openHeath() {
let health = cc.instantiate(this.health); 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); 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() { checkShare() {
const otherInfo = cc.fx.StorageMessage.getStorage("otherLevel"); const otherInfo = cc.fx.StorageMessage.getStorage("otherLevel");