From 755ec151829c2803dd8b42fb8e19d8aa0e3bd862 Mon Sep 17 00:00:00 2001 From: TJH Date: Sat, 8 Nov 2025 14:59:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E7=9B=98=E9=9D=A2=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Game/scripts/SlotGame.ts | 22 +- assets/Game/scripts/SlotScene.ts | 2 +- assets/Game/scripts/game/BaseRoller.ts | 26 +- assets/Game/scripts/game/Define.ts | 28 +- assets/Game/scripts/game/HRoller.ts | 14 +- assets/Game/scripts/game/HistoryDetail.ts | 12 +- assets/Game/scripts/game/Roller.ts | 22 +- assets/Game/scripts/game/RollerManager.ts | 132 ++++----- assets/Loading/game.scene | 338 +++++++++++++++------- assets/Loading/scripts/loading.ts | 46 ++- 10 files changed, 404 insertions(+), 238 deletions(-) diff --git a/assets/Game/scripts/SlotGame.ts b/assets/Game/scripts/SlotGame.ts index 83e9bca..68d672a 100644 --- a/assets/Game/scripts/SlotGame.ts +++ b/assets/Game/scripts/SlotGame.ts @@ -291,7 +291,7 @@ export class SlotGame extends Component { changeIconAndFrameType(spinData: any) { this.spinData = spinData; - // 先去找到PanChange当中是否有oldPos,如果没有代表当前icon没有动,就去crossSymbols当中找 + // 先去找到PanChange当中是否有oldPos,如果没有代表当前icon没有动,就去CroSymbols当中找 // 初始化changeData数组 let changeData = []; let colorChanges = this.spinData.PanChanges.CrossSymbolColorChange @@ -309,15 +309,15 @@ export class SlotGame extends Component { if (this.spinData.PanChanges.CrossSymbolPosChange[key]) { oldStartPos = this.spinData.PanChanges.CrossSymbolPosChange[key].OldPos[0]; } - // 如果没找到则在crossSymbols中查找 - else if (this.spinData.CrossSymbols[key]) { - oldStartPos = this.spinData.CrossSymbols[key].PosFirst; + // 如果没找到则在CroSymbols中查找 + else if (this.spinData.CroSymbols[key]) { + oldStartPos = this.spinData.CroSymbols[key].PosFirst; } - // 从crossSymbols获取frameType和height - if (this.spinData.CrossSymbols[key]) { - let symbol = this.spinData.CrossSymbols[key]; - frameType = symbol.FrameType; + // 从CroSymbols获取frameType和height + if (this.spinData.CroSymbols[key]) { + let symbol = this.spinData.CroSymbols[key]; + frameType = symbol.Type; height = symbol.PosLast - symbol.PosFirst + 1; } @@ -343,7 +343,7 @@ export class SlotGame extends Component { // icon掉落的逻辑 iconFallDown() { - this.setWaysCount(this.spinData.WaysNum); + this.setWaysCount(this.spinData.Symbol.WaysNum); this.rollerManager.iconFallDown(this.spinData); } @@ -357,7 +357,7 @@ export class SlotGame extends Component { // 计算当前停止列之前的所有数字的乘积 let totalWays = 1; for (let i = 0; i < rollerId; i++) { - totalWays *= this.spinData.SymbolNumOfReels[i]; + totalWays *= this.spinData.Symbol.ReelNum[i]; } let isExpect = this.rollerManager.checkNextRollerExpect(rollerId); @@ -377,7 +377,7 @@ export class SlotGame extends Component { if (isExpect && !this.rollerManager.getIsFastSpin()) { this.hideScatterOnIsScroll(); } - this.setWaysCount(this.spinData.WaysNum); + this.setWaysCount(this.spinData.Symbol.WaysNum); this.node.emit(SLOT_GAME_EVENT.ALL_ROLLER_STOP); } diff --git a/assets/Game/scripts/SlotScene.ts b/assets/Game/scripts/SlotScene.ts index ce645a2..b84768e 100644 --- a/assets/Game/scripts/SlotScene.ts +++ b/assets/Game/scripts/SlotScene.ts @@ -212,7 +212,7 @@ export class SlotScene extends Component { } else { AudioManager.instance.playBGM("Normal_Mode_BGM"); } - this.slotGame.setWaysCount(this.spinData.WaysNum); + this.slotGame.setWaysCount(this.spinData.Symbol.WaysNum); this.slotGame.setMultiLabel(this.spinData.WinMultiPlier); this.slotGame.setRollerIconRule(rollerIconRule); diff --git a/assets/Game/scripts/game/BaseRoller.ts b/assets/Game/scripts/game/BaseRoller.ts index 38dfe5b..2595700 100644 --- a/assets/Game/scripts/game/BaseRoller.ts +++ b/assets/Game/scripts/game/BaseRoller.ts @@ -73,7 +73,7 @@ export abstract class BaseRoller extends Component { protected _content: Node = null; protected _info: Info = new Info(); protected _stopData: number[] = []; - protected _crossSymbols: any = null; // 存储当前滚轮的n*1 Icon信息 + protected _CroSymbols: any = null; // 存储当前滚轮的n*1 Icon信息 // 统一的图标管理结构 protected _allIcons: Map = new Map(); // 存储所有图标节点,通过唯一key访问 @@ -175,7 +175,7 @@ export abstract class BaseRoller extends Component { // 清空图标映射 this._allIcons.clear(); this._posToIconKey.clear(); - this._crossSymbols = null; + this._CroSymbols = null; if (!EDITOR) { // 运行时初始化 @@ -188,13 +188,13 @@ export abstract class BaseRoller extends Component { * 初始化滚轮并创建初始图 * @param id 滚轮ID * @param data 初始图标数据数组 - * @param crossSymbols n*1 Icon数据 + * @param CroSymbols n*1 Icon数据 */ - initRollerWithIcon(id: number, data: number[], crossSymbols?: any) { + initRollerWithIcon(id: number, data: number[], CroSymbols?: any) { this.iconFactory.init(); this.initRoller(id); // 创建图标 - this._crossSymbols = crossSymbols; + this._CroSymbols = CroSymbols; this.createInitIcons(data); } @@ -208,7 +208,7 @@ export abstract class BaseRoller extends Component { this._posToIconKey.clear(); // 先处理n*1 Icon - if (this._crossSymbols && Object.keys(this._crossSymbols).length > 0) { + if (this._CroSymbols && Object.keys(this._CroSymbols).length > 0) { // 创建n*1 Icon this.createSpecialIcons(); } @@ -227,8 +227,8 @@ export abstract class BaseRoller extends Component { // 直接使用已有的符号数据,避免重复处理 let processedPoses = new Set(); // 用于跟踪已处理的符号ID // 遍历所有位置的符号数据 - for (let pos in this._crossSymbols) { - let iconSpecialMsg = this._crossSymbols[pos]; + for (let pos in this._CroSymbols) { + let iconSpecialMsg = this._CroSymbols[pos]; // 如果这个符号ID已经处理过,跳过 if (processedPoses.has(iconSpecialMsg.id)) continue; // 标记这个符号ID为已处理 @@ -251,7 +251,7 @@ export abstract class BaseRoller extends Component { let endPos = iconSpecialMsg.endPos; let height = iconSpecialMsg.lHeight; let iconIndex = iconSpecialMsg.iconIndex; - let frameType = iconSpecialMsg.frameType; + let frameType = iconSpecialMsg.Type; // 生成图标ID let iconKey = this.generateIconKey(startPos, height, endPos); // 创建图标节点 @@ -297,10 +297,10 @@ export abstract class BaseRoller extends Component { /** * 设置n*1 Icon数据 - * @param crossSymbols n*1 Icon数据 + * @param CroSymbols n*1 Icon数据 */ - setCrossSymbols(crossSymbols: any) { - this._crossSymbols = crossSymbols; + setCroSymbols(CroSymbols: any) { + this._CroSymbols = CroSymbols; } /** @@ -647,5 +647,5 @@ export abstract class BaseRoller extends Component { abstract createNewIconTop(createDatas: number[]): void; - abstract iconFallDown(data: number[], crossSymbols: any): void; + abstract iconFallDown(data: number[], CroSymbols: any): void; } \ No newline at end of file diff --git a/assets/Game/scripts/game/Define.ts b/assets/Game/scripts/game/Define.ts index 4745e16..4fab70e 100644 --- a/assets/Game/scripts/game/Define.ts +++ b/assets/Game/scripts/game/Define.ts @@ -175,12 +175,12 @@ export interface GameData { // 当前下注 Bet: number; // 不规则图标信息 - CrossSymbols: { + CroSymbols: { [key: string]: { - FrameType: number; + Type: number; PosFirst: number; PosLast: number; - Color: number; + Symbol: number; } }; // 连线数 @@ -194,9 +194,13 @@ export interface GameData { // 中奖位置 WinPosition: any; // 盘面信息 - PanColor: { - Top: number[]; - Bottom: number[]; + Symbol: { + ScNum:number; + winMulti:number; + WaysNum:number; + ReelNum:number[]; + MultiValue:number[]; + Middle: number[]; }; // 盘面变化 PanChanges: any; @@ -270,7 +274,7 @@ export let gameInfo: any = { "Bet": 10000, "Balance": 0, "WinMultiPlier": 1, - "CrossSymbols": { + "CroSymbols": { "1": { "FrameType": 1, "PosFirst": 5, @@ -402,7 +406,7 @@ export let winData: any = { "Bet": 10000, //下注 "Balance": 51602584500, //余额 "WinMultiPlier": 6, //当前算分的倍率 界面显示的X6倍 - "CrossSymbols": {//跨行的符号集 + "CroSymbols": {//跨行的符号集 "1": { "FrameType": 0, //0:普通框 1:银框 2:金框 3:百搭框 "PosFirst": 6, @@ -543,12 +547,12 @@ export let winData: any = { "PosLast": 3, },//crossSymbol的结束位置 "CrossSymbolPosChange": {//crossSymbol符号的位置发生了变化 - "1": { //1的key对应于CrossSymbols字段中的key - "OldPos": [//CrossSymbols的变化之前的位置 + "1": { //1的key对应于CroSymbols字段中的key + "OldPos": [//CroSymbols的变化之前的位置 5, 6 ], - "NewPos": [//CrossSymbols的变化之后的位置 + "NewPos": [//CroSymbols的变化之后的位置 6, 7 ] @@ -614,7 +618,7 @@ export let winTestData = { "Balance": 512890548700, "IsFree": true, "WinMultiPlier": 6, - "CrossSymbols": { + "CroSymbols": { "1": { "FrameType": 0, "PosFirst": 7, diff --git a/assets/Game/scripts/game/HRoller.ts b/assets/Game/scripts/game/HRoller.ts index b2b54df..383fdab 100644 --- a/assets/Game/scripts/game/HRoller.ts +++ b/assets/Game/scripts/game/HRoller.ts @@ -667,11 +667,11 @@ export class HRoller extends BaseRoller { /** icon进行掉落移动 */ - iconFallDown(data: number[], crossSymbols: any) { + iconFallDown(data: number[], CroSymbols: any) { // 更新所有icon的iconKey和posToIconKey let updates = []; - let sortNewIconStartPos = this.getNewIconsStartPos(data, crossSymbols); + let sortNewIconStartPos = this.getNewIconsStartPos(data, CroSymbols); let sortIcons = this.getSortIcons(); for (let i = 0; i < sortNewIconStartPos.length; i++) { let newStartPos = sortNewIconStartPos[i]; @@ -755,7 +755,7 @@ export class HRoller extends BaseRoller { - getNewIconsStartPos(data: number[], crossSymbols: any) { + getNewIconsStartPos(data: number[], CroSymbols: any) { // 存储所有图标的startPos let startPositions: number[] = []; @@ -764,12 +764,12 @@ export class HRoller extends BaseRoller { // 记录已经处理的pos let processedPos = new Set(); // 首先处理不规则图标(n*1图标) - if (crossSymbols) { - for (let pos in crossSymbols) { - let id = crossSymbols[pos].id; + if (CroSymbols) { + for (let pos in CroSymbols) { + let id = CroSymbols[pos].id; if (processedPos.has(id)) continue; processedPos.add(id); - let iconSpecialMsg = crossSymbols[pos]; + let iconSpecialMsg = CroSymbols[pos]; let startPos = iconSpecialMsg.startPos; let endPos = iconSpecialMsg.endPos; diff --git a/assets/Game/scripts/game/HistoryDetail.ts b/assets/Game/scripts/game/HistoryDetail.ts index 55e4506..299b018 100644 --- a/assets/Game/scripts/game/HistoryDetail.ts +++ b/assets/Game/scripts/game/HistoryDetail.ts @@ -280,7 +280,7 @@ export class HistoryDetail extends Component { // 每一竖列最多有5个symbol const EACH_LINE_MAX_SYMBOL = 5 - let curSymbolIdx = pan.CrossSymbols[curCrossIdx]?.PosFirst + let curSymbolIdx = pan.CroSymbols[curCrossIdx]?.PosFirst // console.log(`curCrossIdx=${curCrossIdx}`) // console.log(`curSymbolIdx=${curSymbolIdx}`) @@ -321,13 +321,13 @@ export class HistoryDetail extends Component { i++ } else { - // console.log(`当前处理到CrossSymbols ,curCrossIdx=${curCrossIdx}`) + // console.log(`当前处理到CroSymbols ,curCrossIdx=${curCrossIdx}`) // console.log(`遇到了连体元素i=${i},curSymbolIdx = ${curSymbolIdx}`) const item_symbol = instantiate(this.item_symbol) let v = pan.PanColor.Bottom[i] - let length = pan.CrossSymbols[curCrossIdx].PosLast - pan.CrossSymbols[curCrossIdx].PosFirst + 1 + let length = pan.CroSymbols[curCrossIdx].PosLast - pan.CroSymbols[curCrossIdx].PosFirst + 1 // console.log(`${length}连框`) @@ -356,9 +356,9 @@ export class HistoryDetail extends Component { const path_symbol = `symbol_${v}_x1` symbol.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_symbol) - // pan.CrossSymbols?.curCrossIdx?.FrameType + // pan.CroSymbols?.curCrossIdx?.Type const frame = item_symbol.getChildByName("frame").getComponent(Sprite) - const path_frame = `frame_${pan.CrossSymbols[curCrossIdx]?.FrameType}` + const path_frame = `frame_${pan.CroSymbols[curCrossIdx]?.Type}` frame.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_frame) let height = frame.node.getComponent(UITransform).height * length; @@ -378,7 +378,7 @@ export class HistoryDetail extends Component { vert_symbols.children[line].addChild(item_symbol) curCrossIdx += 1 - curSymbolIdx = pan.CrossSymbols[curCrossIdx]?.PosFirst + curSymbolIdx = pan.CroSymbols[curCrossIdx]?.PosFirst // 连体symbol的数据视为一个 i = i + length diff --git a/assets/Game/scripts/game/Roller.ts b/assets/Game/scripts/game/Roller.ts index 7b7969d..3666df8 100644 --- a/assets/Game/scripts/game/Roller.ts +++ b/assets/Game/scripts/game/Roller.ts @@ -259,12 +259,12 @@ export class Roller extends BaseRoller { // 从上到下依次创建图标(从位置0开始) for (let i = 0; i < data.length; i++) { // 检查当前位置是否需要创建特殊图标(n*1图标) - if (this._crossSymbols && this._crossSymbols[i]) { - let iconSpecialMsg = this._crossSymbols[i]; + if (this._CroSymbols && this._CroSymbols[i]) { + let iconSpecialMsg = this._CroSymbols[i]; // 检查这个特殊图标是否已经被处理过 let isProcessed = false; for (let j = 0; j < i; j++) { - if (this._crossSymbols[j] && this._crossSymbols[j].id === iconSpecialMsg.id) { + if (this._CroSymbols[j] && this._CroSymbols[j].id === iconSpecialMsg.id) { isProcessed = true; break; } @@ -276,7 +276,7 @@ export class Roller extends BaseRoller { let endPos = iconSpecialMsg.endPos; let height = iconSpecialMsg.lHeight; let iconIndex = iconSpecialMsg.iconIndex; - let frameType = iconSpecialMsg.frameType; + let frameType = iconSpecialMsg.Type; // 生成图标ID let iconKey = this.generateIconKey(startPos, height, endPos); @@ -783,9 +783,9 @@ export class Roller extends BaseRoller { /** icon进行掉落移动 */ - iconFallDown(data: number[], crossSymbols: any) { + iconFallDown(data: number[], CroSymbols: any) { let updates = []; - let sortNewIconStartPos = this.getNewIconsStartPos(data, crossSymbols); + let sortNewIconStartPos = this.getNewIconsStartPos(data, CroSymbols); let sortIcons = this.getSortIcons(); for (let i = 0; i < sortNewIconStartPos.length; i++) { let newStartPos = sortNewIconStartPos[i]; @@ -892,7 +892,7 @@ export class Roller extends BaseRoller { } - getNewIconsStartPos(data: number[], crossSymbols: any) { + getNewIconsStartPos(data: number[], CroSymbols: any) { // 存储所有图标的startPos let startPositions: number[] = []; @@ -901,12 +901,12 @@ export class Roller extends BaseRoller { // 记录已经处理的pos let processedPos = new Set(); // 首先处理不规则图标(n*1图标) - if (crossSymbols) { - for (let pos in crossSymbols) { - let id = crossSymbols[pos].id; + if (CroSymbols) { + for (let pos in CroSymbols) { + let id = CroSymbols[pos].id; if (processedPos.has(id)) continue; processedPos.add(id); - let iconSpecialMsg = crossSymbols[pos]; + let iconSpecialMsg = CroSymbols[pos]; let startPos = iconSpecialMsg.startPos; let endPos = iconSpecialMsg.endPos; diff --git a/assets/Game/scripts/game/RollerManager.ts b/assets/Game/scripts/game/RollerManager.ts index 55f0954..208a6d5 100644 --- a/assets/Game/scripts/game/RollerManager.ts +++ b/assets/Game/scripts/game/RollerManager.ts @@ -30,7 +30,7 @@ export class RollerManager extends Component { vMaskSpriteFrame: SpriteFrame = null; rollerMsg: any[] = [ - { row: 1, col: 4, isHorizontal: true }, + // { row: 1, col: 4, isHorizontal: true }, { row: 5, col: 1, isHorizontal: false }, { row: 5, col: 1, isHorizontal: false }, { row: 5, col: 1, isHorizontal: false }, @@ -55,9 +55,9 @@ export class RollerManager extends Component { // 是否是免费游戏 _isFreeSpin: boolean = false; // 不规则图标信息 - _crossSymbols: any = null; + _CroSymbols: any = null; // 处理过的不规则icon信息 - _processedCrossSymbols: any = null; + _processedCroSymbols: any = null; private hMaskNode: Node = null; private vMaskNode: Node = null; @@ -92,29 +92,29 @@ export class RollerManager extends Component { for (let i = 0; i < rollerLength; i++) { let rollerMsg = this.rollerMsg[i]; - if (rollerMsg.isHorizontal) { - let hRoller = HRoller.create(i, rollerMsg.col, this.iconWidth, this.iconHeight, this.iconFactory); - hRoller.format = true; + // if (rollerMsg.isHorizontal) { + // let hRoller = HRoller.create(i, rollerMsg.col, this.iconWidth, this.iconHeight, this.iconFactory); + // hRoller.format = true; - this.hMaskNode.addChild(hRoller.node); + // this.hMaskNode.addChild(hRoller.node); - let rollerPosition = new Vec3(0, 3 * this.iconHeight + 43, 0); - this.hMaskNode.setPosition(rollerPosition); - // hRoller.node.setPosition(rollerPosition); - // 保存引用 - this.hRollers.push(hRoller); - this.allRollers.push(hRoller); - } else { - let roller = Roller.create(i, rollerMsg.row, this.iconWidth, this.iconHeight, this.iconFactory); - roller.format = true; + // let rollerPosition = new Vec3(0, 3 * this.iconHeight + 43, 0); + // this.hMaskNode.setPosition(rollerPosition); + // // hRoller.node.setPosition(rollerPosition); + // // 保存引用 + // this.hRollers.push(hRoller); + // this.allRollers.push(hRoller); + // } else { + let roller = Roller.create(i, rollerMsg.row, this.iconWidth, this.iconHeight, this.iconFactory); + roller.format = true; - this.vMaskNode.addChild(roller.node); + this.vMaskNode.addChild(roller.node); - let rollerPosition = this.getRollerPosition(i - 1); - roller.node.setPosition(rollerPosition); - this.vRollers.push(roller); - this.allRollers.push(roller); - } + let rollerPosition = this.getRollerPosition(i); + roller.node.setPosition(rollerPosition); + this.vRollers.push(roller); + this.allRollers.push(roller); + // } } } @@ -211,8 +211,8 @@ export class RollerManager extends Component { } if (nextStopRollerId != -1) { - let nextStopRollerCrossSymbols = this._processedCrossSymbols[nextStopRollerId]; - this.allRollers[nextStopRollerId].setCrossSymbols(nextStopRollerCrossSymbols); + let nextStopRollerCroSymbols = this._processedCroSymbols[nextStopRollerId]; + this.allRollers[nextStopRollerId].setCroSymbols(nextStopRollerCroSymbols); this.allRollers[nextStopRollerId].stopScroll(this._resultStopData[nextStopRollerId], stopSpeedData); } return; @@ -239,11 +239,11 @@ export class RollerManager extends Component { // 检查每个位置 for (let j = 0; j < rollerData.length; j++) { // 检查是否有交叉符号覆盖该位置 - if (this._processedCrossSymbols && - this._processedCrossSymbols[i] && - this._processedCrossSymbols[i][j]) { + if (this._processedCroSymbols && + this._processedCroSymbols[i] && + this._processedCroSymbols[i][j]) { - const symbolInfo = this._processedCrossSymbols[i][j]; + const symbolInfo = this._processedCroSymbols[i][j]; // 只计算开始位置,避免重复计数 if (symbolInfo.isStart && symbolInfo.iconIndex === 1) { @@ -379,18 +379,18 @@ export class RollerManager extends Component { initRollerWithIcon(data: GameData) { this._spinData = data; - let topData = data.PanColor.Top; - let bottomData = data.PanColor.Bottom; - this._crossSymbols = data.CrossSymbols; + // let topData = data.PanColor.Top; + let bottomData = data.Symbol.Middle; + this._CroSymbols = data.CroSymbols; // 分割数据 - this._resultStopData = [topData, ...this.splitArray(bottomData, [5, 5, 5, 5, 5, 5])]; + this._resultStopData = [...this.splitArray(bottomData, [5, 5, 5, 5, 5, 5])]; // 处理n*1符号 - let processedCrossSymbols = this.processCrossSymbolsForRollers(); + let processedCroSymbols = this.processCroSymbolsForRollers(); for (let i = 0; i < this.allRollers.length; i++) { let roller = this.allRollers[i]; - let rollerCrossSymbols = processedCrossSymbols[i]; - roller.initRollerWithIcon(i, this._resultStopData[i], rollerCrossSymbols); + let rollerCroSymbols = processedCroSymbols[i]; + roller.initRollerWithIcon(i, this._resultStopData[i], rollerCroSymbols); } } @@ -399,12 +399,12 @@ export class RollerManager extends Component { * 处理n*1符号数据,为每个滚轮准备对应的n*1符号信息 * @returns 处理后的n*1符号数据数组,每个元素对应一个滚轮 */ - private processCrossSymbolsForRollers(): any[] { - this._processedCrossSymbols = []; + private processCroSymbolsForRollers(): any[] { + this._processedCroSymbols = []; let row = 5; let col = 6; // 如果没有交叉符号数据,返回空对象数组 - if (!this._crossSymbols) { + if (!this._CroSymbols) { return new Array(col).fill({}); } @@ -415,8 +415,8 @@ export class RollerManager extends Component { } // 遍历所有交叉符号 - for (let symbolId in this._crossSymbols) { - let symbol = this._crossSymbols[symbolId]; + for (let symbolId in this._CroSymbols) { + let symbol = this._CroSymbols[symbolId]; // 计算符号所在的滚轮索引 let rollerIndex = Math.floor(symbol.PosFirst / 5); @@ -433,13 +433,14 @@ export class RollerManager extends Component { startPos: startPos, endPos: endPos, lHeight: endPos - startPos + 1, - frameType: symbol.FrameType, - iconIndex: symbol.Color + frameType: symbol.Type, + iconIndex: symbol.Symbol }; } } - this._processedCrossSymbols = [{}, ...rollerSymbols]; - return this._processedCrossSymbols; + this._processedCroSymbols = [...rollerSymbols]; + console.log(this._processedCroSymbols) + return this._processedCroSymbols; } // 滚轮Icon生成规则 @@ -537,45 +538,44 @@ export class RollerManager extends Component { this._resultStopData = []; // 分割底盘数据 - this._resultStopData = [data.PanColor.Top, ...this.splitArray(data.PanColor.Bottom, [5, 5, 5, 5, 5, 5])]; + this._resultStopData = [...this.splitArray(data.Symbol.Middle, [5, 5, 5, 5, 5, 5])]; // 处理不对则icon - this._crossSymbols = data.CrossSymbols; - let processedCrossSymbols = this.processCrossSymbolsForRollers(); + this._CroSymbols = data.CroSymbols; + let processedCroSymbols = this.processCroSymbolsForRollers(); let stopSpeedData = this._isFastSpin ? [[0, 6000]] : [[0.1, 3500]]; if (this._isFastSpin) { - // this.stopAllRollersImmediately(processedCrossSymbols); + // this.stopAllRollersImmediately(processedCroSymbols); for (let i = 0; i < this.allRollers.length; i++) { let stopData = this._resultStopData[i]; let roller = this.allRollers[i]; - let rollerCrossSymbols = processedCrossSymbols[i]; - roller.setCrossSymbols(rollerCrossSymbols); + let rollerCroSymbols = processedCroSymbols[i]; + roller.setCroSymbols(rollerCroSymbols); roller.stopScroll(stopData, stopSpeedData) } } else { - // this.stopRollersInSequence(processedCrossSymbols); - let firstRollerCrossSymbols = processedCrossSymbols[0]; - this.allRollers[0].setCrossSymbols(firstRollerCrossSymbols); + // this.stopRollersInSequence(processedCroSymbols); + let firstRollerCroSymbols = processedCroSymbols[0]; + this.allRollers[0].setCroSymbols(firstRollerCroSymbols); this.allRollers[0].stopScroll(this._resultStopData[0], stopSpeedData); } } - stopRollersInSequence(processedCrossSymbols: any[]) { + stopRollersInSequence(processedCroSymbols: any[]) { let standardStopDuration = [[0.1, 3500]]; } manualStop(data: GameData) { this._isManualStop = true; this._resultStopData = []; - let topData = data.PanColor.Top; - this._resultStopData = [topData, ...this.splitArray(data.PanColor.Bottom, [5, 5, 5, 5, 5, 5])]; - this._crossSymbols = data.CrossSymbols; - let processedCrossSymbols = this.processCrossSymbolsForRollers(); + this._resultStopData = [...this.splitArray(data.Symbol.Middle, [5, 5, 5, 5, 5, 5])]; + this._CroSymbols = data.CroSymbols; + let processedCroSymbols = this.processCroSymbolsForRollers(); for (let i = 0; i < this.allRollers.length; i++) { let stopData = this._resultStopData[i]; let roller = this.allRollers[i]; - let rollerCrossSymbols = processedCrossSymbols[i]; - roller.setCrossSymbols(rollerCrossSymbols); + let rollerCroSymbols = processedCroSymbols[i]; + roller.setCroSymbols(rollerCroSymbols); roller.manualStopScroll(stopData) } } @@ -814,17 +814,17 @@ export class RollerManager extends Component { this._fallenRollerCount = 0; // 重置计数器 this._deletedRollerCount = 0; // 分割底盘数据 - this._resultStopData = [data.PanColor.Top, ...this.splitArray(data.PanColor.Bottom, [5, 5, 5, 5, 5, 5])]; + this._resultStopData = [...this.splitArray(data.Symbol.Middle, [5, 5, 5, 5, 5, 5])]; // 处理不对则icon - this._crossSymbols = data.CrossSymbols; - let processedCrossSymbols = this.processCrossSymbolsForRollers(); + this._CroSymbols = data.CroSymbols; + let processedCroSymbols = this.processCroSymbolsForRollers(); this.allRollers.forEach((roller, index) => { let stopData = this._resultStopData[index]; - let rollerCrossSymbols = processedCrossSymbols[index]; - roller.setCrossSymbols(rollerCrossSymbols); + let rollerCroSymbols = processedCroSymbols[index]; + roller.setCroSymbols(rollerCroSymbols); this.scheduleOnce(() => { - roller.iconFallDown(stopData, rollerCrossSymbols) + roller.iconFallDown(stopData, rollerCroSymbols) }, 0.03 * index) }) diff --git a/assets/Loading/game.scene b/assets/Loading/game.scene index 59d54e8..1229e24 100644 --- a/assets/Loading/game.scene +++ b/assets/Loading/game.scene @@ -23,7 +23,7 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 76 + "__id__": 79 }, "_lpos": { "__type__": "cc.Vec3", @@ -54,7 +54,7 @@ }, "autoReleaseAssets": false, "_globals": { - "__id__": 77 + "__id__": 80 }, "_id": "6c29a3fe-b10e-44a5-98e3-55595b231767" }, @@ -77,25 +77,25 @@ "__id__": 8 }, { - "__id__": 54 + "__id__": 57 }, { - "__id__": 57 + "__id__": 60 } ], "_active": true, "_components": [ - { - "__id__": 72 - }, - { - "__id__": 73 - }, - { - "__id__": 74 - }, { "__id__": 75 + }, + { + "__id__": 76 + }, + { + "__id__": 77 + }, + { + "__id__": 78 } ], "_prefab": null, @@ -341,22 +341,22 @@ "__id__": 9 }, { - "__id__": 47 + "__id__": 50 } ], "_active": true, "_components": [ - { - "__id__": 50 - }, - { - "__id__": 51 - }, - { - "__id__": 52 - }, { "__id__": 53 + }, + { + "__id__": 54 + }, + { + "__id__": 55 + }, + { + "__id__": 56 } ], "_prefab": null, @@ -418,15 +418,18 @@ }, { "__id__": 37 + }, + { + "__id__": 40 } ], "_active": true, "_components": [ { - "__id__": 45 + "__id__": 48 }, { - "__id__": 46 + "__id__": 49 } ], "_prefab": null, @@ -1313,7 +1316,7 @@ }, { "__type__": "cc.Node", - "_name": "Loading", + "_name": "loadingLabel", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -1443,6 +1446,138 @@ "_shadowBlur": 2, "_id": "2380yWt0tOa6GJutBEnRsb" }, + { + "__type__": "cc.Node", + "_name": "retryLabel", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 9 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 38 + }, + { + "__id__": 39 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -650, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "14e7XZMaJFYLTkByEFJD19" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 37 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 1021.423828125, + "height": 56.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 1 + }, + "_id": "569fDE9xdENZpBizWSQ/8L" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 37 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 38, + "_fontSize": 38, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 3, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": true, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 36, + "g": 37, + "b": 46, + "a": 255 + }, + "_outlineWidth": 3, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "e95YoCoCNIG4q/RXhLojDR" + }, { "__type__": "cc.Node", "_name": "Btn", @@ -1453,19 +1588,19 @@ }, "_children": [ { - "__id__": 38 + "__id__": 41 } ], "_active": false, "_components": [ { - "__id__": 41 + "__id__": 44 }, { - "__id__": 42 + "__id__": 45 }, { - "__id__": 43 + "__id__": 46 } ], "_prefab": null, @@ -1504,16 +1639,16 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 37 + "__id__": 40 }, "_children": [], "_active": true, "_components": [ { - "__id__": 39 + "__id__": 42 }, { - "__id__": 40 + "__id__": 43 } ], "_prefab": null, @@ -1552,7 +1687,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 38 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1574,7 +1709,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 38 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1636,7 +1771,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 37 + "__id__": 40 }, "_enabled": true, "__prefab": null, @@ -1658,7 +1793,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 37 + "__id__": 40 }, "_enabled": true, "__prefab": null, @@ -1697,13 +1832,13 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 37 + "__id__": 40 }, "_enabled": true, "__prefab": null, "clickEvents": [ { - "__id__": 44 + "__id__": 47 } ], "_interactable": true, @@ -1755,7 +1890,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 37 + "__id__": 40 }, "_id": "54j4lwPyZHbqqANZE+r9Tj" }, @@ -1833,10 +1968,10 @@ "_active": true, "_components": [ { - "__id__": 48 + "__id__": 51 }, { - "__id__": 49 + "__id__": 52 } ], "_prefab": null, @@ -1875,7 +2010,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 47 + "__id__": 50 }, "_enabled": true, "__prefab": null, @@ -1897,7 +2032,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 47 + "__id__": 50 }, "_enabled": true, "__prefab": null, @@ -2041,10 +2176,10 @@ "_active": true, "_components": [ { - "__id__": 55 + "__id__": 58 }, { - "__id__": 56 + "__id__": 59 } ], "_prefab": null, @@ -2083,7 +2218,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 54 + "__id__": 57 }, "_enabled": true, "__prefab": null, @@ -2105,7 +2240,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 54 + "__id__": 57 }, "_enabled": true, "__prefab": null, @@ -2148,22 +2283,22 @@ }, "_children": [ { - "__id__": 58 + "__id__": 61 }, { - "__id__": 62 + "__id__": 65 }, { - "__id__": 67 + "__id__": 70 } ], "_active": false, "_components": [ { - "__id__": 70 + "__id__": 73 }, { - "__id__": 71 + "__id__": 74 } ], "_prefab": null, @@ -2202,19 +2337,19 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 57 + "__id__": 60 }, "_children": [], "_active": true, "_components": [ { - "__id__": 59 + "__id__": 62 }, { - "__id__": 60 + "__id__": 63 }, { - "__id__": 61 + "__id__": 64 } ], "_prefab": null, @@ -2253,7 +2388,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 58 + "__id__": 61 }, "_enabled": true, "__prefab": null, @@ -2275,7 +2410,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 58 + "__id__": 61 }, "_enabled": true, "__prefab": null, @@ -2287,7 +2422,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 58 + "__id__": 61 }, "_enabled": true, "__prefab": null, @@ -2326,22 +2461,22 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 57 + "__id__": 60 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 63 - }, - { - "__id__": 64 - }, - { - "__id__": 65 - }, { "__id__": 66 + }, + { + "__id__": 67 + }, + { + "__id__": 68 + }, + { + "__id__": 69 } ], "_prefab": null, @@ -2380,7 +2515,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 62 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2402,7 +2537,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 62 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2464,7 +2599,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 62 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2477,7 +2612,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 62 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2507,16 +2642,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 57 + "__id__": 60 }, "_children": [], "_active": true, "_components": [ { - "__id__": 68 + "__id__": 71 }, { - "__id__": 69 + "__id__": 72 } ], "_prefab": null, @@ -2555,7 +2690,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 67 + "__id__": 70 }, "_enabled": true, "__prefab": null, @@ -2577,7 +2712,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 67 + "__id__": 70 }, "_enabled": true, "__prefab": null, @@ -2616,7 +2751,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 57 + "__id__": 60 }, "_enabled": true, "__prefab": null, @@ -2638,7 +2773,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 57 + "__id__": 60 }, "_enabled": true, "__prefab": null, @@ -2722,17 +2857,20 @@ "progressLabel": { "__id__": 33 }, - "tipLabel": { + "loadingTipLabel": { "__id__": 36 }, + "retryTipLabel": { + "__id__": 39 + }, "startBtn": { - "__id__": 43 + "__id__": 46 }, "startBtnLabel": { - "__id__": 40 + "__id__": 43 }, "GameNode": { - "__id__": 47 + "__id__": 50 }, "languageJson": { "__uuid__": "65d2a408-9396-47e4-99de-73423a590b7f", @@ -2754,10 +2892,10 @@ "__id__": 5 }, "Logo": { - "__id__": 54 + "__id__": 57 }, "rotateNode": { - "__id__": 57 + "__id__": 60 }, "_id": "d8F/UwpTxNpZhwSJjDvnkk" }, @@ -2772,29 +2910,29 @@ { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 78 - }, - "shadows": { - "__id__": 79 - }, - "_skybox": { - "__id__": 80 - }, - "fog": { "__id__": 81 }, - "octree": { + "shadows": { "__id__": 82 }, - "skin": { + "_skybox": { "__id__": 83 }, - "lightProbeInfo": { + "fog": { "__id__": 84 }, - "postSettings": { + "octree": { "__id__": 85 }, + "skin": { + "__id__": 86 + }, + "lightProbeInfo": { + "__id__": 87 + }, + "postSettings": { + "__id__": 88 + }, "bakedWithStationaryMainLight": false, "bakedWithHighpLightmap": false }, diff --git a/assets/Loading/scripts/loading.ts b/assets/Loading/scripts/loading.ts index 2f507b6..4036b4b 100644 --- a/assets/Loading/scripts/loading.ts +++ b/assets/Loading/scripts/loading.ts @@ -25,7 +25,10 @@ export class LoadingUI extends Component { progressLabel: Label = null; @property(Label) - tipLabel: Label = null; + loadingTipLabel: Label = null; + + @property(Label) + retryTipLabel: Label = null; @property(Button) startBtn: Button = null; @@ -41,7 +44,7 @@ export class LoadingUI extends Component { private _networkComplete = false; private _retryCount = 0; - private readonly MAX_RETRY = 3; + private readonly MAX_RETRY = 5; private INITIAL_PROGRESS = 0.3; private _instanceGameNode = null; @@ -95,8 +98,8 @@ export class LoadingUI extends Component { try { // 更新进度条到 0.6 this.updateProgress(0.6); - - this.tipLabel.string = I18nManager.instance.t("AID_LOADING"); + this.loadingTipLabel.string = I18nManager.instance.t('AID_LOADING'); + this.retryTipLabel.string = ''; let gameInfo = await callGameApi("gameinfo", {}); if (!gameInfo) throw new Error('Get game info failed'); GameDataManager.instance.gameInfo = gameInfo; @@ -125,7 +128,8 @@ export class LoadingUI extends Component { private async startLoadingGameBundle() { try { // 显示加载UI - this.tipLabel.string = I18nManager.instance.t("AID_LOADING"); + this.loadingTipLabel.string = I18nManager.instance.t('AID_LOADING'); + this.retryTipLabel.string = ''; this.startBtn.node.active = false; // 从 0.8 开始加载 @@ -171,9 +175,10 @@ export class LoadingUI extends Component { // 开始游戏 // AudioManager.instance.playBGM('Normal_Mode_BGM'); this.scheduleOnce(() => { - this.tipLabel.string = ''; + this.loadingTipLabel.string = ''; + this.retryTipLabel.string = ''; this.startBtn.node.active = true; - this.startBtnLabel.string = I18nManager.instance.t("AID_GET_STARTED"); + this.startBtnLabel.string = I18nManager.instance.t('AID_GET_STARTED'); this.progressBar.node.active = false; this.progressLabel.node.active = false; @@ -184,9 +189,27 @@ export class LoadingUI extends Component { private handleError(error: Error) { this._retryCount++; + this.loadingTipLabel.string = ''; if (this._retryCount <= this.MAX_RETRY) { // 自动重试 - this.tipLabel.string = `retry(${this._retryCount}/${this.MAX_RETRY})...`; + switch (this._retryCount) { + case 1: + this.retryTipLabel.string = I18nManager.instance.t('AID_NETWORK_RETRY_1'); + break + case 2: + this.retryTipLabel.string = I18nManager.instance.t('AID_NETWORK_RETRY_2'); + break + case 3: + this.retryTipLabel.string = I18nManager.instance.t('AID_NETWORK_RETRY_3'); + break + case 4: + this.retryTipLabel.string = I18nManager.instance.t('AID_NETWORK_RETRY_4'); + break + case 5: + this.retryTipLabel.string = I18nManager.instance.t('AID_NETWORK_RETRY_5'); + break + + } this.scheduleOnce(() => { if (!this._networkComplete) { this.initNetwork(); @@ -196,7 +219,8 @@ export class LoadingUI extends Component { }, 2); } else { // 显示重试按钮 - this.tipLabel.string = I18nManager.instance.t("AID_LOADING"); + this.loadingTipLabel.string = I18nManager.instance.t('AID_LOADING'); + this.retryTipLabel.string = ''; this.startBtn.node.active = true; this.progressBar.node.active = false; this.progressLabel.node.active = false; @@ -205,12 +229,12 @@ export class LoadingUI extends Component { this.maskUITransform.node.active = false; this.lightNode.active = false; - this.startBtnLabel.string = I18nManager.instance.t("AID_ERROR_RETRY_BUTTON"); + this.startBtnLabel.string = I18nManager.instance.t('AID_ERROR_RETRY_BUTTON'); } } onStartBtnClick() { - if (this.startBtnLabel.string ===I18nManager.instance.t("AID_ERROR_RETRY_BUTTON")) { + if (this.startBtnLabel.string === I18nManager.instance.t('AID_ERROR_RETRY_BUTTON')) { // 重试逻辑 this._retryCount = 0; this.startBtn.node.active = false;