基本盘面显示

This commit is contained in:
TJH 2025-11-08 14:59:10 +08:00
parent 0104afaf3e
commit 755ec15182
10 changed files with 404 additions and 238 deletions

View File

@ -291,7 +291,7 @@ export class SlotGame extends Component {
changeIconAndFrameType(spinData: any) { changeIconAndFrameType(spinData: any) {
this.spinData = spinData; this.spinData = spinData;
// 先去找到PanChange当中是否有oldPos,如果没有代表当前icon没有动就去crossSymbols当中找 // 先去找到PanChange当中是否有oldPos,如果没有代表当前icon没有动就去CroSymbols当中找
// 初始化changeData数组 // 初始化changeData数组
let changeData = []; let changeData = [];
let colorChanges = this.spinData.PanChanges.CrossSymbolColorChange let colorChanges = this.spinData.PanChanges.CrossSymbolColorChange
@ -309,15 +309,15 @@ export class SlotGame extends Component {
if (this.spinData.PanChanges.CrossSymbolPosChange[key]) { if (this.spinData.PanChanges.CrossSymbolPosChange[key]) {
oldStartPos = this.spinData.PanChanges.CrossSymbolPosChange[key].OldPos[0]; oldStartPos = this.spinData.PanChanges.CrossSymbolPosChange[key].OldPos[0];
} }
// 如果没找到则在crossSymbols中查找 // 如果没找到则在CroSymbols中查找
else if (this.spinData.CrossSymbols[key]) { else if (this.spinData.CroSymbols[key]) {
oldStartPos = this.spinData.CrossSymbols[key].PosFirst; oldStartPos = this.spinData.CroSymbols[key].PosFirst;
} }
// 从crossSymbols获取frameType和height // 从CroSymbols获取frameType和height
if (this.spinData.CrossSymbols[key]) { if (this.spinData.CroSymbols[key]) {
let symbol = this.spinData.CrossSymbols[key]; let symbol = this.spinData.CroSymbols[key];
frameType = symbol.FrameType; frameType = symbol.Type;
height = symbol.PosLast - symbol.PosFirst + 1; height = symbol.PosLast - symbol.PosFirst + 1;
} }
@ -343,7 +343,7 @@ export class SlotGame extends Component {
// icon掉落的逻辑 // icon掉落的逻辑
iconFallDown() { iconFallDown() {
this.setWaysCount(this.spinData.WaysNum); this.setWaysCount(this.spinData.Symbol.WaysNum);
this.rollerManager.iconFallDown(this.spinData); this.rollerManager.iconFallDown(this.spinData);
} }
@ -357,7 +357,7 @@ export class SlotGame extends Component {
// 计算当前停止列之前的所有数字的乘积 // 计算当前停止列之前的所有数字的乘积
let totalWays = 1; let totalWays = 1;
for (let i = 0; i < rollerId; i++) { for (let i = 0; i < rollerId; i++) {
totalWays *= this.spinData.SymbolNumOfReels[i]; totalWays *= this.spinData.Symbol.ReelNum[i];
} }
let isExpect = this.rollerManager.checkNextRollerExpect(rollerId); let isExpect = this.rollerManager.checkNextRollerExpect(rollerId);
@ -377,7 +377,7 @@ export class SlotGame extends Component {
if (isExpect && !this.rollerManager.getIsFastSpin()) { if (isExpect && !this.rollerManager.getIsFastSpin()) {
this.hideScatterOnIsScroll(); this.hideScatterOnIsScroll();
} }
this.setWaysCount(this.spinData.WaysNum); this.setWaysCount(this.spinData.Symbol.WaysNum);
this.node.emit(SLOT_GAME_EVENT.ALL_ROLLER_STOP); this.node.emit(SLOT_GAME_EVENT.ALL_ROLLER_STOP);
} }

View File

@ -212,7 +212,7 @@ export class SlotScene extends Component {
} else { } else {
AudioManager.instance.playBGM("Normal_Mode_BGM"); 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.setMultiLabel(this.spinData.WinMultiPlier);
this.slotGame.setRollerIconRule(rollerIconRule); this.slotGame.setRollerIconRule(rollerIconRule);

View File

@ -73,7 +73,7 @@ export abstract class BaseRoller extends Component {
protected _content: Node = null; protected _content: Node = null;
protected _info: Info = new Info(); protected _info: Info = new Info();
protected _stopData: number[] = []; protected _stopData: number[] = [];
protected _crossSymbols: any = null; // 存储当前滚轮的n*1 Icon信息 protected _CroSymbols: any = null; // 存储当前滚轮的n*1 Icon信息
// 统一的图标管理结构 // 统一的图标管理结构
protected _allIcons: Map<string, Node> = new Map(); // 存储所有图标节点通过唯一key访问 protected _allIcons: Map<string, Node> = new Map(); // 存储所有图标节点通过唯一key访问
@ -175,7 +175,7 @@ export abstract class BaseRoller extends Component {
// 清空图标映射 // 清空图标映射
this._allIcons.clear(); this._allIcons.clear();
this._posToIconKey.clear(); this._posToIconKey.clear();
this._crossSymbols = null; this._CroSymbols = null;
if (!EDITOR) { if (!EDITOR) {
// 运行时初始化 // 运行时初始化
@ -188,13 +188,13 @@ export abstract class BaseRoller extends Component {
* *
* @param id ID * @param id ID
* @param data * @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.iconFactory.init();
this.initRoller(id); this.initRoller(id);
// 创建图标 // 创建图标
this._crossSymbols = crossSymbols; this._CroSymbols = CroSymbols;
this.createInitIcons(data); this.createInitIcons(data);
} }
@ -208,7 +208,7 @@ export abstract class BaseRoller extends Component {
this._posToIconKey.clear(); this._posToIconKey.clear();
// 先处理n*1 Icon // 先处理n*1 Icon
if (this._crossSymbols && Object.keys(this._crossSymbols).length > 0) { if (this._CroSymbols && Object.keys(this._CroSymbols).length > 0) {
// 创建n*1 Icon // 创建n*1 Icon
this.createSpecialIcons(); this.createSpecialIcons();
} }
@ -227,8 +227,8 @@ export abstract class BaseRoller extends Component {
// 直接使用已有的符号数据,避免重复处理 // 直接使用已有的符号数据,避免重复处理
let processedPoses = new Set<string>(); // 用于跟踪已处理的符号ID let processedPoses = new Set<string>(); // 用于跟踪已处理的符号ID
// 遍历所有位置的符号数据 // 遍历所有位置的符号数据
for (let pos in this._crossSymbols) { for (let pos in this._CroSymbols) {
let iconSpecialMsg = this._crossSymbols[pos]; let iconSpecialMsg = this._CroSymbols[pos];
// 如果这个符号ID已经处理过跳过 // 如果这个符号ID已经处理过跳过
if (processedPoses.has(iconSpecialMsg.id)) continue; if (processedPoses.has(iconSpecialMsg.id)) continue;
// 标记这个符号ID为已处理 // 标记这个符号ID为已处理
@ -251,7 +251,7 @@ export abstract class BaseRoller extends Component {
let endPos = iconSpecialMsg.endPos; let endPos = iconSpecialMsg.endPos;
let height = iconSpecialMsg.lHeight; let height = iconSpecialMsg.lHeight;
let iconIndex = iconSpecialMsg.iconIndex; let iconIndex = iconSpecialMsg.iconIndex;
let frameType = iconSpecialMsg.frameType; let frameType = iconSpecialMsg.Type;
// 生成图标ID // 生成图标ID
let iconKey = this.generateIconKey(startPos, height, endPos); let iconKey = this.generateIconKey(startPos, height, endPos);
// 创建图标节点 // 创建图标节点
@ -297,10 +297,10 @@ export abstract class BaseRoller extends Component {
/** /**
* n*1 Icon数据 * n*1 Icon数据
* @param crossSymbols n*1 Icon数据 * @param CroSymbols n*1 Icon数据
*/ */
setCrossSymbols(crossSymbols: any) { setCroSymbols(CroSymbols: any) {
this._crossSymbols = crossSymbols; this._CroSymbols = CroSymbols;
} }
/** /**
@ -647,5 +647,5 @@ export abstract class BaseRoller extends Component {
abstract createNewIconTop(createDatas: number[]): void; abstract createNewIconTop(createDatas: number[]): void;
abstract iconFallDown(data: number[], crossSymbols: any): void; abstract iconFallDown(data: number[], CroSymbols: any): void;
} }

View File

@ -175,12 +175,12 @@ export interface GameData {
// 当前下注 // 当前下注
Bet: number; Bet: number;
// 不规则图标信息 // 不规则图标信息
CrossSymbols: { CroSymbols: {
[key: string]: { [key: string]: {
FrameType: number; Type: number;
PosFirst: number; PosFirst: number;
PosLast: number; PosLast: number;
Color: number; Symbol: number;
} }
}; };
// 连线数 // 连线数
@ -194,9 +194,13 @@ export interface GameData {
// 中奖位置 // 中奖位置
WinPosition: any; WinPosition: any;
// 盘面信息 // 盘面信息
PanColor: { Symbol: {
Top: number[]; ScNum:number;
Bottom: number[]; winMulti:number;
WaysNum:number;
ReelNum:number[];
MultiValue:number[];
Middle: number[];
}; };
// 盘面变化 // 盘面变化
PanChanges: any; PanChanges: any;
@ -270,7 +274,7 @@ export let gameInfo: any = {
"Bet": 10000, "Bet": 10000,
"Balance": 0, "Balance": 0,
"WinMultiPlier": 1, "WinMultiPlier": 1,
"CrossSymbols": { "CroSymbols": {
"1": { "1": {
"FrameType": 1, "FrameType": 1,
"PosFirst": 5, "PosFirst": 5,
@ -402,7 +406,7 @@ export let winData: any = {
"Bet": 10000, //下注 "Bet": 10000, //下注
"Balance": 51602584500, //余额 "Balance": 51602584500, //余额
"WinMultiPlier": 6, //当前算分的倍率 界面显示的X6倍 "WinMultiPlier": 6, //当前算分的倍率 界面显示的X6倍
"CrossSymbols": {//跨行的符号集 "CroSymbols": {//跨行的符号集
"1": { "1": {
"FrameType": 0, //0:普通框 1:银框 2:金框 3:百搭框 "FrameType": 0, //0:普通框 1:银框 2:金框 3:百搭框
"PosFirst": 6, "PosFirst": 6,
@ -543,12 +547,12 @@ export let winData: any = {
"PosLast": 3, "PosLast": 3,
},//crossSymbol的结束位置 },//crossSymbol的结束位置
"CrossSymbolPosChange": {//crossSymbol符号的位置发生了变化 "CrossSymbolPosChange": {//crossSymbol符号的位置发生了变化
"1": { //1的key对应于CrossSymbols字段中的key "1": { //1的key对应于CroSymbols字段中的key
"OldPos": [//CrossSymbols的变化之前的位置 "OldPos": [//CroSymbols的变化之前的位置
5, 5,
6 6
], ],
"NewPos": [//CrossSymbols的变化之后的位置 "NewPos": [//CroSymbols的变化之后的位置
6, 6,
7 7
] ]
@ -614,7 +618,7 @@ export let winTestData = {
"Balance": 512890548700, "Balance": 512890548700,
"IsFree": true, "IsFree": true,
"WinMultiPlier": 6, "WinMultiPlier": 6,
"CrossSymbols": { "CroSymbols": {
"1": { "1": {
"FrameType": 0, "FrameType": 0,
"PosFirst": 7, "PosFirst": 7,

View File

@ -667,11 +667,11 @@ export class HRoller extends BaseRoller {
/** icon进行掉落移动 */ /** icon进行掉落移动 */
iconFallDown(data: number[], crossSymbols: any) { iconFallDown(data: number[], CroSymbols: any) {
// 更新所有icon的iconKey和posToIconKey // 更新所有icon的iconKey和posToIconKey
let updates = []; let updates = [];
let sortNewIconStartPos = this.getNewIconsStartPos(data, crossSymbols); let sortNewIconStartPos = this.getNewIconsStartPos(data, CroSymbols);
let sortIcons = this.getSortIcons(); let sortIcons = this.getSortIcons();
for (let i = 0; i < sortNewIconStartPos.length; i++) { for (let i = 0; i < sortNewIconStartPos.length; i++) {
let newStartPos = sortNewIconStartPos[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 // 存储所有图标的startPos
let startPositions: number[] = []; let startPositions: number[] = [];
@ -764,12 +764,12 @@ export class HRoller extends BaseRoller {
// 记录已经处理的pos // 记录已经处理的pos
let processedPos = new Set<number>(); let processedPos = new Set<number>();
// 首先处理不规则图标n*1图标 // 首先处理不规则图标n*1图标
if (crossSymbols) { if (CroSymbols) {
for (let pos in crossSymbols) { for (let pos in CroSymbols) {
let id = crossSymbols[pos].id; let id = CroSymbols[pos].id;
if (processedPos.has(id)) continue; if (processedPos.has(id)) continue;
processedPos.add(id); processedPos.add(id);
let iconSpecialMsg = crossSymbols[pos]; let iconSpecialMsg = CroSymbols[pos];
let startPos = iconSpecialMsg.startPos; let startPos = iconSpecialMsg.startPos;
let endPos = iconSpecialMsg.endPos; let endPos = iconSpecialMsg.endPos;

View File

@ -280,7 +280,7 @@ export class HistoryDetail extends Component {
// 每一竖列最多有5个symbol // 每一竖列最多有5个symbol
const EACH_LINE_MAX_SYMBOL = 5 const EACH_LINE_MAX_SYMBOL = 5
let curSymbolIdx = pan.CrossSymbols[curCrossIdx]?.PosFirst let curSymbolIdx = pan.CroSymbols[curCrossIdx]?.PosFirst
// console.log(`curCrossIdx=${curCrossIdx}`) // console.log(`curCrossIdx=${curCrossIdx}`)
// console.log(`curSymbolIdx=${curSymbolIdx}`) // console.log(`curSymbolIdx=${curSymbolIdx}`)
@ -321,13 +321,13 @@ export class HistoryDetail extends Component {
i++ i++
} else { } else {
// console.log(`当前处理到CrossSymbols ,curCrossIdx=${curCrossIdx}`) // console.log(`当前处理到CroSymbols ,curCrossIdx=${curCrossIdx}`)
// console.log(`遇到了连体元素i=${i},curSymbolIdx = ${curSymbolIdx}`) // console.log(`遇到了连体元素i=${i},curSymbolIdx = ${curSymbolIdx}`)
const item_symbol = instantiate(this.item_symbol) const item_symbol = instantiate(this.item_symbol)
let v = pan.PanColor.Bottom[i] 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}连框`) // console.log(`${length}连框`)
@ -356,9 +356,9 @@ export class HistoryDetail extends Component {
const path_symbol = `symbol_${v}_x1` const path_symbol = `symbol_${v}_x1`
symbol.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_symbol) symbol.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_symbol)
// pan.CrossSymbols?.curCrossIdx?.FrameType // pan.CroSymbols?.curCrossIdx?.Type
const frame = item_symbol.getChildByName("frame").getComponent(Sprite) 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) frame.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_frame)
let height = frame.node.getComponent(UITransform).height * length; let height = frame.node.getComponent(UITransform).height * length;
@ -378,7 +378,7 @@ export class HistoryDetail extends Component {
vert_symbols.children[line].addChild(item_symbol) vert_symbols.children[line].addChild(item_symbol)
curCrossIdx += 1 curCrossIdx += 1
curSymbolIdx = pan.CrossSymbols[curCrossIdx]?.PosFirst curSymbolIdx = pan.CroSymbols[curCrossIdx]?.PosFirst
// 连体symbol的数据视为一个 // 连体symbol的数据视为一个
i = i + length i = i + length

View File

@ -259,12 +259,12 @@ export class Roller extends BaseRoller {
// 从上到下依次创建图标从位置0开始 // 从上到下依次创建图标从位置0开始
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
// 检查当前位置是否需要创建特殊图标n*1图标 // 检查当前位置是否需要创建特殊图标n*1图标
if (this._crossSymbols && this._crossSymbols[i]) { if (this._CroSymbols && this._CroSymbols[i]) {
let iconSpecialMsg = this._crossSymbols[i]; let iconSpecialMsg = this._CroSymbols[i];
// 检查这个特殊图标是否已经被处理过 // 检查这个特殊图标是否已经被处理过
let isProcessed = false; let isProcessed = false;
for (let j = 0; j < i; j++) { 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; isProcessed = true;
break; break;
} }
@ -276,7 +276,7 @@ export class Roller extends BaseRoller {
let endPos = iconSpecialMsg.endPos; let endPos = iconSpecialMsg.endPos;
let height = iconSpecialMsg.lHeight; let height = iconSpecialMsg.lHeight;
let iconIndex = iconSpecialMsg.iconIndex; let iconIndex = iconSpecialMsg.iconIndex;
let frameType = iconSpecialMsg.frameType; let frameType = iconSpecialMsg.Type;
// 生成图标ID // 生成图标ID
let iconKey = this.generateIconKey(startPos, height, endPos); let iconKey = this.generateIconKey(startPos, height, endPos);
@ -783,9 +783,9 @@ export class Roller extends BaseRoller {
/** icon进行掉落移动 */ /** icon进行掉落移动 */
iconFallDown(data: number[], crossSymbols: any) { iconFallDown(data: number[], CroSymbols: any) {
let updates = []; let updates = [];
let sortNewIconStartPos = this.getNewIconsStartPos(data, crossSymbols); let sortNewIconStartPos = this.getNewIconsStartPos(data, CroSymbols);
let sortIcons = this.getSortIcons(); let sortIcons = this.getSortIcons();
for (let i = 0; i < sortNewIconStartPos.length; i++) { for (let i = 0; i < sortNewIconStartPos.length; i++) {
let newStartPos = sortNewIconStartPos[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 // 存储所有图标的startPos
let startPositions: number[] = []; let startPositions: number[] = [];
@ -901,12 +901,12 @@ export class Roller extends BaseRoller {
// 记录已经处理的pos // 记录已经处理的pos
let processedPos = new Set<number>(); let processedPos = new Set<number>();
// 首先处理不规则图标n*1图标 // 首先处理不规则图标n*1图标
if (crossSymbols) { if (CroSymbols) {
for (let pos in crossSymbols) { for (let pos in CroSymbols) {
let id = crossSymbols[pos].id; let id = CroSymbols[pos].id;
if (processedPos.has(id)) continue; if (processedPos.has(id)) continue;
processedPos.add(id); processedPos.add(id);
let iconSpecialMsg = crossSymbols[pos]; let iconSpecialMsg = CroSymbols[pos];
let startPos = iconSpecialMsg.startPos; let startPos = iconSpecialMsg.startPos;
let endPos = iconSpecialMsg.endPos; let endPos = iconSpecialMsg.endPos;

View File

@ -30,7 +30,7 @@ export class RollerManager extends Component {
vMaskSpriteFrame: SpriteFrame = null; vMaskSpriteFrame: SpriteFrame = null;
rollerMsg: any[] = [ 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 }, { 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; _isFreeSpin: boolean = false;
// 不规则图标信息 // 不规则图标信息
_crossSymbols: any = null; _CroSymbols: any = null;
// 处理过的不规则icon信息 // 处理过的不规则icon信息
_processedCrossSymbols: any = null; _processedCroSymbols: any = null;
private hMaskNode: Node = null; private hMaskNode: Node = null;
private vMaskNode: Node = null; private vMaskNode: Node = null;
@ -92,29 +92,29 @@ export class RollerManager extends Component {
for (let i = 0; i < rollerLength; i++) { for (let i = 0; i < rollerLength; i++) {
let rollerMsg = this.rollerMsg[i]; let rollerMsg = this.rollerMsg[i];
if (rollerMsg.isHorizontal) { // if (rollerMsg.isHorizontal) {
let hRoller = HRoller.create(i, rollerMsg.col, this.iconWidth, this.iconHeight, this.iconFactory); // let hRoller = HRoller.create(i, rollerMsg.col, this.iconWidth, this.iconHeight, this.iconFactory);
hRoller.format = true; // hRoller.format = true;
this.hMaskNode.addChild(hRoller.node); // this.hMaskNode.addChild(hRoller.node);
let rollerPosition = new Vec3(0, 3 * this.iconHeight + 43, 0); // let rollerPosition = new Vec3(0, 3 * this.iconHeight + 43, 0);
this.hMaskNode.setPosition(rollerPosition); // this.hMaskNode.setPosition(rollerPosition);
// hRoller.node.setPosition(rollerPosition); // // hRoller.node.setPosition(rollerPosition);
// 保存引用 // // 保存引用
this.hRollers.push(hRoller); // this.hRollers.push(hRoller);
this.allRollers.push(hRoller); // this.allRollers.push(hRoller);
} else { // } else {
let roller = Roller.create(i, rollerMsg.row, this.iconWidth, this.iconHeight, this.iconFactory); let roller = Roller.create(i, rollerMsg.row, this.iconWidth, this.iconHeight, this.iconFactory);
roller.format = true; roller.format = true;
this.vMaskNode.addChild(roller.node); this.vMaskNode.addChild(roller.node);
let rollerPosition = this.getRollerPosition(i - 1); let rollerPosition = this.getRollerPosition(i);
roller.node.setPosition(rollerPosition); roller.node.setPosition(rollerPosition);
this.vRollers.push(roller); this.vRollers.push(roller);
this.allRollers.push(roller); this.allRollers.push(roller);
} // }
} }
} }
@ -211,8 +211,8 @@ export class RollerManager extends Component {
} }
if (nextStopRollerId != -1) { if (nextStopRollerId != -1) {
let nextStopRollerCrossSymbols = this._processedCrossSymbols[nextStopRollerId]; let nextStopRollerCroSymbols = this._processedCroSymbols[nextStopRollerId];
this.allRollers[nextStopRollerId].setCrossSymbols(nextStopRollerCrossSymbols); this.allRollers[nextStopRollerId].setCroSymbols(nextStopRollerCroSymbols);
this.allRollers[nextStopRollerId].stopScroll(this._resultStopData[nextStopRollerId], stopSpeedData); this.allRollers[nextStopRollerId].stopScroll(this._resultStopData[nextStopRollerId], stopSpeedData);
} }
return; return;
@ -239,11 +239,11 @@ export class RollerManager extends Component {
// 检查每个位置 // 检查每个位置
for (let j = 0; j < rollerData.length; j++) { for (let j = 0; j < rollerData.length; j++) {
// 检查是否有交叉符号覆盖该位置 // 检查是否有交叉符号覆盖该位置
if (this._processedCrossSymbols && if (this._processedCroSymbols &&
this._processedCrossSymbols[i] && this._processedCroSymbols[i] &&
this._processedCrossSymbols[i][j]) { this._processedCroSymbols[i][j]) {
const symbolInfo = this._processedCrossSymbols[i][j]; const symbolInfo = this._processedCroSymbols[i][j];
// 只计算开始位置,避免重复计数 // 只计算开始位置,避免重复计数
if (symbolInfo.isStart && symbolInfo.iconIndex === 1) { if (symbolInfo.isStart && symbolInfo.iconIndex === 1) {
@ -379,18 +379,18 @@ export class RollerManager extends Component {
initRollerWithIcon(data: GameData) { initRollerWithIcon(data: GameData) {
this._spinData = data; this._spinData = data;
let topData = data.PanColor.Top; // let topData = data.PanColor.Top;
let bottomData = data.PanColor.Bottom; let bottomData = data.Symbol.Middle;
this._crossSymbols = data.CrossSymbols; 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符号 // 处理n*1符号
let processedCrossSymbols = this.processCrossSymbolsForRollers(); let processedCroSymbols = this.processCroSymbolsForRollers();
for (let i = 0; i < this.allRollers.length; i++) { for (let i = 0; i < this.allRollers.length; i++) {
let roller = this.allRollers[i]; let roller = this.allRollers[i];
let rollerCrossSymbols = processedCrossSymbols[i]; let rollerCroSymbols = processedCroSymbols[i];
roller.initRollerWithIcon(i, this._resultStopData[i], rollerCrossSymbols); roller.initRollerWithIcon(i, this._resultStopData[i], rollerCroSymbols);
} }
} }
@ -399,12 +399,12 @@ export class RollerManager extends Component {
* n*1n*1 * n*1n*1
* @returns n*1 * @returns n*1
*/ */
private processCrossSymbolsForRollers(): any[] { private processCroSymbolsForRollers(): any[] {
this._processedCrossSymbols = []; this._processedCroSymbols = [];
let row = 5; let row = 5;
let col = 6; let col = 6;
// 如果没有交叉符号数据,返回空对象数组 // 如果没有交叉符号数据,返回空对象数组
if (!this._crossSymbols) { if (!this._CroSymbols) {
return new Array(col).fill({}); return new Array(col).fill({});
} }
@ -415,8 +415,8 @@ export class RollerManager extends Component {
} }
// 遍历所有交叉符号 // 遍历所有交叉符号
for (let symbolId in this._crossSymbols) { for (let symbolId in this._CroSymbols) {
let symbol = this._crossSymbols[symbolId]; let symbol = this._CroSymbols[symbolId];
// 计算符号所在的滚轮索引 // 计算符号所在的滚轮索引
let rollerIndex = Math.floor(symbol.PosFirst / 5); let rollerIndex = Math.floor(symbol.PosFirst / 5);
@ -433,13 +433,14 @@ export class RollerManager extends Component {
startPos: startPos, startPos: startPos,
endPos: endPos, endPos: endPos,
lHeight: endPos - startPos + 1, lHeight: endPos - startPos + 1,
frameType: symbol.FrameType, frameType: symbol.Type,
iconIndex: symbol.Color iconIndex: symbol.Symbol
}; };
} }
} }
this._processedCrossSymbols = [{}, ...rollerSymbols]; this._processedCroSymbols = [...rollerSymbols];
return this._processedCrossSymbols; console.log(this._processedCroSymbols)
return this._processedCroSymbols;
} }
// 滚轮Icon生成规则 // 滚轮Icon生成规则
@ -537,45 +538,44 @@ export class RollerManager extends Component {
this._resultStopData = []; 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 // 处理不对则icon
this._crossSymbols = data.CrossSymbols; this._CroSymbols = data.CroSymbols;
let processedCrossSymbols = this.processCrossSymbolsForRollers(); let processedCroSymbols = this.processCroSymbolsForRollers();
let stopSpeedData = this._isFastSpin ? [[0, 6000]] : [[0.1, 3500]]; let stopSpeedData = this._isFastSpin ? [[0, 6000]] : [[0.1, 3500]];
if (this._isFastSpin) { if (this._isFastSpin) {
// this.stopAllRollersImmediately(processedCrossSymbols); // this.stopAllRollersImmediately(processedCroSymbols);
for (let i = 0; i < this.allRollers.length; i++) { for (let i = 0; i < this.allRollers.length; i++) {
let stopData = this._resultStopData[i]; let stopData = this._resultStopData[i];
let roller = this.allRollers[i]; let roller = this.allRollers[i];
let rollerCrossSymbols = processedCrossSymbols[i]; let rollerCroSymbols = processedCroSymbols[i];
roller.setCrossSymbols(rollerCrossSymbols); roller.setCroSymbols(rollerCroSymbols);
roller.stopScroll(stopData, stopSpeedData) roller.stopScroll(stopData, stopSpeedData)
} }
} else { } else {
// this.stopRollersInSequence(processedCrossSymbols); // this.stopRollersInSequence(processedCroSymbols);
let firstRollerCrossSymbols = processedCrossSymbols[0]; let firstRollerCroSymbols = processedCroSymbols[0];
this.allRollers[0].setCrossSymbols(firstRollerCrossSymbols); this.allRollers[0].setCroSymbols(firstRollerCroSymbols);
this.allRollers[0].stopScroll(this._resultStopData[0], stopSpeedData); this.allRollers[0].stopScroll(this._resultStopData[0], stopSpeedData);
} }
} }
stopRollersInSequence(processedCrossSymbols: any[]) { stopRollersInSequence(processedCroSymbols: any[]) {
let standardStopDuration = [[0.1, 3500]]; let standardStopDuration = [[0.1, 3500]];
} }
manualStop(data: GameData) { manualStop(data: GameData) {
this._isManualStop = true; this._isManualStop = true;
this._resultStopData = []; this._resultStopData = [];
let topData = data.PanColor.Top; this._resultStopData = [...this.splitArray(data.Symbol.Middle, [5, 5, 5, 5, 5, 5])];
this._resultStopData = [topData, ...this.splitArray(data.PanColor.Bottom, [5, 5, 5, 5, 5, 5])]; this._CroSymbols = data.CroSymbols;
this._crossSymbols = data.CrossSymbols; let processedCroSymbols = this.processCroSymbolsForRollers();
let processedCrossSymbols = this.processCrossSymbolsForRollers();
for (let i = 0; i < this.allRollers.length; i++) { for (let i = 0; i < this.allRollers.length; i++) {
let stopData = this._resultStopData[i]; let stopData = this._resultStopData[i];
let roller = this.allRollers[i]; let roller = this.allRollers[i];
let rollerCrossSymbols = processedCrossSymbols[i]; let rollerCroSymbols = processedCroSymbols[i];
roller.setCrossSymbols(rollerCrossSymbols); roller.setCroSymbols(rollerCroSymbols);
roller.manualStopScroll(stopData) roller.manualStopScroll(stopData)
} }
} }
@ -814,17 +814,17 @@ export class RollerManager extends Component {
this._fallenRollerCount = 0; // 重置计数器 this._fallenRollerCount = 0; // 重置计数器
this._deletedRollerCount = 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 // 处理不对则icon
this._crossSymbols = data.CrossSymbols; this._CroSymbols = data.CroSymbols;
let processedCrossSymbols = this.processCrossSymbolsForRollers(); let processedCroSymbols = this.processCroSymbolsForRollers();
this.allRollers.forEach((roller, index) => { this.allRollers.forEach((roller, index) => {
let stopData = this._resultStopData[index]; let stopData = this._resultStopData[index];
let rollerCrossSymbols = processedCrossSymbols[index]; let rollerCroSymbols = processedCroSymbols[index];
roller.setCrossSymbols(rollerCrossSymbols); roller.setCroSymbols(rollerCroSymbols);
this.scheduleOnce(() => { this.scheduleOnce(() => {
roller.iconFallDown(stopData, rollerCrossSymbols) roller.iconFallDown(stopData, rollerCroSymbols)
}, 0.03 * index) }, 0.03 * index)
}) })

View File

@ -23,7 +23,7 @@
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 76 "__id__": 79
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -54,7 +54,7 @@
}, },
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 77 "__id__": 80
}, },
"_id": "6c29a3fe-b10e-44a5-98e3-55595b231767" "_id": "6c29a3fe-b10e-44a5-98e3-55595b231767"
}, },
@ -77,25 +77,25 @@
"__id__": 8 "__id__": 8
}, },
{ {
"__id__": 54 "__id__": 57
}, },
{ {
"__id__": 57 "__id__": 60
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 72
},
{
"__id__": 73
},
{
"__id__": 74
},
{ {
"__id__": 75 "__id__": 75
},
{
"__id__": 76
},
{
"__id__": 77
},
{
"__id__": 78
} }
], ],
"_prefab": null, "_prefab": null,
@ -341,22 +341,22 @@
"__id__": 9 "__id__": 9
}, },
{ {
"__id__": 47 "__id__": 50
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 50
},
{
"__id__": 51
},
{
"__id__": 52
},
{ {
"__id__": 53 "__id__": 53
},
{
"__id__": 54
},
{
"__id__": 55
},
{
"__id__": 56
} }
], ],
"_prefab": null, "_prefab": null,
@ -418,15 +418,18 @@
}, },
{ {
"__id__": 37 "__id__": 37
},
{
"__id__": 40
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 45 "__id__": 48
}, },
{ {
"__id__": 46 "__id__": 49
} }
], ],
"_prefab": null, "_prefab": null,
@ -1313,7 +1316,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Loading", "_name": "loadingLabel",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
@ -1443,6 +1446,138 @@
"_shadowBlur": 2, "_shadowBlur": 2,
"_id": "2380yWt0tOa6GJutBEnRsb" "_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", "__type__": "cc.Node",
"_name": "Btn", "_name": "Btn",
@ -1453,19 +1588,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 38 "__id__": 41
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 41 "__id__": 44
}, },
{ {
"__id__": 42 "__id__": 45
}, },
{ {
"__id__": 43 "__id__": 46
} }
], ],
"_prefab": null, "_prefab": null,
@ -1504,16 +1639,16 @@
"_objFlags": 512, "_objFlags": 512,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 37 "__id__": 40
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 39 "__id__": 42
}, },
{ {
"__id__": 40 "__id__": 43
} }
], ],
"_prefab": null, "_prefab": null,
@ -1552,7 +1687,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 38 "__id__": 41
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -1574,7 +1709,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 38 "__id__": 41
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -1636,7 +1771,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 37 "__id__": 40
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -1658,7 +1793,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 37 "__id__": 40
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -1697,13 +1832,13 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 37 "__id__": 40
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"clickEvents": [ "clickEvents": [
{ {
"__id__": 44 "__id__": 47
} }
], ],
"_interactable": true, "_interactable": true,
@ -1755,7 +1890,7 @@
"_duration": 0.1, "_duration": 0.1,
"_zoomScale": 1.2, "_zoomScale": 1.2,
"_target": { "_target": {
"__id__": 37 "__id__": 40
}, },
"_id": "54j4lwPyZHbqqANZE+r9Tj" "_id": "54j4lwPyZHbqqANZE+r9Tj"
}, },
@ -1833,10 +1968,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 48 "__id__": 51
}, },
{ {
"__id__": 49 "__id__": 52
} }
], ],
"_prefab": null, "_prefab": null,
@ -1875,7 +2010,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 47 "__id__": 50
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -1897,7 +2032,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 47 "__id__": 50
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2041,10 +2176,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 55 "__id__": 58
}, },
{ {
"__id__": 56 "__id__": 59
} }
], ],
"_prefab": null, "_prefab": null,
@ -2083,7 +2218,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 54 "__id__": 57
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2105,7 +2240,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 54 "__id__": 57
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2148,22 +2283,22 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 58 "__id__": 61
}, },
{ {
"__id__": 62 "__id__": 65
}, },
{ {
"__id__": 67 "__id__": 70
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 70 "__id__": 73
}, },
{ {
"__id__": 71 "__id__": 74
} }
], ],
"_prefab": null, "_prefab": null,
@ -2202,19 +2337,19 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 57 "__id__": 60
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 59 "__id__": 62
}, },
{ {
"__id__": 60 "__id__": 63
}, },
{ {
"__id__": 61 "__id__": 64
} }
], ],
"_prefab": null, "_prefab": null,
@ -2253,7 +2388,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 58 "__id__": 61
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2275,7 +2410,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 58 "__id__": 61
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2287,7 +2422,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 58 "__id__": 61
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2326,22 +2461,22 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 57 "__id__": 60
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 63
},
{
"__id__": 64
},
{
"__id__": 65
},
{ {
"__id__": 66 "__id__": 66
},
{
"__id__": 67
},
{
"__id__": 68
},
{
"__id__": 69
} }
], ],
"_prefab": null, "_prefab": null,
@ -2380,7 +2515,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 62 "__id__": 65
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2402,7 +2537,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 62 "__id__": 65
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2464,7 +2599,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 62 "__id__": 65
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2477,7 +2612,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 62 "__id__": 65
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2507,16 +2642,16 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 57 "__id__": 60
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 68 "__id__": 71
}, },
{ {
"__id__": 69 "__id__": 72
} }
], ],
"_prefab": null, "_prefab": null,
@ -2555,7 +2690,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 67 "__id__": 70
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2577,7 +2712,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 67 "__id__": 70
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2616,7 +2751,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 57 "__id__": 60
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2638,7 +2773,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 57 "__id__": 60
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -2722,17 +2857,20 @@
"progressLabel": { "progressLabel": {
"__id__": 33 "__id__": 33
}, },
"tipLabel": { "loadingTipLabel": {
"__id__": 36 "__id__": 36
}, },
"retryTipLabel": {
"__id__": 39
},
"startBtn": { "startBtn": {
"__id__": 43 "__id__": 46
}, },
"startBtnLabel": { "startBtnLabel": {
"__id__": 40 "__id__": 43
}, },
"GameNode": { "GameNode": {
"__id__": 47 "__id__": 50
}, },
"languageJson": { "languageJson": {
"__uuid__": "65d2a408-9396-47e4-99de-73423a590b7f", "__uuid__": "65d2a408-9396-47e4-99de-73423a590b7f",
@ -2754,10 +2892,10 @@
"__id__": 5 "__id__": 5
}, },
"Logo": { "Logo": {
"__id__": 54 "__id__": 57
}, },
"rotateNode": { "rotateNode": {
"__id__": 57 "__id__": 60
}, },
"_id": "d8F/UwpTxNpZhwSJjDvnkk" "_id": "d8F/UwpTxNpZhwSJjDvnkk"
}, },
@ -2772,29 +2910,29 @@
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.SceneGlobals",
"ambient": { "ambient": {
"__id__": 78
},
"shadows": {
"__id__": 79
},
"_skybox": {
"__id__": 80
},
"fog": {
"__id__": 81 "__id__": 81
}, },
"octree": { "shadows": {
"__id__": 82 "__id__": 82
}, },
"skin": { "_skybox": {
"__id__": 83 "__id__": 83
}, },
"lightProbeInfo": { "fog": {
"__id__": 84 "__id__": 84
}, },
"postSettings": { "octree": {
"__id__": 85 "__id__": 85
}, },
"skin": {
"__id__": 86
},
"lightProbeInfo": {
"__id__": 87
},
"postSettings": {
"__id__": 88
},
"bakedWithStationaryMainLight": false, "bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false "bakedWithHighpLightmap": false
}, },

View File

@ -25,7 +25,10 @@ export class LoadingUI extends Component {
progressLabel: Label = null; progressLabel: Label = null;
@property(Label) @property(Label)
tipLabel: Label = null; loadingTipLabel: Label = null;
@property(Label)
retryTipLabel: Label = null;
@property(Button) @property(Button)
startBtn: Button = null; startBtn: Button = null;
@ -41,7 +44,7 @@ export class LoadingUI extends Component {
private _networkComplete = false; private _networkComplete = false;
private _retryCount = 0; private _retryCount = 0;
private readonly MAX_RETRY = 3; private readonly MAX_RETRY = 5;
private INITIAL_PROGRESS = 0.3; private INITIAL_PROGRESS = 0.3;
private _instanceGameNode = null; private _instanceGameNode = null;
@ -95,8 +98,8 @@ export class LoadingUI extends Component {
try { try {
// 更新进度条到 0.6 // 更新进度条到 0.6
this.updateProgress(0.6); this.updateProgress(0.6);
this.loadingTipLabel.string = I18nManager.instance.t('AID_LOADING');
this.tipLabel.string = I18nManager.instance.t("AID_LOADING"); this.retryTipLabel.string = '';
let gameInfo = await callGameApi("gameinfo", {}); let gameInfo = await callGameApi("gameinfo", {});
if (!gameInfo) throw new Error('Get game info failed'); if (!gameInfo) throw new Error('Get game info failed');
GameDataManager.instance.gameInfo = gameInfo; GameDataManager.instance.gameInfo = gameInfo;
@ -125,7 +128,8 @@ export class LoadingUI extends Component {
private async startLoadingGameBundle() { private async startLoadingGameBundle() {
try { try {
// 显示加载UI // 显示加载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; this.startBtn.node.active = false;
// 从 0.8 开始加载 // 从 0.8 开始加载
@ -171,9 +175,10 @@ export class LoadingUI extends Component {
// 开始游戏 // 开始游戏
// AudioManager.instance.playBGM('Normal_Mode_BGM'); // AudioManager.instance.playBGM('Normal_Mode_BGM');
this.scheduleOnce(() => { this.scheduleOnce(() => {
this.tipLabel.string = ''; this.loadingTipLabel.string = '';
this.retryTipLabel.string = '';
this.startBtn.node.active = true; 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.progressBar.node.active = false;
this.progressLabel.node.active = false; this.progressLabel.node.active = false;
@ -184,9 +189,27 @@ export class LoadingUI extends Component {
private handleError(error: Error) { private handleError(error: Error) {
this._retryCount++; this._retryCount++;
this.loadingTipLabel.string = '';
if (this._retryCount <= this.MAX_RETRY) { 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(() => { this.scheduleOnce(() => {
if (!this._networkComplete) { if (!this._networkComplete) {
this.initNetwork(); this.initNetwork();
@ -196,7 +219,8 @@ export class LoadingUI extends Component {
}, 2); }, 2);
} else { } 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.startBtn.node.active = true;
this.progressBar.node.active = false; this.progressBar.node.active = false;
this.progressLabel.node.active = false; this.progressLabel.node.active = false;
@ -205,12 +229,12 @@ export class LoadingUI extends Component {
this.maskUITransform.node.active = false; this.maskUITransform.node.active = false;
this.lightNode.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() { 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._retryCount = 0;
this.startBtn.node.active = false; this.startBtn.node.active = false;