From 09f7990e6d44bce978bec3c4071939e1a0f1f252 Mon Sep 17 00:00:00 2001 From: TJH Date: Wed, 10 Jun 2026 09:55:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=99=E9=A2=9D=E5=88=B7=E6=96=B0=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=82=B9=E5=87=BB=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Game/scripts/SlotBar.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/assets/Game/scripts/SlotBar.ts b/assets/Game/scripts/SlotBar.ts index dd7870d..ba77577 100644 --- a/assets/Game/scripts/SlotBar.ts +++ b/assets/Game/scripts/SlotBar.ts @@ -422,9 +422,23 @@ export class SlotBar extends Component { this.setBet(this.betGrade[this.betIndex]); } - async onClickBalance() { - let balacneData = await callGameBalanceApi({ GameId: getGameId() }); - this.setBalance(balacneData.Balance) + private isGetBalance: boolean = false; + async onClickBalance(): Promise { + if (this.isGetBalance) return + this.isGetBalance = true; + try { + let balacneData = await callGameBalanceApi({ GameId: getGameId() }); + this.setBalance(balacneData.Balance) + return balacneData.Balance; + } catch (err) { + console.log('获取余额失败') + return null; + } finally { + this.scheduleOnce(() => { + this.isGetBalance = false; + }, 1) + + } }