From 4d5be00483ba47bafeb0e0d1a26e186d60ddd10b Mon Sep 17 00:00:00 2001 From: "YZ\\249929363" <249929363@qq.com> Date: Fri, 8 Aug 2025 18:49:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9C=88=E5=8D=A1=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/Map.ts | 2 +- assets/Script/SceneManager.ts | 25 +++++++++++++++++-------- assets/Script/setUi.ts | 12 ++++++------ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 1cadaba..8307f4f 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -1698,7 +1698,7 @@ export default class MapConroler extends cc.Component { MiniGameSdk.API.showToast("体力值不足"); setTimeout(() => { this.openShop(); - }, 200); + }, 500); return; } if (!this.againCanTouch) return; diff --git a/assets/Script/SceneManager.ts b/assets/Script/SceneManager.ts index 175acfc..cebcc48 100644 --- a/assets/Script/SceneManager.ts +++ b/assets/Script/SceneManager.ts @@ -72,6 +72,7 @@ export default class SceneManager extends cc.Component { load3: boolean = false; btnName: string = ''; callBack: any; + share_time: boolean = true; // LIFE-CYCLE CALLBACKS: @@ -200,7 +201,7 @@ export default class SceneManager extends cc.Component { } start() { - + this.share_time = true; } startGame() { @@ -376,6 +377,7 @@ export default class SceneManager extends cc.Component { //打开商店 openShop() { + console.log("进入sceneManager openShop"); if (!SceneManager.cachedShopPrefab) { cc.error('Shop prefab is not loaded yet.'); return; @@ -460,14 +462,21 @@ export default class SceneManager extends cc.Component { } shareFriend() { - console.log("设置分享链接"); - let timeStamp = Date.now(); - let otherInfo = { - timeStamp: timeStamp, - otherLevel: (cc.fx.GameConfig.GM_INFO.level + 1), + if (this.share_time) { + this.share_time = false; + console.log("设置分享链接"); + let timeStamp = Date.now(); + let otherInfo = { + timeStamp: timeStamp, + otherLevel: (cc.fx.GameConfig.GM_INFO.level + 1), + } + cc.fx.StorageMessage.setStorage("otherLevel", otherInfo); + MiniGameSdk.API.shareGame(); + setTimeout(() => { + this.share_time = true; + }, 5000); } - cc.fx.StorageMessage.setStorage("otherLevel", otherInfo); - MiniGameSdk.API.shareGame(); + } update(dt) { diff --git a/assets/Script/setUi.ts b/assets/Script/setUi.ts index e166f70..c72e724 100644 --- a/assets/Script/setUi.ts +++ b/assets/Script/setUi.ts @@ -163,12 +163,12 @@ export default class setUi extends cc.Component { this.exit.getChildByName("Health").getChildByName("queding").active = true; } else { - if (customEventData == "hp") { - if (cc.fx.GameConfig.GM_INFO.hp <= 0) { - MiniGameSdk.API.showToast("体力值不足"); - return; - } - } + // if (customEventData == "hp") { + // if (cc.fx.GameConfig.GM_INFO.hp <= 0) { + // MiniGameSdk.API.showToast("体力值不足"); + // return; + // } + // } MapConroler._instance.againLevel(); } }