将点击余额和点击提示确认按钮的事件分开
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m18s

This commit is contained in:
TJH 2026-06-10 16:43:48 +08:00
parent ac146bba38
commit 7cbc029c07
2 changed files with 16 additions and 3 deletions

View File

@ -542,9 +542,10 @@ export class SlotBar extends Component {
} }
private isGetBalance: boolean = false; private isGetBalance: boolean = false;
async onClickBalance(isConfirm = false): Promise<number | null> { async onClickBalance(): Promise<number | null> {
let delay = isConfirm ? 0 : 1
if (this.isGetBalance) return if (this.isGetBalance) return
let delay = 0.5
this.isGetBalance = true; this.isGetBalance = true;
try { try {
let balacneData = await callGameBalanceApi({ GameId: getGameId() }); let balacneData = await callGameBalanceApi({ GameId: getGameId() });
@ -561,6 +562,18 @@ export class SlotBar extends Component {
} }
} }
async onConfirmErr2(): Promise<number | null> {
try {
let balacneData = await callGameBalanceApi({ GameId: getGameId() });
this.setBalance(balacneData.Balance)
return balacneData.Balance;
} catch (err) {
console.log('获取余额失败')
return null;
} finally {
this.isGetBalance = false;
}
}
setLeftAutoCount(count: number) { setLeftAutoCount(count: number) {
let num = this.getBtnNode(Btn_Key.StopAutoSpinBtn) let num = this.getBtnNode(Btn_Key.StopAutoSpinBtn)

View File

@ -222,7 +222,7 @@ export class SlotScene extends Component {
if (this.slotBar.getBalance() < (buyType == 1 ? this.slotBar.getBet() * this.gameInfo.BuyMul : (this.isDoubleWin ? this.slotBar.getdisplayBet() : this.slotBar.getBet())) && !this.isFreeSpin && !this.spinInfo.Frb.Ongoing) { if (this.slotBar.getBalance() < (buyType == 1 ? this.slotBar.getBet() * this.gameInfo.BuyMul : (this.isDoubleWin ? this.slotBar.getdisplayBet() : this.slotBar.getBet())) && !this.isFreeSpin && !this.spinInfo.Frb.Ongoing) {
//余额不足不经过服务器,在客户端拦截 //余额不足不经过服务器,在客户端拦截
this.showErrorTip(2, "", () => { this.slotBar.onClickBalance(true) }); this.showErrorTip(2, "", () => { this.slotBar.onConfirmErr2() });
this.handleErrSpin(); this.handleErrSpin();
return return
} }