余额不足时在客户端拦截,不经过spin接口
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 46s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 46s
This commit is contained in:
parent
9c5966dd84
commit
0ebfe00e4b
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@ import { SLOT_BAR_EVENT } from './game/Define';
|
||||
import { AutoSpinPanel } from './game/AutoSpinPanel';
|
||||
import { NodePoolManager } from '../../Loading/scripts/manager/NodePoolManager';
|
||||
import { webView } from './game/WebView';
|
||||
import { cash2gold, getHistoryUrl, getOddsUrl, getSupportUrl, gold2cash } from '../../Loading/scripts/comm';
|
||||
import { callGameBalanceApi, cash2gold, getGameId, getHistoryUrl, getOddsUrl, getSupportUrl, gold2cash } from '../../Loading/scripts/comm';
|
||||
import { GameDataManager } from '../../Loading/scripts/manager/GameDataManager';
|
||||
import { I18nManager } from '../../Loading/scripts/manager/I18nManager';
|
||||
import { LocalizedSprite } from '../../Loading/scripts/i18n/LocalizedSprite';
|
||||
@ -407,6 +407,12 @@ export class SlotBar extends Component {
|
||||
this.setBet(this.betGrade[this.betIndex]);
|
||||
}
|
||||
|
||||
async onClickBalance() {
|
||||
let balacneData = await callGameBalanceApi({ GameId: getGameId() });
|
||||
this.setBalance(balacneData.Balance)
|
||||
}
|
||||
|
||||
|
||||
private currentTipTween: Tween<Node> = null;
|
||||
private hideTimer: number = null;
|
||||
showTipSmall(str: string, openTurbo?: boolean) {
|
||||
@ -612,6 +618,7 @@ export class SlotBar extends Component {
|
||||
this.manualStopNode.active = false
|
||||
this.isAuto = false;
|
||||
this.setBtnVisible(this.spinBtn, true);
|
||||
this.spinAniStop()
|
||||
this.setBtnVisible(this.stopAutoBtn, false);
|
||||
|
||||
this.setBtnEnable(this.spinBtn, true);
|
||||
|
||||
@ -226,7 +226,7 @@ export class SlotScene extends Component {
|
||||
}
|
||||
|
||||
async spinBtnClick(isFreeSpin: boolean = false, isFeatureBuy: boolean = false) {
|
||||
try {
|
||||
|
||||
this.gameState.isOnReconnect = false;
|
||||
this.isReceiveMsg = false;
|
||||
|
||||
@ -239,6 +239,14 @@ export class SlotScene extends Component {
|
||||
if (!isFreeSpin) {
|
||||
this.slotBar.setWin(0);
|
||||
}
|
||||
|
||||
if (this.slotBar.getBalance() < (isFeatureBuy ? this.slotBar.getBet() * this.gameInfo.BuyMul : this.slotBar.getBet()) && !isFreeSpin && !GameDataManager.instance.frb.Ongoing) {
|
||||
//余额不足不经过服务器,在客户端拦截
|
||||
this.showErrorTip(2, "");
|
||||
this.handleErrSpin();
|
||||
return
|
||||
}
|
||||
try {
|
||||
// 如果有frb就不会扣除金额
|
||||
let frb = GameDataManager.instance.frb;
|
||||
if (frb && frb.Ongoing != null) {
|
||||
@ -376,10 +384,15 @@ export class SlotScene extends Component {
|
||||
this.slotGame.setRollerIconRule(this.spinData.Mode == 0 ? ROLLER_RULE : FREE_SPIN_ROLLER_RULE);
|
||||
this.gameState.isAutoSpin = false;
|
||||
this.spinData.AllScore = 0;
|
||||
if (this.spinData.RoundInfo) {
|
||||
this.spinData.RoundInfo.AllScore = 0;
|
||||
}
|
||||
this.slotGame.stopScroll(this.spinData, false, null);
|
||||
this.slotGame.manualStop();
|
||||
this.slotBar.setBalance(this.spinInfo.Balance);
|
||||
this.slotBar.closeAutoSpin();
|
||||
this.slotGame.setFeatureBuyInteractable(true)
|
||||
|
||||
}
|
||||
|
||||
private async handleSpinResult() {
|
||||
|
||||
@ -9,7 +9,7 @@ const qs = new URLSearchParams(location.search)
|
||||
|
||||
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
|
||||
let apiaddr = "";
|
||||
let token = "eyJQIjoxMDA5NDksIkUiOjE3NzA2NzA4MTEsIlMiOjk5OCwiRCI6InJwXzEwMDEyIn0.8IGbHU3d63mIZPXD96UTHmDndTb2zf7JYMRpAvH4kGs";
|
||||
let token = "eyJQIjoxMDA5NDksIkUiOjE3ODA5NDY2MzIsIlMiOjk5OCwiRCI6InJwXzEwMDEyIn0.YhnazRKiM4CXHd0oxMS6WDMJYpvpVsijKx-AXZtMCLo";
|
||||
let language = "en"
|
||||
let currency = "THB"
|
||||
let isfrom = null
|
||||
@ -49,7 +49,7 @@ export function getGameId() {
|
||||
}
|
||||
|
||||
export function initReqAddr() {
|
||||
let partHost = ".rpfafafahkdev.com";
|
||||
let partHost = ".rpenenenhkdev.com";
|
||||
if (!PREVIEW) {
|
||||
const qs = new URLSearchParams(location.search)
|
||||
|
||||
@ -113,6 +113,29 @@ export async function callGameApi(action: string, argsObj: any) {
|
||||
return obj
|
||||
}
|
||||
|
||||
export async function callGameBalanceApi(argsObj: any) {
|
||||
const url = apiaddr + path.join("/gameapi/getPlayerBalance")
|
||||
const payload = JSON.stringify(argsObj)
|
||||
|
||||
const res = await fetch(url, {
|
||||
signal: AbortSignal.timeout(10000),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Rp-Token": token,
|
||||
},
|
||||
method: "POST",
|
||||
body: payload,
|
||||
mode: 'cors',
|
||||
})
|
||||
|
||||
if (res.status != 200) {
|
||||
const errstr = await res.text()
|
||||
throw new Error(errstr || res.statusText)
|
||||
}
|
||||
const obj = await res.json()
|
||||
return obj
|
||||
}
|
||||
|
||||
export function gold2cash(v: number): string {
|
||||
v /= 10000
|
||||
return v.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user