This commit is contained in:
parent
8e10b0f95e
commit
65c9f1f8a5
@ -754,26 +754,27 @@ export class SlotBar extends Component {
|
||||
this.betIndex = 0;
|
||||
this.setBet(this.betGrade[this.betIndex]);
|
||||
}
|
||||
private _refreshingBalance: boolean = false;
|
||||
// private _refreshingBalance: boolean = false;
|
||||
async refreshBalanceFromServer(): Promise<number | null> {
|
||||
if (this._refreshingBalance) return this.getBalance();
|
||||
this._refreshingBalance = true;
|
||||
// if (this._refreshingBalance) return this.getBalance();
|
||||
// this._refreshingBalance = true;
|
||||
try {
|
||||
const res = await callGameBalanceApi({});
|
||||
const balance = Number(res.Balance);
|
||||
if (!Number.isFinite(balance)) {
|
||||
console.warn("[SlotBar] invalid balance response:", res);
|
||||
return null;
|
||||
return this.getBalance();
|
||||
}
|
||||
this.setBalance(balance);
|
||||
return balance;
|
||||
} catch (err) {
|
||||
console.error("[SlotBar] refresh balance failed:", err);
|
||||
return null;
|
||||
return this.getBalance();
|
||||
} finally {
|
||||
this.scheduleOnce(() => {
|
||||
this._refreshingBalance = false;
|
||||
}, 1)
|
||||
// this.scheduleOnce(() => {
|
||||
// console.log('还原')
|
||||
// this._refreshingBalance = false;
|
||||
// }, 0.2)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user