Enhanced UI handling upon battle started.

This commit is contained in:
genxium 2023-02-05 18:44:37 +08:00
parent d25bb5ff10
commit 6b3d1ed49a
2 changed files with 12 additions and 4 deletions

View File

@ -748,8 +748,9 @@ cc.Class({
self.battleState = ALL_BATTLE_STATES.IN_BATTLE; self.battleState = ALL_BATTLE_STATES.IN_BATTLE;
} }
// [WARNING] "cc.Node.removeChild" would trigger massive update of rendering nodes, thus a performance impact at the beginning of battle, avoid it by just moving the widget to infinitely far away!
if (self.countdownToBeginGameNode && self.countdownToBeginGameNode.parent) { if (self.countdownToBeginGameNode && self.countdownToBeginGameNode.parent) {
self.countdownToBeginGameNode.parent.removeChild(self.countdownToBeginGameNode); self.countdownToBeginGameNode.setPosition(cc.v2(Number.MAX_VALUE, Number.MAX_VALUE));
} }
if (null != self.musicEffectManagerScriptIns) { if (null != self.musicEffectManagerScriptIns) {
@ -1233,8 +1234,10 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
hideFindingPlayersGUI(rdf) { hideFindingPlayersGUI(rdf) {
const self = this; const self = this;
if (null == self.findingPlayerNode.parent) return; // [WARNING] "cc.Node.removeChild" would trigger massive update of rendering nodes, thus a performance impact at the beginning of battle, avoid it by just moving the widget to infinitely far away!
self.findingPlayerNode.parent.removeChild(self.findingPlayerNode); if (self.findingPlayerNode && self.findingPlayerNode.parent) {
self.findingPlayerNode.setPosition(cc.v2(Number.MAX_VALUE, Number.MAX_VALUE));
}
}, },
onBattleReadyToStart(rdf /* pb.RoomDownsyncFrame */ ) { onBattleReadyToStart(rdf /* pb.RoomDownsyncFrame */ ) {

View File

@ -23,6 +23,11 @@ const (
GRAVITY_Y = -int32(float64(0.5) * WORLD_TO_VIRTUAL_GRID_RATIO) // makes all "playerCollider.Y" a multiple of 0.5 in all cases GRAVITY_Y = -int32(float64(0.5) * WORLD_TO_VIRTUAL_GRID_RATIO) // makes all "playerCollider.Y" a multiple of 0.5 in all cases
INPUT_DELAY_FRAMES = int32(6) // in the count of render frames INPUT_DELAY_FRAMES = int32(6) // in the count of render frames
/*
[WARNING]
Experimentally having an input rate > 15 (e.g., 60 >> 2) doesn't improve multiplayer smoothness, in fact higher input rate often results in higher packet loss (both TCP and UDP) thus higher wrong prediction rate!
*/
INPUT_SCALE_FRAMES = uint32(2) // inputDelayedAndScaledFrameId = ((originalFrameId - InputDelayFrames) >> InputScaleFrames) INPUT_SCALE_FRAMES = uint32(2) // inputDelayedAndScaledFrameId = ((originalFrameId - InputDelayFrames) >> InputScaleFrames)
SP_ATK_LOOKUP_FRAMES = int32(5) SP_ATK_LOOKUP_FRAMES = int32(5)