余额不足提示逻辑调整
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m16s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m16s
This commit is contained in:
parent
c62d2a1522
commit
ef4560fe8c
@ -441,6 +441,19 @@ 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private currentTipTween: Tween<Node> = null;
|
private currentTipTween: Tween<Node> = null;
|
||||||
private hideTimer: number = null;
|
private hideTimer: number = null;
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { SlotBar } from "./SlotBar";
|
|||||||
import { SlotGame } from "./SlotGame";
|
import { SlotGame } from "./SlotGame";
|
||||||
import { BigWinUI } from "./game/BigWinUI";
|
import { BigWinUI } from "./game/BigWinUI";
|
||||||
import { GameDataManager } from "../../Loading/scripts/manager/GameDataManager";
|
import { GameDataManager } from "../../Loading/scripts/manager/GameDataManager";
|
||||||
import { callGameApi, getFromUrl } from "../../Loading/scripts/comm";
|
import { callGameApi, callGameBalanceApi, getFromUrl, getGameId } from "../../Loading/scripts/comm";
|
||||||
import { TipPanel } from "./game/TipPanel";
|
import { TipPanel } from "./game/TipPanel";
|
||||||
import { I18nManager } from "../../Loading/scripts/manager/I18nManager";
|
import { I18nManager } from "../../Loading/scripts/manager/I18nManager";
|
||||||
import { TotalWin } from "./game/TotalWin";
|
import { TotalWin } from "./game/TotalWin";
|
||||||
@ -88,6 +88,8 @@ export class SlotScene extends Component {
|
|||||||
private lastSpinInfo: any = null;
|
private lastSpinInfo: any = null;
|
||||||
private spinData: any = null;
|
private spinData: any = null;
|
||||||
private isReceiveMsg: boolean = false;
|
private isReceiveMsg: boolean = false;
|
||||||
|
private isErr2: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
private objectId: string[] = [];
|
private objectId: string[] = [];
|
||||||
|
|
||||||
@ -125,6 +127,11 @@ export class SlotScene extends Component {
|
|||||||
// this.FreeSpinEnter.show(8)
|
// this.FreeSpinEnter.show(8)
|
||||||
// this.FreeSpinAdd.show(5)
|
// this.FreeSpinAdd.show(5)
|
||||||
// this.BigWinUI.show(800000, WIN_TYPE.SUPER_MEGA_WIN, 10000)
|
// this.BigWinUI.show(800000, WIN_TYPE.SUPER_MEGA_WIN, 10000)
|
||||||
|
if (!this.gameInfo.CloseBuyGame) {
|
||||||
|
this.slotGame.showFeatureBuy(
|
||||||
|
this.slotBar.getBet() * this.gameInfo.BuyMul > this.gameInfo.MaxBuyBet
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async init() {
|
private async init() {
|
||||||
@ -295,10 +302,16 @@ export class SlotScene extends Component {
|
|||||||
if (!isFreeSpin) {
|
if (!isFreeSpin) {
|
||||||
this.slotBar.setWin(0);
|
this.slotBar.setWin(0);
|
||||||
}
|
}
|
||||||
if (this.slotBar.getBalance() < (isFeatureBuy ? this.slotBar.getBet() * this.gameInfo.BuyMul : this.slotBar.getBet()) && !isFreeSpin && !GameDataManager.instance.frb.Ongoing) {
|
let curBalanceData = await callGameBalanceApi({ GameId: getGameId() })
|
||||||
|
let curBalance = curBalanceData.Balance
|
||||||
|
if (!curBalance) {
|
||||||
|
curBalance = this.slotBar.getBalance()
|
||||||
|
}
|
||||||
|
if (curBalance < (isFeatureBuy ? this.slotBar.getBet() * this.gameInfo.BuyMul : this.slotBar.getBet()) && !isFreeSpin && !GameDataManager.instance.frb.Ongoing) {
|
||||||
//余额不足不经过服务器,在客户端拦截
|
//余额不足不经过服务器,在客户端拦截
|
||||||
this.showErrorTip(2, () => { this.slotBar.onClickBalance() });
|
this.showErrorTip(2, () => { this.slotBar.onConfirmErr2() });
|
||||||
this.handleErrSpin();
|
this.handleErrSpin();
|
||||||
|
this.isErr2 = true;
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -408,7 +421,7 @@ export class SlotScene extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleErrSpin() {
|
private handleErrSpin(isErr2 = false) {
|
||||||
this.spinInfo = this.lastSpinInfo;
|
this.spinInfo = this.lastSpinInfo;
|
||||||
this.spinData = this.spinInfo.Data;
|
this.spinData = this.spinInfo.Data;
|
||||||
this.slotGame.setRollerIconRule(
|
this.slotGame.setRollerIconRule(
|
||||||
@ -417,8 +430,8 @@ export class SlotScene extends Component {
|
|||||||
this.gameState.isAutoSpin = false;
|
this.gameState.isAutoSpin = false;
|
||||||
this.spinData.AllScore = 0;
|
this.spinData.AllScore = 0;
|
||||||
this.slotGame.stopScroll(this.spinData, false, null);
|
this.slotGame.stopScroll(this.spinData, false, null);
|
||||||
this.slotGame.manualStop();
|
// this.slotGame.manualStop();
|
||||||
this.slotBar.setBalance(this.spinInfo.Balance);
|
this.slotBar.setBalance(isErr2 ? this.slotBar.getBalance() : this.spinInfo.Balance);
|
||||||
this.slotBar.closeAutoSpin();
|
this.slotBar.closeAutoSpin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,7 +749,14 @@ export class SlotScene extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async normalStop(isReconnect: boolean = false) {
|
private async normalStop(isReconnect: boolean = false) {
|
||||||
this.slotBar.setBalance(this.spinData.Balance);
|
|
||||||
|
if (this.isErr2) {
|
||||||
|
this.isErr2 = false;
|
||||||
|
this.slotBar.setBalance(this.slotBar.getBalance());
|
||||||
|
} else {
|
||||||
|
this.slotBar.setBalance(this.spinData.Balance);
|
||||||
|
|
||||||
|
}
|
||||||
let winType = this.slotGame.checkWinType(this.spinData.AllScore);
|
let winType = this.slotGame.checkWinType(this.spinData.AllScore);
|
||||||
|
|
||||||
await this.handleWinResult(winType, isReconnect, false, () => {
|
await this.handleWinResult(winType, isReconnect, false, () => {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { PREVIEW } from "cc/env"
|
|||||||
const gameId = "rp_11001";
|
const gameId = "rp_11001";
|
||||||
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
|
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
|
||||||
let apiaddr = "";
|
let apiaddr = "";
|
||||||
let token = "eyJQIjoxMDAwMDEsIkUiOjE3ODExMTY3MjUsIlMiOjEwMDMsIkQiOiJycF8xMTAwMSJ9.RlUvhgdSk7EljKfAHUreLckvUQQ43PGQrtvgeDIk1Bg";
|
let token = "eyJQIjoxMDA5NDksIkUiOjE3ODExODU1MzgsIlMiOjEwMDIsIkQiOiJycF8xMTAwMSJ9.MEuOw7xQRgnH1-0hQFXTspVZbXMEsvPBF2BbUFq3wBg";
|
||||||
|
|
||||||
let language = "en"
|
let language = "en"
|
||||||
let currency = "THB"
|
let currency = "THB"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user