服务器数据对接

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

View File

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

View File

@ -116,9 +116,9 @@ export class SlotScene extends Component {
this.slotMsg.showLabelMsgForTween();
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) {
this.slotBar.setLeftCount(this.spinData.Free.LeftCount);
this.slotBar.setLeftCount(this.spinData.FreeSpin.LeftCount);
}
this.slotBar.updateIsFreeSpin(this.isFreeSpin);
if (!this.gameInfo.CloseBuyGame) {
@ -154,7 +154,7 @@ export class SlotScene extends Component {
if (this.hasEliminate) {
this.slotBar.manualStop(this.hasEliminate);
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);
if (this.isDebug) {
this.nextSpinInfo = GAME_DATA;
@ -384,7 +384,7 @@ export class SlotScene extends Component {
// 如果本次有消除,则进行删除工作。
if (this.hasEliminate) {
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);
if (this.isDebug) {
this.nextSpinInfo = GAME_DATA;
@ -439,7 +439,7 @@ export class SlotScene extends Component {
async onAllRollerIconsFallen() {
if (this.hasEliminate) {
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);
if (this.isDebug) {
this.nextSpinInfo = GAME_DATA;
@ -467,12 +467,12 @@ export class SlotScene extends Component {
this.isFeatureBuySpin = false;
this.isFirstFreeSpin = false;
this.slotGame.setFastSpin(this.isFastSpin);
this.isFreeSpin = this.spinData.Free != null;
this.isFreeSpin = this.spinData.FreeSpin != null;
if (this.isFreeSpin) {
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.scheduleOnce(() => {
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) => {
this.node.addChild(prefab);
let freeCount = this.spinData.Free.MaxCount;
let freeCount = this.spinData.FreeSpin.MaxCount;
prefab.getComponent(FreeSpinEnterSpine).showEnterAni(freeCount, () => {
AudioManager.instance.playBGM("Free_Bg_Bgm");
NodePoolManager.instance.putNodeToPool("FreeSpinEnter", prefab);
this.scheduleOnce(() => {
this.handleNextFreeSpin(this.spinData.Free.LeftCount - 1);
this.handleNextFreeSpin(this.spinData.FreeSpin.LeftCount - 1);
}, 1);
});
});
@ -502,7 +502,7 @@ export class SlotScene extends Component {
this.handleFreeSpinRoundWinMsg(() => {
this.handleBigWin(() => {
this.handleFreeSpinAgain(() => {
this.slotBar.setLeftCount(this.spinData.Free.LeftCount);
this.slotBar.setLeftCount(this.spinData.FreeSpin.LeftCount);
if (this.isErr) {
this.updateBg(false, false);
if (
@ -518,7 +518,7 @@ export class SlotScene extends Component {
AudioManager.instance.playBGM("Normal_Bg_Bgm");
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;
let startScore = 0;
this.scheduleOnce(() => {
@ -542,7 +542,7 @@ export class SlotScene extends Component {
}, 1);
} else {
this.scheduleOnce(() => {
this.handleNextFreeSpin(this.spinData.Free.LeftCount - 1);
this.handleNextFreeSpin(this.spinData.FreeSpin.LeftCount - 1);
}, 1);
}
@ -551,9 +551,11 @@ export class SlotScene extends Component {
})
} 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;
// if (this.spinData.RoundInfo && this.spinData.RoundInfo.Mul == 1) {
this.slotMsg.showTotalWinMsg(this.spinData.AllScore);
// }
this.slotBar.updatePlayerMsg(this.spinData, isReconnect, () => {
this.updateBg(false, false);
this.slotBar.updateIsFreeSpin(false);
@ -571,7 +573,7 @@ export class SlotScene extends Component {
} else {
this.slotBar.updateWinMsg(this.spinData.AllScore, isReconnect);
this.scheduleOnce(() => {
this.handleNextFreeSpin(this.spinData.Free.LeftCount - 1);
this.handleNextFreeSpin(this.spinData.FreeSpin.LeftCount - 1);
}, 1);
}
}
@ -592,46 +594,74 @@ export class SlotScene extends Component {
this.slotMsg.showTotalWinMsg(this.spinData.AllScore);
});
} else {
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);
if (this.spinData.RoundInfo && this.spinData.RoundInfo.Mul !== 1) {
this.slotMsg.showMultiWinAnimation(this.spinData, () => {
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.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);
});
});
}
}
}
}
handleFreeSpinRoundWinMsg(callBack: () => void) {
if (this.spinData.WinInfo == null) {
if (this.spinData.RoundInfo == null) {
callBack();
return;
}
if (this.spinData.WinInfo.MulDesc == null) {
if (this.spinData.RoundInfo.Mul == 1) {
this.slotMsg.showTotalWinMsg(this.spinData.RoundInfo.Score);
this.slotBar.updateWinMsg(this.spinData.RoundInfo.Score, false);
callBack();
return;
}
if (this.spinData.WinInfo.MulDesc !== null) {
this.slotMsg.showTotalWinMsg(this.spinData.WinInfo.MulDesc.UnMultied);
if (this.spinData.RoundInfo.Mul !== 1) {
// this.slotMsg.showTotalWinMsg(this.spinData.RoundInfo.AllScoreMul);
this.slotMsg.showMultiWinAnimation(this.spinData, callBack);
return;
}
}
handleBigWin(callBack: () => void) {
if (this.spinData.RoundInfo == null) {
callBack();
return
}
let score = this.isFreeSpin ? this.spinData.RoundInfo.Score : this.spinData.AllScore;
let winType = score ? this.checkWinType(score) : WIN_TYPE.NONE;
if (winType >= WIN_TYPE.BIG_WIN) {

View File

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

View File

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

View File

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