余额不足时在客户端拦截,不经过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 { AutoSpinPanel } from './game/AutoSpinPanel';
|
||||||
import { NodePoolManager } from '../../Loading/scripts/manager/NodePoolManager';
|
import { NodePoolManager } from '../../Loading/scripts/manager/NodePoolManager';
|
||||||
import { webView } from './game/WebView';
|
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 { GameDataManager } from '../../Loading/scripts/manager/GameDataManager';
|
||||||
import { I18nManager } from '../../Loading/scripts/manager/I18nManager';
|
import { I18nManager } from '../../Loading/scripts/manager/I18nManager';
|
||||||
import { LocalizedSprite } from '../../Loading/scripts/i18n/LocalizedSprite';
|
import { LocalizedSprite } from '../../Loading/scripts/i18n/LocalizedSprite';
|
||||||
@ -407,6 +407,12 @@ export class SlotBar extends Component {
|
|||||||
this.setBet(this.betGrade[this.betIndex]);
|
this.setBet(this.betGrade[this.betIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async onClickBalance() {
|
||||||
|
let balacneData = await callGameBalanceApi({ GameId: getGameId() });
|
||||||
|
this.setBalance(balacneData.Balance)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private currentTipTween: Tween<Node> = null;
|
private currentTipTween: Tween<Node> = null;
|
||||||
private hideTimer: number = null;
|
private hideTimer: number = null;
|
||||||
showTipSmall(str: string, openTurbo?: boolean) {
|
showTipSmall(str: string, openTurbo?: boolean) {
|
||||||
@ -612,6 +618,7 @@ export class SlotBar extends Component {
|
|||||||
this.manualStopNode.active = false
|
this.manualStopNode.active = false
|
||||||
this.isAuto = false;
|
this.isAuto = false;
|
||||||
this.setBtnVisible(this.spinBtn, true);
|
this.setBtnVisible(this.spinBtn, true);
|
||||||
|
this.spinAniStop()
|
||||||
this.setBtnVisible(this.stopAutoBtn, false);
|
this.setBtnVisible(this.stopAutoBtn, false);
|
||||||
|
|
||||||
this.setBtnEnable(this.spinBtn, true);
|
this.setBtnEnable(this.spinBtn, true);
|
||||||
|
|||||||
@ -226,19 +226,27 @@ export class SlotScene extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async spinBtnClick(isFreeSpin: boolean = false, isFeatureBuy: boolean = false) {
|
async spinBtnClick(isFreeSpin: boolean = false, isFeatureBuy: boolean = false) {
|
||||||
|
|
||||||
|
this.gameState.isOnReconnect = false;
|
||||||
|
this.isReceiveMsg = false;
|
||||||
|
|
||||||
|
this.isErr = false
|
||||||
|
this.slotGame.spin(this.gameState.isInFreeSpin);
|
||||||
|
this.gameState.isOneRoundEnd = false;
|
||||||
|
this.slotGame.changeBg(this.gameState.isInFreeSpin);
|
||||||
|
this.slotGame.hideIconMsg();
|
||||||
|
|
||||||
|
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 {
|
try {
|
||||||
this.gameState.isOnReconnect = false;
|
|
||||||
this.isReceiveMsg = false;
|
|
||||||
|
|
||||||
this.isErr = false
|
|
||||||
this.slotGame.spin(this.gameState.isInFreeSpin);
|
|
||||||
this.gameState.isOneRoundEnd = false;
|
|
||||||
this.slotGame.changeBg(this.gameState.isInFreeSpin);
|
|
||||||
this.slotGame.hideIconMsg();
|
|
||||||
|
|
||||||
if (!isFreeSpin) {
|
|
||||||
this.slotBar.setWin(0);
|
|
||||||
}
|
|
||||||
// 如果有frb就不会扣除金额
|
// 如果有frb就不会扣除金额
|
||||||
let frb = GameDataManager.instance.frb;
|
let frb = GameDataManager.instance.frb;
|
||||||
if (frb && frb.Ongoing != null) {
|
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.slotGame.setRollerIconRule(this.spinData.Mode == 0 ? ROLLER_RULE : FREE_SPIN_ROLLER_RULE);
|
||||||
this.gameState.isAutoSpin = false;
|
this.gameState.isAutoSpin = false;
|
||||||
this.spinData.AllScore = 0;
|
this.spinData.AllScore = 0;
|
||||||
this.spinData.RoundInfo.AllScore = 0;
|
if (this.spinData.RoundInfo) {
|
||||||
|
this.spinData.RoundInfo.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(this.spinInfo.Balance);
|
||||||
|
this.slotBar.closeAutoSpin();
|
||||||
|
this.slotGame.setFeatureBuyInteractable(true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleSpinResult() {
|
private async handleSpinResult() {
|
||||||
|
|||||||
@ -9,7 +9,7 @@ const qs = new URLSearchParams(location.search)
|
|||||||
|
|
||||||
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
|
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
|
||||||
let apiaddr = "";
|
let apiaddr = "";
|
||||||
let token = "eyJQIjoxMDA5NDksIkUiOjE3NzA2NzA4MTEsIlMiOjk5OCwiRCI6InJwXzEwMDEyIn0.8IGbHU3d63mIZPXD96UTHmDndTb2zf7JYMRpAvH4kGs";
|
let token = "eyJQIjoxMDA5NDksIkUiOjE3ODA5NDY2MzIsIlMiOjk5OCwiRCI6InJwXzEwMDEyIn0.YhnazRKiM4CXHd0oxMS6WDMJYpvpVsijKx-AXZtMCLo";
|
||||||
let language = "en"
|
let language = "en"
|
||||||
let currency = "THB"
|
let currency = "THB"
|
||||||
let isfrom = null
|
let isfrom = null
|
||||||
@ -49,7 +49,7 @@ export function getGameId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function initReqAddr() {
|
export function initReqAddr() {
|
||||||
let partHost = ".rpfafafahkdev.com";
|
let partHost = ".rpenenenhkdev.com";
|
||||||
if (!PREVIEW) {
|
if (!PREVIEW) {
|
||||||
const qs = new URLSearchParams(location.search)
|
const qs = new URLSearchParams(location.search)
|
||||||
|
|
||||||
@ -113,6 +113,29 @@ export async function callGameApi(action: string, argsObj: any) {
|
|||||||
return obj
|
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 {
|
export function gold2cash(v: number): string {
|
||||||
v /= 10000
|
v /= 10000
|
||||||
return v.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
return v.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user