服务器数据对接

This commit is contained in:
TJH 2026-04-20 15:07:31 +08:00
parent 954f1be8b6
commit b466dd787b
6 changed files with 96 additions and 64 deletions

View File

@ -474,22 +474,21 @@ export class SlotGame extends Component {
parseGameData(spinData: any, lastRemoveData: number[]): IParsedGameData { parseGameData(spinData: any, lastRemoveData: number[]): IParsedGameData {
let { Symbol, WinInfo, Free } = spinData || {}; let { PanColor, SymbolWinInfos, Free, RoundInfo, MulInfo } = spinData || {};
let serverPanData: number[] = Symbol.Middle; let serverPanData: number[] = PanColor.Bottom;
let freeMulMiddlesArr: any[] = Symbol?.FreeMulMiddles || []; let freeMulMiddlesArr: any[] = MulInfo || [];
let mulDesc = WinInfo?.MulDesc || null;
let freeMulMap: { [pos: number]: number } = {}; let freeMulMap: { [pos: number]: number } = {};
for (let item of freeMulMiddlesArr) { for (let item of freeMulMiddlesArr) {
freeMulMap[item.NumPos] = item.Mul; freeMulMap[item.Pos] = item.Mul;
} }
let removeData: number[] = []; let removeData: number[] = [];
if (WinInfo != null && WinInfo.Desc != null) { if (SymbolWinInfos != null) {
for (let symbolId in WinInfo.Desc) { for (let symbolId in SymbolWinInfos) {
let descItem = WinInfo.Desc[symbolId]; let descItem = SymbolWinInfos[symbolId];
if (descItem?.Middle) { if (descItem?.BottomPos) {
descItem.Middle.forEach((pos: number) => removeData.push(pos)); descItem.BottomPos.forEach((pos: number) => removeData.push(pos));
} }
} }
} }
@ -543,10 +542,10 @@ export class SlotGame extends Component {
hasSmallGame: scatterPos.length >= 4, hasSmallGame: scatterPos.length >= 4,
hasFreeSpinAgain: scatterPos.length >= 3 && freeIsSame, hasFreeSpinAgain: scatterPos.length >= 3 && freeIsSame,
FreeMulMap: freeMulMap, FreeMulMap: freeMulMap,
RoundScore: WinInfo?.Score, RoundScore: RoundInfo?.Score,
MulValue: mulDesc?.Mul, MulValue: RoundInfo?.Mul,
UnmultiedScore: mulDesc?.UnMultied, UnmultiedScore: 0,
MultiedScore: mulDesc?.Multied, MultiedScore: 0,
}; };
} }

View File

@ -116,7 +116,6 @@ export class SlotMsg extends Component {
showTotalWinAnimaiton(startScore: number, endScore: number, cb) { showTotalWinAnimaiton(startScore: number, endScore: number, cb) {
this.currTotaleMulti = 0 this.currTotaleMulti = 0
this.node.getChildByName('totalMulti').active = false;
this.smallMsgSpine.node.active = false; this.smallMsgSpine.node.active = false;
this.middleMsgSpine.node.active = false; this.middleMsgSpine.node.active = false;
@ -144,6 +143,7 @@ export class SlotMsg extends Component {
.to(0.2, { scale: v3(1, 1, 1) }) .to(0.2, { scale: v3(1, 1, 1) })
.start() .start()
this.scheduleOnce(() => { this.scheduleOnce(() => {
this.node.getChildByName('totalMulti').getComponent(Label).string = '';
if (cb) cb(); if (cb) cb();
}, 1) }, 1)
}) })
@ -206,8 +206,8 @@ export class SlotMsg extends Component {
*/ */
showMultiWinAnimation(spinData, callBack: () => void) { showMultiWinAnimation(spinData, callBack: () => void) {
// 获取倍率描述,多模式下兼容字段名 // 获取倍率描述,多模式下兼容字段名
let mulDesc = spinData?.WinInfo?.MulDesc || spinData?.WinInfo?.muldesc; // let mulDesc = spinData?.WinInfo?.MulDesc || spinData?.WinInfo?.muldesc;
let multiedScore = mulDesc?.Multied; // 最终得到的分数 let multiedScore = spinData?.RoundInfo.AllScoreMul; // 最终得到的分数
// let mulValue = mulDesc?.Mul; // 总倍率 // let mulValue = mulDesc?.Mul; // 总倍率
let slotGame = director.getScene()?.getComponentInChildren(SlotGame); let slotGame = director.getScene()?.getComponentInChildren(SlotGame);
let multiInfos = slotGame?.getCurrentMultiSettleInfos?.() || []; // 炸弹节点信息 let multiInfos = slotGame?.getCurrentMultiSettleInfos?.() || []; // 炸弹节点信息
@ -266,10 +266,10 @@ export class SlotMsg extends Component {
let run = async () => { let run = async () => {
// 1. 确认总倍率节点,并首先飞入信息栏 // 1. 确认总倍率节点,并首先飞入信息栏
let centerMulNode = this.node.getChildByName('totalMulti'); let centerMulNode = this.node.getChildByName('totalMulti');
this.node.addChild(centerMulNode); // this.node.addChild(centerMulNode);
// centerMulNode.setPosition(centerLocalPos); // centerMulNode.setPosition(centerLocalPos);
centerMulNode.setScale(1, 1, 1); // centerMulNode.setScale(1, 1, 1);
centerMulNode.active = true; // centerMulNode.active = true;
// setMulText(centerMulNode, 0); // setMulText(centerMulNode, 0);
//总倍率有值时要第一个参与倍率计算 //总倍率有值时要第一个参与倍率计算
if (this.currTotaleMulti > 0) { if (this.currTotaleMulti > 0) {
@ -330,8 +330,11 @@ export class SlotMsg extends Component {
// centerMulNode.destroy(); // centerMulNode.destroy();
// 5. 展示最终总分获胜弹窗和新的总倍率 // 5. 展示最终总分获胜弹窗和新的总倍率
if (spinData.IsFree) {
this.currTotaleMulti = sumMul this.currTotaleMulti = sumMul
setMulText(centerMulNode, this.currTotaleMulti) setMulText(centerMulNode, this.currTotaleMulti)
}
this.showTotalWinMsg(multiedScore); this.showTotalWinMsg(multiedScore);
// 直接调用回调(如果业务上需要动画结束后再回调可考虑调整) // 直接调用回调(如果业务上需要动画结束后再回调可考虑调整)
if (callBack) callBack(); if (callBack) callBack();

View File

@ -116,9 +116,9 @@ export class SlotScene extends Component {
this.slotMsg.showLabelMsgForTween(); this.slotMsg.showLabelMsgForTween();
this.updateGameState(); this.updateGameState();
this.isFreeSpin = this.spinData.Free != null && this.spinData && this.spinData.Free && this.spinData.Free.LeftCount > 0; this.isFreeSpin = this.spinData.FreeSpin != null && this.spinData && this.spinData.FreeSpin && this.spinData.FreeSpin.LeftCount > 0;
if (this.isFreeSpin) { if (this.isFreeSpin) {
this.slotBar.setLeftCount(this.spinData.Free.LeftCount); this.slotBar.setLeftCount(this.spinData.FreeSpin.LeftCount);
} }
this.slotBar.updateIsFreeSpin(this.isFreeSpin); this.slotBar.updateIsFreeSpin(this.isFreeSpin);
if (!this.gameInfo.CloseBuyGame) { if (!this.gameInfo.CloseBuyGame) {
@ -154,7 +154,7 @@ export class SlotScene extends Component {
if (this.hasEliminate) { if (this.hasEliminate) {
this.slotBar.manualStop(this.hasEliminate); this.slotBar.manualStop(this.hasEliminate);
this.slotGame.playIconWinAni(this.spinData); this.slotGame.playIconWinAni(this.spinData);
this.slotMsg.showRoundWinMsg(this.spinData.WinInfo.Score); this.slotMsg.showRoundWinMsg(this.spinData.RoundInfo.AllScore);
this.slotBar.updateWinMsg(this.spinData.AllScore, true); this.slotBar.updateWinMsg(this.spinData.AllScore, true);
if (this.isDebug) { if (this.isDebug) {
this.nextSpinInfo = GAME_DATA; this.nextSpinInfo = GAME_DATA;
@ -384,7 +384,7 @@ export class SlotScene extends Component {
// 如果本次有消除,则进行删除工作。 // 如果本次有消除,则进行删除工作。
if (this.hasEliminate) { if (this.hasEliminate) {
this.slotGame.playIconWinAni(this.spinData); this.slotGame.playIconWinAni(this.spinData);
this.slotMsg.showRoundWinMsg(this.spinData.WinInfo.Score); this.slotMsg.showRoundWinMsg(this.spinData.RoundInfo.AllScore);
this.slotBar.updateWinMsg(this.spinData.AllScore, false); this.slotBar.updateWinMsg(this.spinData.AllScore, false);
if (this.isDebug) { if (this.isDebug) {
this.nextSpinInfo = GAME_DATA; this.nextSpinInfo = GAME_DATA;
@ -439,7 +439,7 @@ export class SlotScene extends Component {
async onAllRollerIconsFallen() { async onAllRollerIconsFallen() {
if (this.hasEliminate) { if (this.hasEliminate) {
this.slotGame.playIconWinAni(this.spinData); this.slotGame.playIconWinAni(this.spinData);
this.slotMsg.showRoundWinMsg(this.spinData.WinInfo.Score); this.slotMsg.showRoundWinMsg(this.spinData.RoundInfo.AllScore);
this.slotBar.updateWinMsg(this.spinData.AllScore, false); this.slotBar.updateWinMsg(this.spinData.AllScore, false);
if (this.isDebug) { if (this.isDebug) {
this.nextSpinInfo = GAME_DATA; this.nextSpinInfo = GAME_DATA;
@ -467,12 +467,12 @@ export class SlotScene extends Component {
this.isFeatureBuySpin = false; this.isFeatureBuySpin = false;
this.isFirstFreeSpin = false; this.isFirstFreeSpin = false;
this.slotGame.setFastSpin(this.isFastSpin); this.slotGame.setFastSpin(this.isFastSpin);
this.isFreeSpin = this.spinData.Free != null; this.isFreeSpin = this.spinData.FreeSpin != null;
if (this.isFreeSpin) { if (this.isFreeSpin) {
this.slotBar.curFreeSpinScore = 0; this.slotBar.curFreeSpinScore = 0;
this.isFirstFreeSpin = this.spinData.Free.LeftCount == this.spinData.Free.MaxCount; this.isFirstFreeSpin = this.spinData.FreeSpin.LeftCount == this.spinData.FreeSpin.MaxCount;
} }
this.hasEliminate = this.spinData.RoundInfo.Current !== this.spinData.RoundInfo.Total; this.hasEliminate = this.spinData.RoundInfo?.Current !== this.spinData.RoundInfo?.Total;
} }
// 处理当前小局结束 // 处理当前小局结束
@ -484,15 +484,15 @@ export class SlotScene extends Component {
this.slotGame.upLayer.playScatterWaitSpine(true); this.slotGame.upLayer.playScatterWaitSpine(true);
this.scheduleOnce(() => { this.scheduleOnce(() => {
this.slotGame.upLayer.playScatterWaitSpine(false); this.slotGame.upLayer.playScatterWaitSpine(false);
this.scheduleOnce(() => { this.updateBg(true, false); this.slotBar.updateIsFreeSpin(true); this.slotBar.setLeftCount(this.spinData.Free.MaxCount); }, 1) this.scheduleOnce(() => { this.updateBg(true, false); this.slotBar.updateIsFreeSpin(true); this.slotBar.setLeftCount(this.spinData.FreeSpin.MaxCount); }, 1)
NodePoolManager.instance.getNodeFromPoolDynamic("FreeSpinEnter", "Prefab/FreeSpinEnter", "Game").then((prefab: Node) => { NodePoolManager.instance.getNodeFromPoolDynamic("FreeSpinEnter", "Prefab/FreeSpinEnter", "Game").then((prefab: Node) => {
this.node.addChild(prefab); this.node.addChild(prefab);
let freeCount = this.spinData.Free.MaxCount; let freeCount = this.spinData.FreeSpin.MaxCount;
prefab.getComponent(FreeSpinEnterSpine).showEnterAni(freeCount, () => { prefab.getComponent(FreeSpinEnterSpine).showEnterAni(freeCount, () => {
AudioManager.instance.playBGM("Free_Bg_Bgm"); AudioManager.instance.playBGM("Free_Bg_Bgm");
NodePoolManager.instance.putNodeToPool("FreeSpinEnter", prefab); NodePoolManager.instance.putNodeToPool("FreeSpinEnter", prefab);
this.scheduleOnce(() => { this.scheduleOnce(() => {
this.handleNextFreeSpin(this.spinData.Free.LeftCount - 1); this.handleNextFreeSpin(this.spinData.FreeSpin.LeftCount - 1);
}, 1); }, 1);
}); });
}); });
@ -502,7 +502,7 @@ export class SlotScene extends Component {
this.handleFreeSpinRoundWinMsg(() => { this.handleFreeSpinRoundWinMsg(() => {
this.handleBigWin(() => { this.handleBigWin(() => {
this.handleFreeSpinAgain(() => { this.handleFreeSpinAgain(() => {
this.slotBar.setLeftCount(this.spinData.Free.LeftCount); this.slotBar.setLeftCount(this.spinData.FreeSpin.LeftCount);
if (this.isErr) { if (this.isErr) {
this.updateBg(false, false); this.updateBg(false, false);
if ( if (
@ -518,7 +518,7 @@ export class SlotScene extends Component {
AudioManager.instance.playBGM("Normal_Bg_Bgm"); AudioManager.instance.playBGM("Normal_Bg_Bgm");
return; return;
} }
if (this.spinData.Free.LeftCount == 0 && this.spinData.RoundInfo.Current == this.spinData.RoundInfo.Total) { if (this.spinData.FreeSpin.LeftCount == 0 && (this.spinData.RoundInfo == null || this.spinData.RoundInfo.Current == this.spinData.RoundInfo.Total)) {
this.isFreeSpin = false; this.isFreeSpin = false;
let startScore = 0; let startScore = 0;
this.scheduleOnce(() => { this.scheduleOnce(() => {
@ -542,7 +542,7 @@ export class SlotScene extends Component {
}, 1); }, 1);
} else { } else {
this.scheduleOnce(() => { this.scheduleOnce(() => {
this.handleNextFreeSpin(this.spinData.Free.LeftCount - 1); this.handleNextFreeSpin(this.spinData.FreeSpin.LeftCount - 1);
}, 1); }, 1);
} }
@ -551,9 +551,11 @@ export class SlotScene extends Component {
}) })
} else { } else {
if (this.spinData.Free.LeftCount == 0 && this.spinData.RoundInfo.Current == this.spinData.RoundInfo.Total) { if (this.spinData.FreeSpin.LeftCount == 0 && (this.spinData.RoundInfo == null || this.spinData.RoundInfo.Current == this.spinData.RoundInfo.Total)) {
this.isFreeSpin = false; this.isFreeSpin = false;
// if (this.spinData.RoundInfo && this.spinData.RoundInfo.Mul == 1) {
this.slotMsg.showTotalWinMsg(this.spinData.AllScore); this.slotMsg.showTotalWinMsg(this.spinData.AllScore);
// }
this.slotBar.updatePlayerMsg(this.spinData, isReconnect, () => { this.slotBar.updatePlayerMsg(this.spinData, isReconnect, () => {
this.updateBg(false, false); this.updateBg(false, false);
this.slotBar.updateIsFreeSpin(false); this.slotBar.updateIsFreeSpin(false);
@ -571,7 +573,7 @@ export class SlotScene extends Component {
} else { } else {
this.slotBar.updateWinMsg(this.spinData.AllScore, isReconnect); this.slotBar.updateWinMsg(this.spinData.AllScore, isReconnect);
this.scheduleOnce(() => { this.scheduleOnce(() => {
this.handleNextFreeSpin(this.spinData.Free.LeftCount - 1); this.handleNextFreeSpin(this.spinData.FreeSpin.LeftCount - 1);
}, 1); }, 1);
} }
} }
@ -592,7 +594,29 @@ export class SlotScene extends Component {
this.slotMsg.showTotalWinMsg(this.spinData.AllScore); this.slotMsg.showTotalWinMsg(this.spinData.AllScore);
}); });
} else { } else {
if (this.spinData.RoundInfo && this.spinData.RoundInfo.Mul !== 1) {
this.slotMsg.showMultiWinAnimation(this.spinData, () => {
this.slotMsg.showTotalWinMsg(this.spinData.AllScore); this.slotMsg.showTotalWinMsg(this.spinData.AllScore);
this.handleBigWin(() => {
this.slotBar.updatePlayerMsg(this.spinData, false, () => {
this.updateBg(false, false);
if (
!this.isAutoSpin &&
GameDataManager.instance.frb.Finished == null &&
GameDataManager.instance.frb.Ongoing == null
) {
this.slotGame.setFeatureBuyBtnEnable(true);
}
this.slotBar.updateIsFreeSpin(false);
this.checkAutoSpin(this.spinData.AllScore > 0);
});
});
});
} else {
this.slotMsg.showTotalWinMsg(this.spinData.AllScore);
this.handleBigWin(() => { this.handleBigWin(() => {
this.slotBar.updatePlayerMsg(this.spinData, false, () => { this.slotBar.updatePlayerMsg(this.spinData, false, () => {
this.updateBg(false, false); this.updateBg(false, false);
@ -608,30 +632,36 @@ export class SlotScene extends Component {
}); });
}); });
} }
}
} }
} }
handleFreeSpinRoundWinMsg(callBack: () => void) { handleFreeSpinRoundWinMsg(callBack: () => void) {
if (this.spinData.WinInfo == null) { if (this.spinData.RoundInfo == null) {
callBack(); callBack();
return; return;
} }
if (this.spinData.WinInfo.MulDesc == null) { if (this.spinData.RoundInfo.Mul == 1) {
this.slotMsg.showTotalWinMsg(this.spinData.RoundInfo.Score); this.slotMsg.showTotalWinMsg(this.spinData.RoundInfo.Score);
this.slotBar.updateWinMsg(this.spinData.RoundInfo.Score, false); this.slotBar.updateWinMsg(this.spinData.RoundInfo.Score, false);
callBack(); callBack();
return; return;
} }
if (this.spinData.WinInfo.MulDesc !== null) { if (this.spinData.RoundInfo.Mul !== 1) {
this.slotMsg.showTotalWinMsg(this.spinData.WinInfo.MulDesc.UnMultied); // this.slotMsg.showTotalWinMsg(this.spinData.RoundInfo.AllScoreMul);
this.slotMsg.showMultiWinAnimation(this.spinData, callBack); this.slotMsg.showMultiWinAnimation(this.spinData, callBack);
return; return;
} }
} }
handleBigWin(callBack: () => void) { handleBigWin(callBack: () => void) {
if (this.spinData.RoundInfo == null) {
callBack();
return
}
let score = this.isFreeSpin ? this.spinData.RoundInfo.Score : this.spinData.AllScore; let score = this.isFreeSpin ? this.spinData.RoundInfo.Score : this.spinData.AllScore;
let winType = score ? this.checkWinType(score) : WIN_TYPE.NONE; let winType = score ? this.checkWinType(score) : WIN_TYPE.NONE;
if (winType >= WIN_TYPE.BIG_WIN) { if (winType >= WIN_TYPE.BIG_WIN) {

View File

@ -10520,7 +10520,7 @@
"__id__": 384 "__id__": 384
}, },
"_children": [], "_children": [],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 522 "__id__": 522

View File

@ -5,7 +5,7 @@ import { path } from "cc"
import { PREVIEW } from "cc/env" import { PREVIEW } from "cc/env"
import { GameDataManager } from "../managers/GameDataManager"; import { GameDataManager } from "../managers/GameDataManager";
const gameId = "rp_11008"; const gameId = "rp_11009";
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com"; // let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
let apiaddr = ""; let apiaddr = "";
let token = "eyJQIjoxMDEzNzAsIkUiOjE3NjI4ODQxNjksIlMiOjEwMDIsIkQiOiJycF8xMDAxNyJ9.nb071g5rB617sJNMMhSKh7kXM0C0oTWSfPo90pejoc4"; let token = "eyJQIjoxMDEzNzAsIkUiOjE3NjI4ODQxNjksIlMiOjEwMDIsIkQiOiJycF8xMDAxNyJ9.nb071g5rB617sJNMMhSKh7kXM0C0oTWSfPo90pejoc4";

View File

@ -105,7 +105,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 540, "x": 540,
"y": 959.9999999999999, "y": 960,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@ -190,7 +190,7 @@
"_priority": 0, "_priority": 0,
"_fov": 45, "_fov": 45,
"_fovAxis": 0, "_fovAxis": 0,
"_orthoHeight": 959.9999999999999, "_orthoHeight": 960,
"_near": 0, "_near": 0,
"_far": 2000, "_far": 2000,
"_color": { "_color": {
@ -2361,7 +2361,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1080, "width": 1080,
"height": 1919.9999999999998 "height": 1920
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -2694,7 +2694,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1080, "width": 1080,
"height": 1919.9999999999998 "height": 1920
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -2746,7 +2746,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1080, "width": 1080,
"height": 1919.9999999999998 "height": 1920
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -4897,7 +4897,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1080, "width": 1080,
"height": 1919.9999999999998 "height": 1920
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",