From 6f2571068d3ff46ff9a4e88c897652d7718037f1 Mon Sep 17 00:00:00 2001 From: "YZ\\249929363" <249929363@qq.com> Date: Fri, 1 Aug 2025 15:43:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/GameManager.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/assets/Script/GameManager.ts b/assets/Script/GameManager.ts index 0e56953..8eef396 100644 --- a/assets/Script/GameManager.ts +++ b/assets/Script/GameManager.ts @@ -258,6 +258,7 @@ export default class GameManager extends cc.Component { } if (data.data.shareLvl) { if (data.data.shareLvl.length > 0) { + console.log("设置分享等级", data.data.shareLvl); cc.fx.GameConfig.GM_INFO.helpLevel = data.data.shareLvl; } } @@ -362,8 +363,12 @@ export default class GameManager extends cc.Component { // console.log("没有等级信息,从用户接口拿到数据"); if (levelInfo.level) { cc.fx.GameConfig.GM_INFO.level = levelInfo.level; + if (cc.fx.GameConfig.GM_INFO.helpLevel == (cc.fx.GameConfig.GM_INFO.level + 1)) { + cc.fx.GameConfig.GM_INFO.level += 1; + } } this.load4 = true; + cc.fx.StorageMessage.setStorage("level", cc.fx.GameConfig.GM_INFO.level); console.log("关卡等级成功时间耗时:", Date.now() - this.nowTime); cc.fx.GameTool.setUserLevel((data) => { }); @@ -373,10 +378,14 @@ export default class GameManager extends cc.Component { //游戏前端存储 新于服务器端,以游戏前端信息为主,放服务器存储 let temp = data.result.timestamp - levelInfo.timestamp; console.log("等级时间差:", temp); - if ((data.result.timestamp - levelInfo.timestamp) < 10000) { + if ((data.result.timestamp - levelInfo.timestamp) < 10000 && levelInfo.level >= data.result.data) { if (levelInfo.level) { console.log("以游戏前端等级为准", data.result.data); cc.fx.GameConfig.GM_INFO.level = levelInfo.level; + if (cc.fx.GameConfig.GM_INFO.helpLevel == (cc.fx.GameConfig.GM_INFO.level + 1)) { + cc.fx.GameConfig.GM_INFO.level += 1; + } + cc.fx.StorageMessage.setStorage("level", cc.fx.GameConfig.GM_INFO.level); // console.log("等级为:",cc.fx.GameConfig.GM_INFO.level); cc.fx.GameTool.setUserLevel((data) => { }); @@ -566,7 +575,6 @@ export default class GameManager extends cc.Component { cc.fx.GameConfig.GM_INFO.magicAmount = 3; cc.fx.StorageMessage.setStorage("prop", propInfo); - cc.fx.GameTool.setUserInfo((data) => { if (data.result.code == 200) { console.log("上传用户信息成功", data); @@ -813,6 +821,9 @@ export default class GameManager extends cc.Component { else if (data.result.code == 200) { console.log("有等级信息,从关卡接口拿到数据", data.result.data); cc.fx.GameConfig.GM_INFO.level = data.result.data; + if (cc.fx.GameConfig.GM_INFO.helpLevel == (cc.fx.GameConfig.GM_INFO.level + 1)) { + cc.fx.GameConfig.GM_INFO.level += 1; + } let levelInfo = { "level": cc.fx.GameConfig.GM_INFO.level, "timestamp": timestamp }; // console.log("444444存储关卡信息:",levelInfo); cc.fx.StorageMessage.setStorage("level", levelInfo);