From 22f35893d792bc494d0a631a71ff67ad11b12b21 Mon Sep 17 00:00:00 2001 From: panfudan Date: Tue, 19 Aug 2025 08:56:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=20=E6=B6=88=E8=80=97?= =?UTF-8?q?=E7=BB=8F=E9=AA=8C=E5=92=8C=E9=87=91=E5=B8=81,=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=9C=AC=E5=9C=B0=E5=92=8C=E7=BD=91=E7=BB=9C=E5=90=8C?= =?UTF-8?q?=E6=AD=A5,=E5=8F=88=E8=A6=81=E5=87=8F=E5=B0=91=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/script/game/common/SingletonModuleComp.ts | 1 + assets/script/game/map/HInfoComp.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index 741810fe..20d5401a 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -104,6 +104,7 @@ export class SingletonModuleComp extends ecs.Comp { */ private isWxClient(): boolean { // 检查是否存在微信API + return typeof wx !== 'undefined' && typeof (wx as any).getSystemInfoSync === 'function'; } //调试用 diff --git a/assets/script/game/map/HInfoComp.ts b/assets/script/game/map/HInfoComp.ts index ff95ad46..e7fdca88 100644 --- a/assets/script/game/map/HInfoComp.ts +++ b/assets/script/game/map/HInfoComp.ts @@ -62,11 +62,15 @@ export class HInfoComp extends Component { oops.gui.toast("经验或金币不足") return } + smc.spendGameProperty({exp:experience,gold:gold},false) let result=smc.levelUpHero(this.h_uuid,experience,gold) if(!result){ + smc.addGameProperty("exp",experience,false) + smc.addGameProperty("gold",gold,false) oops.gui.toast("网络出错了,升级失败,请重试") return } + this.update_data(this.h_uuid) oops.message.dispatchEvent(GameEvent.UpdateHero, {}) }