From 536a1946dba955ed710dfe550753db8b315d8d24 Mon Sep 17 00:00:00 2001 From: TJH Date: Wed, 3 Dec 2025 17:49:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=8D=E8=B4=B9=E8=B5=A0=E9=80=81bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Game/scripts/SlotBar.ts | 6 ++-- assets/Game/scripts/SlotScene.ts | 56 ++++++++++++++++++++++---------- assets/Loading/scripts/comm.ts | 5 +++ 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/assets/Game/scripts/SlotBar.ts b/assets/Game/scripts/SlotBar.ts index 33a0d2a..f19bc35 100644 --- a/assets/Game/scripts/SlotBar.ts +++ b/assets/Game/scripts/SlotBar.ts @@ -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 { getHistoryUrl, getOddsUrl, getSupportUrl, gold2cash } from '../../Loading/scripts/comm'; +import { cash2gold, 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'; @@ -504,7 +504,9 @@ export class SlotBar extends Component { getBet() { if (this.betIndex == -1) { - return +this.betLabel.string * 10000; + let betNum = cash2gold(this.betLabel.string); + let betCount = betNum * 10000; + return betCount; } return this.betGrade[this.betIndex]; } diff --git a/assets/Game/scripts/SlotScene.ts b/assets/Game/scripts/SlotScene.ts index da8ff51..4d4f3ea 100644 --- a/assets/Game/scripts/SlotScene.ts +++ b/assets/Game/scripts/SlotScene.ts @@ -99,6 +99,8 @@ export class SlotScene extends Component { }; batchingTimer: number = 0; + isErr: boolean = false; + async start() { await this.init(); @@ -217,6 +219,7 @@ export class SlotScene extends Component { 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); @@ -256,28 +259,28 @@ export class SlotScene extends Component { this.spinInfo = await callGameApi("spin", msg); if (this.spinInfo.Frb.Ongoing) { + if (!isFreeSpin) { + let count = this.spinInfo.Frb.Ongoing.Frn; + if (count <= 0) { + count = 0; + } + this.SysGift.handleSysInfoFreeCount(count); + } if (this.gameState.isAutoSpin) { this.slotBar.closeAutoSpin(); } } - - GameDataManager.instance.frb = this.spinInfo.Frb; - if (frb) { - let count = 0; - - if (frb.Ongoing != null) { - count = frb.Ongoing.Frn - 1; + if (this.spinInfo.Frb.Finished) { + if (!isFreeSpin) { + let count = this.spinInfo.Frb.Finished.Frn; + if (count <= 0) { + count = 0; + } + this.SysGift.handleSysInfoFreeCount(count); } - if (frb.Finished != null) { - count = frb.Finished.Frn; - - } - if (count <= 0) { - count = 0; - } - this.SysGift.handleSysInfoFreeCount(count); } + GameDataManager.instance.frb = this.spinInfo.Frb; // if (frb?.Ongoing?.Frn - 1 != GameDataManager.instance.frb?.Ongoing?.Frn) { // this.SysGift.handleSysInfoFreeCount(this.spinInfo.Frb.Ongoing.Frn); // } @@ -294,7 +297,7 @@ export class SlotScene extends Component { this.isReceiveMsg = true; await this.handleSpinResult(); } catch (error) { - console.log('获取数据时error', error) + this.isErr = true let errCode = parseInt(error.message.split('#')[0]); if (isNaN(errCode)) { this.showErrorTip(4); @@ -362,6 +365,7 @@ 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; + this.spinData.RoundInfo.AllScore = 0; this.slotGame.stopScroll(this.spinData, false, null); this.slotGame.manualStop(); this.slotBar.setBalance(this.spinInfo.Balance); @@ -527,6 +531,7 @@ export class SlotScene extends Component { async onIconsDeleted() { try { this.isReceiveMsg = false; + this.isErr = false if (!this.gameState.isDebug) { this.spinInfo = await callGameApi("spin", { Bet: this.slotBar.getBet() @@ -554,7 +559,7 @@ export class SlotScene extends Component { this.slotGame.createNewIconTop(this.spinData); } catch (error) { - console.log('消除时error', error) + this.isErr = true let errCode = parseInt(error.message.split('#')[0]); if (isNaN(errCode)) { this.showErrorTip(5, () => { @@ -721,6 +726,23 @@ export class SlotScene extends Component { if (winType != WIN_TYPE.NONE) { if (!isReconnect) { + if (this.isErr) { + this.slotBar.setBalance(this.spinData.Balance); + this.slotGame.showWinScore( + true, + false, + true, + isReconnect, + false, + this.spinData.AllScore + ); + this.slotBar.setWin(this.spinData.AllScore); + this.slotGame.changeBg(false); + this.checkAutoSpin(true, isReconnect); + AudioManager.instance.playBGM("Normal_Mode_BGM"); + return + } + this.TotalWin.show(this.spinData.AllScore, () => { this.slotBar.setBalance(this.spinData.Balance); this.slotGame.showWinScore(true, false, true, isReconnect, false, false, this.spinData.AllScore); diff --git a/assets/Loading/scripts/comm.ts b/assets/Loading/scripts/comm.ts index 132b082..b4688b1 100644 --- a/assets/Loading/scripts/comm.ts +++ b/assets/Loading/scripts/comm.ts @@ -113,6 +113,11 @@ export function gold2cash(v: number): string { return v.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ','); } +// 取消逗号,转换为数字 +export function cash2gold(v: string): number { + v = v.replace(/,/g, ''); + return Number(v); +} export function gold2cash2(v: number): string {