rp_10012/assets/Game/scripts/SlotScene.ts
2025-07-23 14:21:38 +08:00

801 lines
28 KiB
TypeScript

import { _decorator, Component, Prefab } from 'cc';
import { FREE_SPIN_ROLLER_RULE, GameInfo, ROLLER_RULE, SLOT_BAR_EVENT, SLOT_GAME_EVENT, SYS_GIFT, WIN_TYPE, winTestData } from './game/Define';
import { SlotBar } from './SlotBar';
import { SlotGame } from './SlotGame';
import { BigWinUI } from './game/BigWinUI';
import { GameDataManager } from '../../Loading/scripts/manager/GameDataManager';
import { callGameApi } from '../../Loading/scripts/comm';
import { TipPanel } from './game/TipPanel';
import { I18nManager } from '../../Loading/scripts/manager/I18nManager';
import { TotalWin } from './game/TotalWin';
import { AudioManager } from '../../Loading/scripts/manager/AudioManager';
import { NodePoolManager } from '../../Loading/scripts/manager/NodePoolManager';
import { FeatureBuy } from './game/FeatureBuy';
import { FreeSpinEnter } from './game/FreeSpinEnter';
import { FreeSpinAdd } from './game/FreeSpinAdd';
import { SysGift } from './game/SysGift';
let { ccclass, property } = _decorator;
// 游戏状态接口
interface GameState {
isAutoSpin: boolean;
isEliminating: boolean;
isFastSpin: boolean;
isFirstFreeSpin: boolean;
isInFreeSpin: boolean;
isDebug: boolean;
}
// 自动旋转配置接口
interface AutoSpinConfig {
count: number;
delay: {
fast: number;
normal: number;
}
}
@ccclass('SlotScene')
export class SlotScene extends Component {
// 组件引用
@property(SlotGame)
private slotGame: SlotGame = null;
@property(SlotBar)
private slotBar: SlotBar = null;
@property(BigWinUI)
private BigWinUI: BigWinUI = null;
@property(TotalWin)
private TotalWin: TotalWin = null;
@property(TipPanel)
private TipPanel: TipPanel = null;
@property(Prefab)
private FeatureBuyPre: Prefab = null;
@property(FreeSpinEnter)
private FreeSpinEnter: FreeSpinEnter = null;
@property(FreeSpinAdd)
private FreeSpinAdd: FreeSpinAdd = null;
@property(SysGift)
private SysGift: SysGift = null;
// 游戏数据
private gameInfo: GameInfo = null;
private spinInfo: any = null;
private lastSpinInfo: any = null;
private spinData: any = null;
private isReceiveMsg: boolean = false;
private objectId: string[] = [];
// 游戏状态管理
private gameState: GameState = {
isAutoSpin: false,
isEliminating: false,
isFastSpin: false,
isFirstFreeSpin: false,
isInFreeSpin: false,
isDebug: false
};
// 自动旋转配置
private autoSpinConfig: AutoSpinConfig = {
count: 0,
delay: {
fast: 0.5,
normal: 1
}
};
batchingTimer: number = 0;
async start() {
await this.init();
}
private async init() {
try {
// 初始化游戏数据
this.gameInfo = GameDataManager.instance.gameInfo;
this.lastSpinInfo = this.gameInfo;
this.spinData = this.gameInfo.Data;
this.slotGame.showFeatureBuy(this.gameInfo.CloseBuyGame);
// 注册事件监听
this.slotBar.node.on(SLOT_BAR_EVENT.ON_SPIN_CLICK, this.spinBtnClick, this);
// this.slotBar.node.on(SLOT_BAR_EVENT.ON_TEST_SPIN_CLICK, this.spinBtnClick2, this);
this.slotBar.node.on(SLOT_BAR_EVENT.BET_CHANGE, this.onBetChanged, this);
this.slotBar.node.on(SLOT_BAR_EVENT.ON_MANUAL_STOP, this.manualStop, this);
this.slotBar.node.on(SLOT_BAR_EVENT.FAST_SPIN, this.onFastSpin, this);
this.slotBar.node.on(SLOT_BAR_EVENT.ON_AUTO_SPIN_CLICK, this.onAutoSpinClick, this);
this.slotBar.node.on(SLOT_BAR_EVENT.ON_EXIT_CLICK, this.onExitClick, this);
this.slotGame.node.on(SLOT_GAME_EVENT.ALL_ROLLER_STOP, this.allRollerStop, this);
this.slotGame.node.on(SLOT_GAME_EVENT.ALL_ROLLER_ICONS_DELETED, this.onIconsDeleted, this);
this.slotGame.node.on(SLOT_GAME_EVENT.ALL_ROLLER_ICONS_CREATED, this.onIconsCreated, this);
this.slotGame.node.on(SLOT_GAME_EVENT.ALL_ROLLER_ICONS_FALLEN, this.onIconsFallen, this);
this.SysGift.node.on(SYS_GIFT.CLICK_CONTINUE, this.onSysGiftClickContinue, this);
this.SysGift.node.on(SYS_GIFT.SETTLE_CONTINUE, this.onSysGiftSettleContinue, this);
// 初始化SlotBar
this.slotBar.setGameInfo(this.gameInfo);
// 初始化slot
this.slotGame.initRollerWithIcon(this.gameInfo);
// 处理断线重连
this.handleReconnect();
} catch (error) {
console.error('Game initialization failed:', error);
}
}
// 处理断线重连
private async handleReconnect() {
this.slotGame.showWinScore(false, false, false, false, false);
// 设置滚轮规则
let mode = this.gameInfo.Data.Mode;
let rollerIconRule = mode == 0 ? ROLLER_RULE : FREE_SPIN_ROLLER_RULE;
this.checkHasGame();
if (this.gameState.isInFreeSpin) {
this.slotBar.enterFreeSpin(this.spinData.FreeSpin.LeftCount);
}
this.slotBar.reconnectState(true);
this.slotGame.changeBg(this.gameState.isInFreeSpin);
if (this.gameState.isInFreeSpin) {
AudioManager.instance.playBGM('Free_Mode_BGM');
} else {
AudioManager.instance.playBGM('Normal_Mode_BGM');
}
this.slotGame.setWaysCount(this.spinData.WaysNum);
this.slotGame.setMultiLabel(this.spinData.WinMultiPlier);
this.slotGame.setRollerIconRule(rollerIconRule);
// 当前盘面有分数,有消除,则播放消除动画
if (this.spinData.Score != 0 && this.spinData.WinPosition != null) {
this.slotGame.deleteIconNode();
this.playElemWinAnimation();
} else {
this.gameState.isInFreeSpin ? this.freeSpinStop(true) : this.normalStop(true);
}
}
clickFeatureBuy() {
if (this.gameState.isInFreeSpin) return;
if (this.gameState.isEliminating) return;
if (this.slotGame.isScroll()) return;
AudioManager.instance.playSFX('Feature_Buy_Sound');
let panel = NodePoolManager.instance.getNodeFromPoolStatic('FeatureBuy', this.FeatureBuyPre);
let featureBuy = panel.getComponent(FeatureBuy)
this.node.addChild(panel);
featureBuy.show(this.slotBar.getBet(), this.gameInfo.BuyMul, () => {
this.spinBtnClick(false, true);
this.slotBar.featureBuySpin();
});
}
async spinBtnClick(isFreeSpin: boolean = false, isFeatureBuy: boolean = false) {
try {
this.isReceiveMsg = false;
this.slotGame.spin(this.gameState.isInFreeSpin);
this.slotGame.changeBg(this.gameState.isInFreeSpin);
this.slotGame.hideIconMsg();
let frb = GameDataManager.instance.frb;
if (frb && (frb.Ongoing != null || frb.Finished != null)) {
} else {
if (!isFreeSpin) {
this.slotBar.setWin(0);
if (!isFeatureBuy) {
this.slotBar.setBalance(this.slotBar.getBalance() - this.slotBar.getBet());
} else {
this.slotBar.setBalance(this.slotBar.getBalance() - (this.slotBar.getBet() * this.gameInfo.BuyMul));
}
}
}
let msg = {}
if (!isFeatureBuy) {
msg = {
Bet: this.slotBar.getBet()
}
} else {
msg = {
Bet: this.slotBar.getBet(),
IsBuy: true
}
}
if (!this.gameState.isDebug) {
this.spinInfo = await callGameApi("spin", msg);
GameDataManager.instance.frb = this.spinInfo.Frb;
} else {
this.spinInfo = winTestData;
}
if (this.TipPanel.getHasTip()) {
this.TipPanel.closeTip();
}
this.lastSpinInfo = this.spinInfo;
this.isReceiveMsg = true;
await this.handleSpinResult();
} catch (error) {
let errCode = parseInt(error.message.split('#')[0]);
if (isNaN(errCode)) {
this.showErrorTip(4);
} else {
this.showErrorTip(errCode);
}
this.handleErrSpin();
}
}
// 万分比
private onBetChanged(bet: number) {
if (!this.gameInfo.CloseBuyGame) {
this.slotGame.showFeatureBuy(bet * this.gameInfo.BuyMul > this.gameInfo.MaxBuyBet);
}
}
manualStop() {
// 没有收到消息不能手动停止
if (!this.isReceiveMsg) return;
// 免费游戏不能手动停止
if (this.gameState.isInFreeSpin) {
return;
}
// 滚轮没有开始旋转的时候不能停止
if (!this.slotGame.isScroll()) return;
this.slotBar.manualStop();
this.slotGame.manualStop();
}
private handleErrSpin() {
this.spinInfo = this.lastSpinInfo;
this.spinData = this.spinInfo.Data;
this.slotGame.setRollerIconRule(this.spinData.Mode == 0 ? ROLLER_RULE : FREE_SPIN_ROLLER_RULE);
this.gameState.isAutoSpin = false;
this.spinData.AllScore = 0;
this.slotGame.stopScroll(this.spinData, false, null);
this.slotGame.manualStop();
this.slotBar.setBalance(this.spinInfo.Balance);
}
private async handleSpinResult() {
this.spinData = this.spinInfo.Data;
this.slotGame.stopScroll(this.spinData, false, null, null)
}
private onFastSpin(isFastSpin: boolean) {
this.gameState.isFastSpin = isFastSpin;
let tip = this.gameState.isFastSpin ?
I18nManager.instance.t('Turbo Spin Enabled') :
I18nManager.instance.t('Turbo Spin Disabled');
this.slotBar.showTipSmall(tip);
if (!this.slotGame.isScroll()) {
this.slotGame.setFastSpin(isFastSpin);
}
}
private onAutoSpinClick(isAuto: boolean) {
this.gameState.isAutoSpin = isAuto;
this.autoSpinConfig.count = GameDataManager.instance.autoCount;
// 只有在不旋转的时候才可以设置自动旋转,所以不需要额外处理
if (isAuto) {
this.checkAutoSpin();
}
}
private checkAutoSpin(hasWin: boolean = false) {
// 处理自动旋转
let handleAutoSpin = () => {
if (this.autoSpinConfig.count > 0) {
this.autoSpinConfig.count--;
this.slotBar.setLeftAutoCount(this.autoSpinConfig.count);
this.spinBtnClick();
if (this.autoSpinConfig.count === 0) {
this.slotBar.closeAutoSpin();
}
}
}
// 处理自动旋转已经走到最后一步了和当前一轮流程走完最后的逻辑
let handleNonAutoSpin = (hasWin: boolean) => {
let delay = hasWin ? 1 : 0;
this.scheduleOnce(() => {
this.slotBar.resetAllState();
let frb = GameDataManager.instance.frb;
if (frb && (frb.Finished || frb.Ongoing)) {
this.slotBar.systemGiftContinue();
this.SysGift.handleSpinInfo();
}
}, delay);
this.autoSpinConfig.count = 0;
}
// 进入freeSpin不检测
if (this.gameState.isFirstFreeSpin) return;
// 是否是快速旋转
let delay = this.gameState.isFastSpin ?
this.autoSpinConfig.delay.fast :
this.autoSpinConfig.delay.normal;
if (this.gameState.isAutoSpin && this.autoSpinConfig.count > 0) {
this.scheduleOnce(() => {
handleAutoSpin();
}, delay);
} else {
handleNonAutoSpin(hasWin);
}
}
allRollerStop() {
this.slotGame.setFastSpin(this.gameState.isFastSpin);
this.checkHasGame();
// this.TotalWin.show(35, () => {
// this.slotBar.resetAllState();
// });
// return;
if (this.checkHasEliminate()) {
this.slotGame.deleteIconNode();
this.playElemWinAnimation(true);
} else {
if (this.gameState.isInFreeSpin) {
if (this.gameState.isFirstFreeSpin) {
// 第一次进入免费旋转需要切换背景和展示免费次数
let isExpect = this.slotGame.rollerManager.checkNextRollerExpect(6, 4);
if (isExpect) {
this.slotGame.playScatterAni(() => {
this.FreeSpinEnter.show(this.spinInfo.Data.FreeSpin.MaxCount, () => {
AudioManager.instance.playBGM('Free_Mode_BGM');
this.slotGame.changeBg(true);
this.slotBar.enterFreeSpin(this.spinInfo.Data.FreeSpin.LeftCount);
this.scheduleOnce(() => {
this.freeSpinStop();
}, 1)
})
})
}
} else {
if (this.checkHasMoreScatter()) {
let isExpect = this.slotGame.rollerManager.checkNextRollerExpect(6, 4);
if (isExpect) {
this.slotGame.playScatterAni(() => {
this.FreeSpinAdd.show(this.spinInfo.Data.GetGamesTimes, () => {
this.slotBar.showLeftCount(this.spinInfo.Data.FreeSpin.LeftCount);
this.scheduleOnce(() => {
this.freeSpinStop();
}, 1)
})
})
}
} else {
this.freeSpinStop();
}
}
} else {
this.normalStop();
}
}
}
private deletedRetryCount: number = 0;
async onIconsDeleted() {
try {
this.isReceiveMsg = false;
if (!this.gameState.isDebug) {
this.spinInfo = await callGameApi("spin", {
Bet: this.slotBar.getBet()
});
GameDataManager.instance.frb = this.spinInfo.Frb;
} else {
this.spinInfo = {};
}
this.lastSpinInfo = this.spinInfo;
this.isReceiveMsg = true;
// 处理数据
this.spinData = this.spinInfo.Data;
// 改变图标框和图标
this.slotGame.changeIconAndFrameType(this.spinData);
if (this.gameState.isInFreeSpin) {
this.slotGame.playFreeMultiAni();
} else {
this.slotGame.playNormalMultiAni(true);
}
this.slotGame.setMultiLabel(this.spinData.WinMultiPlier);
// 创建新图标
this.slotGame.createNewIconTop(this.spinData);
} catch (error) {
let errCode = parseInt(error.message.split('#')[0]);
if (isNaN(errCode)) {
this.showErrorTip(5, () => {
this.deletedRetryCount++;
if (this.deletedRetryCount < 5) {
this.scheduleOnce(() => {
this.onIconsDeleted();
}, 0.5)
} else {
location.reload();
}
});
} else {
this.showErrorTip(errCode);
}
}
}
onIconsCreated() {
this.slotGame.iconFallDown();
}
onIconsFallen() {
this.checkHasGame();
if (this.checkHasEliminate()) {
this.slotGame.deleteIconNode();
this.playElemWinAnimation();
} else {
if (this.gameState.isInFreeSpin) {
if (this.gameState.isFirstFreeSpin) {
// 检测所有scatter
let isExpect = this.slotGame.rollerManager.checkNextRollerExpect(6, 4);
if (isExpect) {
this.slotGame.playScatterAni(() => {
// 第一次进入免费旋转需要切换背景和展示免费次数
this.FreeSpinEnter.show(this.spinInfo.Data.FreeSpin.MaxCount, () => {
this.slotGame.changeBg(true);
this.slotBar.enterFreeSpin(this.spinInfo.Data.FreeSpin.LeftCount);
this.scheduleOnce(() => {
this.freeSpinStop();
}, 1)
})
})
}
} else {
if (this.checkHasMoreScatter()) {
let isExpect = this.slotGame.rollerManager.checkNextRollerExpect(6, 4);
if (isExpect) {
this.slotGame.rollerManager.checkNextRollerExpect(6, 4);
this.slotGame.playScatterAni(() => {
this.FreeSpinAdd.show(this.spinInfo.Data.GetGamesTimes, () => {
this.slotBar.showLeftCount(this.spinInfo.Data.FreeSpin.LeftCount);
this.scheduleOnce(() => {
this.freeSpinStop();
}, 1)
})
})
}
} else {
this.freeSpinStop();
}
}
} else {
this.normalStop();
}
}
}
playElemWinAnimation(isFirstWin: boolean = false) {
this.slotGame.showWinScore(true, isFirstWin, false, false, false, this.spinData.Score);
this.slotBar.setWin(this.spinData.AllScore);
}
checkHasGame() {
let freeSpinData = this.spinData.FreeSpin;
this.gameState.isInFreeSpin = freeSpinData != null;
if (this.gameState.isInFreeSpin) {
if (freeSpinData.LeftCount == freeSpinData.MaxCount) {
this.gameState.isFirstFreeSpin = true;
} else {
this.gameState.isFirstFreeSpin = false;
}
}
}
checkHasEliminate() {
this.gameState.isEliminating = this.spinData.WinPosition != null; // 重置消除状态
this.slotGame.setIsEliminating(this.gameState.isEliminating); // 传递给 SlotGame
return this.spinData.WinPosition != null;
}
checkHasMoreScatter() {
return this.spinData.GetGamesTimes > 0;
}
private async normalStop(isReconnect: boolean = false) {
this.slotBar.setBalance(this.spinData.Balance);
let winType = this.slotGame.checkWinType(this.spinData.AllScore);
await this.handleWinResult(winType, isReconnect, false, () => {
this.checkAutoSpin(winType !== WIN_TYPE.NONE);
});
}
private async freeSpinStop(isReconnect: boolean = false) {
let leftCount = this.spinData.FreeSpin.LeftCount;
if (leftCount >= 1) {
let score = 0;
if (this.spinData.RoundInfo != null) {
score = this.spinData.RoundInfo.AllScore;
}
let winType = this.slotGame.checkWinType(score);
await this.handleOngoingFreeSpin(leftCount, winType);
} else {
if (isReconnect) {
let allScoreWinType = this.slotGame.checkWinType(this.spinData.AllScore);
this.handleFreeSpinEnd(allScoreWinType, isReconnect);
} else {
let score = 0;
let time = 1;
if (this.spinData.RoundInfo != null) {
score = this.spinData.RoundInfo.AllScore;
time = 3;
}
let winType = this.slotGame.checkWinType(score);
this.handleWinResult(winType, false, true, () => {
setTimeout(() => {
let allScoreWinType = this.slotGame.checkWinType(this.spinData.AllScore);
this.handleFreeSpinEnd(allScoreWinType, isReconnect);
}, time * 1000); // 转换为毫秒
})
}
}
}
private handleNextFreeSpin(leftCount: number) {
this.scheduleOnce(() => {
this.slotBar.showLeftCount(leftCount - 1);
this.spinBtnClick(true, false);
}, 1);
}
private async handleOngoingFreeSpin(leftCount: number, winType: WIN_TYPE) {
this.handleWinResult(winType, false, true, () => {
this.handleNextFreeSpin(leftCount);
})
}
private async handleFreeSpinEnd(winType: WIN_TYPE, isReconnect: boolean = false) {
this.gameState.isFirstFreeSpin = false;
this.gameState.isInFreeSpin = false;
this.slotBar.exitFreeSpin();
if (winType != WIN_TYPE.NONE) {
if (!isReconnect) {
this.TotalWin.show(this.spinData.AllScore, () => {
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);
AudioManager.instance.playBGM('Normal_Mode_BGM');
});
} else {
this.slotGame.showWinScore(true, false, true, isReconnect, false, this.spinData.AllScore);
this.slotBar.setWin(this.spinData.AllScore);
this.slotBar.setBalance(this.spinData.Balance);
this.slotGame.changeBg(false);
this.checkAutoSpin(true);
AudioManager.instance.playBGM('Normal_Mode_BGM');
}
} else {
this.checkAutoSpin(true);
this.slotGame.changeBg(false);
}
}
private async handleWinResult(winType: WIN_TYPE, isReconnect, isFreeSpin: boolean, callback: Function) {
if (isReconnect) {
callback?.();
return;
}
// 1
if (this.spinData.HitBlock &&
this.spinData.HitBlock.length < 5 &&
this.spinData.AllScore === 0) {
callback?.();
return;
}
// 2
if (winType === WIN_TYPE.NONE) {
callback?.();
return;
}
// 3,4,5
this.scheduleOnce(() => {
let score = isFreeSpin ? this.spinData.RoundInfo.AllScore : this.spinData.AllScore;
if (winType >= WIN_TYPE.BIG_WIN) {
this.BigWinUI.setCloseCallBack(() => {
this.slotGame.showWinScore(true, false, true, false, false, score);
this.slotBar.setWin(this.spinData.AllScore);
callback?.();
});
this.BigWinUI.show(score, winType, this.slotBar.getBet());
} else {
this.slotGame.showWinScore(true, false, false, false, true, score);
this.slotBar.setWin(this.spinData.AllScore);
callback?.();
}
}, 0.5)
}
// 错误码提示
private showErrorTip(errorCode: number, callback?) {
let title = I18nManager.instance.t('AID_TIP_TRANSACTION_FAILED');
let msg1 = '';
let msg2 = '';
let tip = '';
switch (errorCode) {
case 1:
msg1 = I18nManager.instance.t('AID_TIP_CONTENT_1');
msg2 = I18nManager.instance.t('AID_ERROR_CODE_1');
tip = `${msg1}\n${msg2}`;
if (!this.TipPanel.getHasTip()) {
this.TipPanel.showTip(title, tip, () => { window.close() }, null, I18nManager.instance.t('AID_QUIT'), null, false);
}
break;
case 2:
msg1 = I18nManager.instance.t('AID_TIP_CONTENT_2');
msg2 = I18nManager.instance.t('AID_ERROR_CODE_2');
tip = `${msg1}\n${msg2}`;
if (!this.TipPanel.getHasTip()) {
this.TipPanel.showTip(title, tip, null, null, I18nManager.instance.t('AID_OK'), null, false);
}
break;
case 3:
msg1 = I18nManager.instance.t('AID_TIP_CONTENT_3');
msg2 = I18nManager.instance.t('AID_ERROR_CODE_3');
tip = `${msg1}\n${msg2}`;
if (!this.TipPanel.getHasTip()) {
this.TipPanel.showTip(title, tip, null, null, I18nManager.instance.t('AID_OK'), null, false);
}
break;
case 4:
msg1 = I18nManager.instance.t('AID_TIP_CONTENT_4');
msg2 = I18nManager.instance.t('AID_ERROR_CODE_4');
tip = `${msg1}\n${msg2}`;
if (!this.TipPanel.getHasTip()) {
this.TipPanel.showTip(title, tip, null, () => { window.close() }, I18nManager.instance.t('AID_OK'), I18nManager.instance.t('AID_QUIT'), true);
}
break;
case 5:
msg1 = I18nManager.instance.t('AID_TIP_CONTENT_4');
msg2 = I18nManager.instance.t('AID_ERROR_CODE_4');
tip = `${msg1}\n${msg2}`;
if (!this.TipPanel.getHasTip()) {
this.TipPanel.showTip(title, tip, () => { callback?.(); }, () => { window.close() }, I18nManager.instance.t('AID_OK'), I18nManager.instance.t('AID_QUIT'), true);
}
break;
}
}
private onExitClick() {
this.TipPanel.showTip(
I18nManager.instance.t('AID_QUIT'),
I18nManager.instance.t('Are you sure you want to exit?'),
() => {
window.close();
}
);
}
onDestroy() {
// 清理事件监听
this.slotBar.node.off(SLOT_BAR_EVENT.ON_SPIN_CLICK, this.spinBtnClick, this);
this.slotBar.node.off(SLOT_BAR_EVENT.ON_MANUAL_STOP, this.manualStop, this);
this.slotBar.node.off(SLOT_BAR_EVENT.FAST_SPIN, this.onFastSpin, this);
this.slotBar.node.off(SLOT_BAR_EVENT.ON_AUTO_SPIN_CLICK, this.onAutoSpinClick, this);
this.slotBar.node.off(SLOT_BAR_EVENT.ON_EXIT_CLICK, this.onExitClick, this);
this.slotGame.node.off(SLOT_GAME_EVENT.ALL_ROLLER_STOP, this.allRollerStop, this);
this.slotGame.node.off(SLOT_GAME_EVENT.ALL_ROLLER_ICONS_DELETED, this.onIconsDeleted, this);
this.slotGame.node.off(SLOT_GAME_EVENT.ALL_ROLLER_ICONS_CREATED, this.onIconsCreated, this);
this.slotGame.node.off(SLOT_GAME_EVENT.ALL_ROLLER_ICONS_FALLEN, this.onIconsFallen, this);
this.unscheduleAllCallbacks();
}
// -----------调试
async spinBtnClick2(args) {
try {
this.isReceiveMsg = false;
this.slotGame.spin(this.gameState.isInFreeSpin);
this.slotGame.changeBg(this.gameState.isInFreeSpin);
this.slotBar.setWin(0);
this.slotBar.setBalance(this.slotBar.getBalance() - this.slotBar.getBet());
if (!this.gameState.isDebug) {
this.spinInfo = await callGameApi("spin_dev", {
Bet: this.slotBar.getBet(),
ObjectId: this.objectId[args],
});
} else {
this.spinInfo = {};
}
this.lastSpinInfo = this.spinInfo;
this.isReceiveMsg = true;
await this.handleSpinResult();
} catch (error) {
let errCode = parseInt(error.message.split('#')[0]);
this.showErrorTip(errCode);
this.handleErrSpin();
}
}
onSysGiftClickContinue(bet: number) {
this.slotBar.systemGiftContinue();
this.slotBar.setSysGiftBet(bet * 10000);
this.slotGame.setFeatureBuyInteractable(false);
}
onSysGiftSettleContinue() {
this.slotBar.systemGiftConfirm();
this.slotGame.setFeatureBuyInteractable(true);
}
}