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;