可以消除

This commit is contained in:
TJH 2025-11-20 16:35:53 +08:00
parent a11d5df8e0
commit 174dca549a
6 changed files with 48 additions and 42 deletions

View File

@ -268,14 +268,22 @@ export class SlotGame extends Component {
// 消除完整的逻辑 // 消除完整的逻辑
deleteIconNode() { deleteIconNode() {
//需要消除的位置
let deleteMsg = []; let deleteMsg = [];
let bottomData = this.spinData.WinPosition.BottomNormal.map(pos => pos + 4); //金变百搭的位置
deleteMsg = [...bottomData]; let specialIcons = [];
let specialIcons = [...this.spinData.WinPosition.BottomSilver, ...this.spinData.WinPosition.BottomGold]; let Desc = this.spinData.WinInfo.Desc
let aniData = specialIcons.map(pos => pos + 4) || []; for (let WinId in Desc) {
deleteMsg.push(...Desc[WinId].Middle)
if (Desc[WinId].Transform) {
specialIcons.push(...Desc[WinId].Transform);
}
}
this.rollerManager.handleWinIcons(this.winLayer, deleteMsg, aniData); deleteMsg = deleteMsg.filter(item => specialIcons.indexOf(item) === -1);
console.log('deleteMsg', deleteMsg)
this.rollerManager.handleWinIcons(this.winLayer, deleteMsg, specialIcons || []);
} }
handleScatter(isRollerScrolling: boolean,) { handleScatter(isRollerScrolling: boolean,) {
@ -293,20 +301,20 @@ export class SlotGame extends Component {
// 先去找到PanChange当中是否有oldPos,如果没有代表当前icon没有动就去CroSymbols当中找 // 先去找到PanChange当中是否有oldPos,如果没有代表当前icon没有动就去CroSymbols当中找
// 初始化changeData数组 // 初始化changeData数组
let changeData = []; let changeData = [];
let colorChanges = this.spinData.PanChanges.CrossSymbolColorChange // let colorChanges = this.spinData.PanChanges.CrossSymbolColorChange
// 遍历CrossSymbolColorChange获取颜色变化信息 // 遍历CrossSymbolColorChange获取颜色变化信息
for (let key in this.spinData.PanChanges.CrossSymbolColorChange) { for (let key in this.spinData.Change.Details) {
let colorChange = this.spinData.PanChanges.CrossSymbolColorChange[key]; // let colorChange = this.spinData.PanChanges.CrossSymbolColorChange[key];
let newIndex = colorChange.NewColor; let newIndex = 0;
let oldStartPos; let oldStartPos;
let frameType; let frameType;
let height; let height;
// 先在CrossSymbolPosChange中查找位置变化 // 先在CrossSymbolPosChange中查找位置变化
if (this.spinData.PanChanges.CrossSymbolPosChange[key]) { if (this.spinData.Change.Details[key]) {
oldStartPos = this.spinData.PanChanges.CrossSymbolPosChange[key].OldPos[0]; oldStartPos = this.spinData.Change.Details[key].Pos.Old[0];
} }
// 如果没找到则在CroSymbols中查找 // 如果没找到则在CroSymbols中查找
else if (this.spinData.CroSymbols[key]) { else if (this.spinData.CroSymbols[key]) {
@ -322,7 +330,7 @@ export class SlotGame extends Component {
// 添加到changeData数组 // 添加到changeData数组
changeData.push({ changeData.push({
oldStartPos: oldStartPos + 4, oldStartPos: oldStartPos,
newIndex: newIndex, newIndex: newIndex,
newFrameType: frameType, newFrameType: frameType,
lheight: height lheight: height
@ -335,9 +343,8 @@ export class SlotGame extends Component {
// 消除创建的逻辑 // 消除创建的逻辑
createNewIconTop(spinData: any) { createNewIconTop(spinData: any) {
this.spinData = spinData; this.spinData = spinData;
let createDatas = this.spinData.PanChanges.TopNewSymbols; let createDatas = this.spinData.Change.Middle;
let createDatas2 = this.spinData.PanChanges.BottomNewSymbols; this.rollerManager.createNewIconTop([...createDatas]);
this.rollerManager.createNewIconTop([createDatas, ...createDatas2]);
} }
// icon掉落的逻辑 // icon掉落的逻辑

View File

@ -231,7 +231,7 @@ export class SlotScene extends Component {
goNextReconnect(isTwice: boolean) { goNextReconnect(isTwice: boolean) {
if (isTwice) return; if (isTwice) return;
// 当前盘面有分数,有消除,则播放消除动画 // 当前盘面有分数,有消除,则播放消除动画
if (this.spinData.Score != 0 && this.spinData.WinPosition != null) { if (this.spinData.AllScore != 0 && this.spinData.WinInfo != null) {
this.slotGame.deleteIconNode(); this.slotGame.deleteIconNode();
this.playElemWinAnimation(); this.playElemWinAnimation();
} else { } else {
@ -679,9 +679,9 @@ export class SlotScene extends Component {
} }
checkHasEliminate() { checkHasEliminate() {
this.gameState.isEliminating = this.spinData.WinPosition != null; // 重置消除状态 this.gameState.isEliminating = this.spinData.WinInfo != null; // 重置消除状态
this.slotGame.setIsEliminating(this.gameState.isEliminating); // 传递给 SlotGame this.slotGame.setIsEliminating(this.gameState.isEliminating); // 传递给 SlotGame
return this.spinData.WinPosition != null; return this.spinData.WinInfo != null;
} }
checkHasMoreScatter() { checkHasMoreScatter() {

View File

@ -248,28 +248,28 @@ export class HistoryDetail extends Component {
// 顶上四个横着摆的 // 顶上四个横着摆的
const hor_symbols = content.getChildByName("hor_symbols") const hor_symbols = content.getChildByName("hor_symbols")
hor_symbols.destroyAllChildren() hor_symbols.destroyAllChildren()
pan.PanColor.Top.forEach((v, i) => { // pan.PanColor.Top.forEach((v, i) => {
const item_symbol = instantiate(this.item_symbol) // const item_symbol = instantiate(this.item_symbol)
const bg = item_symbol.getChildByName("bg").getComponent(Sprite) // const bg = item_symbol.getChildByName("bg").getComponent(Sprite)
const path_bg = `symbol_bg_${v}` // const path_bg = `symbol_bg_${v}`
bg.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_bg) // bg.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_bg)
const symbol = item_symbol.getChildByName("symbol").getComponent(Sprite) // const symbol = item_symbol.getChildByName("symbol").getComponent(Sprite)
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)
//顶部横着的一排全是铁框 // //顶部横着的一排全是铁框
const frame = item_symbol.getChildByName("frame").getComponent(Sprite) // const frame = item_symbol.getChildByName("frame").getComponent(Sprite)
const path_frame = `frame_0` // const path_frame = `frame_0`
frame.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_frame) // frame.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_frame)
// scatter 和 wild symbol没有金/银/铁框 // // scatter 和 wild symbol没有金/银/铁框
frame.node.active = !this.isScatterOrWild(v) // frame.node.active = !this.isScatterOrWild(v)
item_symbol.position = new Vec3() // item_symbol.position = new Vec3()
item_symbol.active = true // item_symbol.active = true
hor_symbols.addChild(item_symbol) // hor_symbols.addChild(item_symbol)
}) // })
// 下面几列竖着摆的 // 下面几列竖着摆的
// 5行6列 的网格固定有6个竖列 每一列25个symbol // 5行6列 的网格固定有6个竖列 每一列25个symbol
@ -285,11 +285,11 @@ export class HistoryDetail extends Component {
// console.log(`curCrossIdx=${curCrossIdx}`) // console.log(`curCrossIdx=${curCrossIdx}`)
// console.log(`curSymbolIdx=${curSymbolIdx}`) // console.log(`curSymbolIdx=${curSymbolIdx}`)
for (let i = 0; i < pan.PanColor.Bottom.length;) { for (let i = 0; i < pan.Symbol.Middle.length;) {
// 如果i不等于当前需要处理的连体符号正常生成一个symbol // 如果i不等于当前需要处理的连体符号正常生成一个symbol
if (i != curSymbolIdx) { if (i != curSymbolIdx) {
const item_symbol = instantiate(this.item_symbol) const item_symbol = instantiate(this.item_symbol)
let v = pan.PanColor.Bottom[i] let v = pan.Symbol.Middle[i]
const bg = item_symbol.getChildByName("bg").getComponent(Sprite) const bg = item_symbol.getChildByName("bg").getComponent(Sprite)
const path_bg = `symbol_bg_${v}` const path_bg = `symbol_bg_${v}`
@ -325,7 +325,7 @@ export class HistoryDetail extends Component {
// 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.Symbol.Middle[i]
let length = pan.CroSymbols[curCrossIdx].PosLast - pan.CroSymbols[curCrossIdx].PosFirst + 1 let length = pan.CroSymbols[curCrossIdx].PosLast - pan.CroSymbols[curCrossIdx].PosFirst + 1

View File

@ -370,7 +370,6 @@ export class RollerManager extends Component {
initRollerWithIcon(data: GameData) { initRollerWithIcon(data: GameData) {
this._spinData = data; this._spinData = data;
// let topData = data.PanColor.Top;
let bottomData = data.Symbol.Middle; let bottomData = data.Symbol.Middle;
this._CroSymbols = data.CroSymbols; this._CroSymbols = data.CroSymbols;

View File

@ -7,7 +7,7 @@ import { PREVIEW } from "cc/env"
const gameId = "rp_11001"; const gameId = "rp_11001";
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com"; // let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
let apiaddr = ""; let apiaddr = "";
let token = "eyJQIjoxMDIyNDksIkUiOjE3NjM1Nzk2NTIsIlMiOjk5OSwiRCI6InJwXzExMDAxIn0.7Z8z7XOUvp3XU795wRfy4CrgXZBD38w1mAYErFufAWw"; let token = "eyJQIjoxMDA5NDksIkUiOjE3NjM2NzAzMDAsIlMiOjEwMDMsIkQiOiJycF8xMTAwMSJ9.3flLZnTD1xphdF3e2rjCdDlc6BXLpAXOP7_I2kusTVY";
let language = "en" let language = "en"

View File

@ -54,7 +54,7 @@ export class LoadingUI extends Component {
private lightNode: Node = null; private lightNode: Node = null;
protected async onLoad() { protected async onLoad() {
initErrorManager(); // initErrorManager();
// 初始显示状态 // 初始显示状态
this.initUI(); this.initUI();
this.LoadingUINode.active = false; this.LoadingUINode.active = false;