From 1edb5cd3e510520a74ebd2c9051cb7d75f809852 Mon Sep 17 00:00:00 2001 From: TJH Date: Wed, 10 Jun 2026 09:55:51 +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 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/assets/Game/scripts/SlotBar.ts b/assets/Game/scripts/SlotBar.ts index 152b71f..dbc088b 100644 --- a/assets/Game/scripts/SlotBar.ts +++ b/assets/Game/scripts/SlotBar.ts @@ -407,11 +407,24 @@ 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) + } + } private currentTipTween: Tween = null; private hideTimer: number = null;