Fixes for countdown.

This commit is contained in:
genxium 2022-09-21 12:21:36 +08:00
parent e90a335c56
commit 372bfc2b48
2 changed files with 13 additions and 8 deletions

View File

@ -440,7 +440,7 @@
"array": [ "array": [
0, 0,
0, 0,
216.05530045313827, 209.65900912275052,
0, 0,
0, 0,
0, 0,

View File

@ -573,9 +573,8 @@ cc.Class({
// No need to prompt upon rejoined. // No need to prompt upon rejoined.
self.popupSimplePressToGo(i18n.t("gameTip.start")); self.popupSimplePressToGo(i18n.t("gameTip.start"));
} }
self.onBattleStarted(rdf.players, rdf.playerMetas);
self._applyRoomDownsyncFrameDynamics(rdf); self.onBattleStarted(rdf);
self.battleState = ALL_BATTLE_STATES.IN_BATTLE; // Starts the increment of "self.renderFrameId" in "self.update(dt)"
} }
self._dumpToFullFrameCache(rdf); self._dumpToFullFrameCache(rdf);
@ -684,9 +683,15 @@ cc.Class({
this._inputControlEnabled = false; this._inputControlEnabled = false;
}, },
onBattleStarted(players, playerMetas) { onBattleStarted(rdf) {
// This function is also applicable to "re-joining".
const players = rdf.players;
const playerMetas = rdf.playerMetas;
console.log('On battle started!'); console.log('On battle started!');
const self = window.mapIns; const self = window.mapIns;
if (null != rdf.countdownNanos) {
self.countdownNanos = rdf.countdownNanos;
}
if (null != self.musicEffectManagerScriptIns) { if (null != self.musicEffectManagerScriptIns) {
self.musicEffectManagerScriptIns.playBGM(); self.musicEffectManagerScriptIns.playBGM();
} }
@ -697,6 +702,9 @@ cc.Class({
self.countdownToBeginGameNode.parent.removeChild(self.countdownToBeginGameNode); self.countdownToBeginGameNode.parent.removeChild(self.countdownToBeginGameNode);
} }
self.transitToState(ALL_MAP_STATES.VISUAL); self.transitToState(ALL_MAP_STATES.VISUAL);
self._applyRoomDownsyncFrameDynamics(rdf);
self.battleState = ALL_BATTLE_STATES.IN_BATTLE; // Starts the increment of "self.renderFrameId" in "self.update(dt)"
}, },
logBattleStats() { logBattleStats() {
@ -925,9 +933,6 @@ cc.Class({
_applyRoomDownsyncFrameDynamics(rdf) { _applyRoomDownsyncFrameDynamics(rdf) {
const self = this; const self = this;
if (null != rdf.countdownNanos) {
self.countdownNanos = rdf.countdownNanos;
}
for (let playerId in self.playerRichInfoDict) { for (let playerId in self.playerRichInfoDict) {
const playerRichInfo = self.playerRichInfoDict[playerId]; const playerRichInfo = self.playerRichInfoDict[playerId];