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