mirror of
https://github.com/genxium/DelayNoMore
synced 2025-10-09 00:26:39 +00:00
Minor fix.
This commit is contained in:
@@ -12,10 +12,12 @@ window.ATK_CHARACTER_STATE = {
|
||||
BlownUp1: [8, "BlownUp1"],
|
||||
LayDown1: [9, "LayDown1"], // The last frame of "LayDown1" should have a simliar boundingbox with the first frame of "GetUp1", otherwise the animation would seem odd
|
||||
GetUp1: [10, "GetUp1"],
|
||||
Atk2: [11, "Atk2"],
|
||||
Atk3: [12, "Atk3"],
|
||||
Atk4: [13, "Atk4"],
|
||||
Atk5: [14, "Atk5"],
|
||||
Atk2: [11, "Atk2"],
|
||||
Atk3: [12, "Atk3"],
|
||||
Atk4: [13, "Atk4"],
|
||||
Atk5: [14, "Atk5"],
|
||||
Dashing: [15, "Dashing"],
|
||||
OnWall: [16, "OnWall"],
|
||||
};
|
||||
|
||||
window.ATK_CHARACTER_STATE_ARR = [];
|
||||
@@ -31,6 +33,8 @@ window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.In
|
||||
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.BlownUp1[0]);
|
||||
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.LayDown1[0]);
|
||||
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.GetUp1[0]);
|
||||
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.Dashing[0]);
|
||||
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.OnWall[0]);
|
||||
|
||||
window.ATK_CHARACTER_STATE_IN_AIR_SET = new Set();
|
||||
window.ATK_CHARACTER_STATE_IN_AIR_SET.add(window.ATK_CHARACTER_STATE.InAirIdle1NoJump[0]);
|
||||
@@ -38,6 +42,7 @@ window.ATK_CHARACTER_STATE_IN_AIR_SET.add(window.ATK_CHARACTER_STATE.InAirIdle1B
|
||||
window.ATK_CHARACTER_STATE_IN_AIR_SET.add(window.ATK_CHARACTER_STATE.InAirAtk1[0]);
|
||||
window.ATK_CHARACTER_STATE_IN_AIR_SET.add(window.ATK_CHARACTER_STATE.InAirAtked1[0]);
|
||||
window.ATK_CHARACTER_STATE_IN_AIR_SET.add(window.ATK_CHARACTER_STATE.BlownUp1[0]);
|
||||
window.ATK_CHARACTER_STATE_IN_AIR_SET.add(window.ATK_CHARACTER_STATE.OnWall[0]);
|
||||
|
||||
/*
|
||||
Kindly note that the use of dragonBones anim is an informed choice for the feasibility of "gotoAndPlayByFrame", which is a required feature by "Map.rollbackAndChase". You might find that "cc.Animation" -- the traditional frame anim -- can also suffice this requirement, yet if we want to develop 3D frontend in the future, working with skeletal anim will make a smoother transition.
|
||||
@@ -79,6 +84,8 @@ cc.Class({
|
||||
updateCharacterAnim(rdfPlayer, prevRdfPlayer, forceAnimSwitch, chConfig) {
|
||||
// As this function might be called after many frames of a rollback, it's possible that the playing animation was predicted, different from "prevRdfPlayer.CharacterState" but same as "newCharacterState". More granular checks are needed to determine whether we should interrupt the playing animation.
|
||||
|
||||
let newCharacterState = rdfPlayer.CharacterState;
|
||||
|
||||
// Update directions
|
||||
if (this.animComp && this.animComp.node) {
|
||||
if (0 > rdfPlayer.DirX) {
|
||||
@@ -86,9 +93,11 @@ cc.Class({
|
||||
} else if (0 < rdfPlayer.DirX) {
|
||||
this.animNode.scaleX = (1.0);
|
||||
}
|
||||
if (ATK_CHARACTER_STATE.OnWall[0] == newCharacterState) {
|
||||
this.animNode.scaleX *= (-1.0);
|
||||
}
|
||||
}
|
||||
|
||||
let newCharacterState = rdfPlayer.CharacterState;
|
||||
let newAnimName = window.ATK_CHARACTER_STATE_ARR[newCharacterState][1];
|
||||
let playingAnimName = null;
|
||||
let underlyingAnimationCtrl = null;
|
||||
@@ -139,7 +148,7 @@ cc.Class({
|
||||
let frameIdxInAnim = rdfPlayer.FramesInChState;
|
||||
if (window.ATK_CHARACTER_STATE.InAirIdle1ByJump == newCharacterState && null != chConfig) {
|
||||
frameIdxInAnim = chConfig.InAirIdleFrameIdxTurningPoint + (frameIdxInAnim - chConfig.InAirIdleFrameIdxTurningPoint) % chConfig.InAirIdleFrameIdxTurnedCycle; // TODO: Anyway to avoid using division here?
|
||||
}
|
||||
}
|
||||
let fromTime = (frameIdxInAnim / targetClip.sample); // TODO: Anyway to avoid using division here?
|
||||
this.animComp.play(newAnimName, fromTime);
|
||||
},
|
||||
|
@@ -607,13 +607,13 @@ cc.Class({
|
||||
const jsPlayersArr = new Array(pbRdf.playersArr.length).fill(null);
|
||||
for (let k = 0; k < pbRdf.playersArr.length; ++k) {
|
||||
const pbPlayer = pbRdf.playersArr[k];
|
||||
const jsPlayer = gopkgs.NewPlayerDownsyncJs(pbPlayer.id, pbPlayer.virtualGridX, pbPlayer.virtualGridY, pbPlayer.dirX, pbPlayer.dirY, pbPlayer.velX, pbPlayer.velY, pbPlayer.framesToRecover, pbPlayer.framesInChState, pbPlayer.activeSkillId, pbPlayer.activeSkillHit, pbPlayer.framesInvinsible, pbPlayer.speed, pbPlayer.battleState, pbPlayer.characterState, pbPlayer.joinIndex, pbPlayer.hp, pbPlayer.maxHp, pbPlayer.colliderRadius, pbPlayer.inAir);
|
||||
const jsPlayer = gopkgs.NewPlayerDownsyncJs(pbPlayer.id, pbPlayer.virtualGridX, pbPlayer.virtualGridY, pbPlayer.dirX, pbPlayer.dirY, pbPlayer.velX, pbPlayer.velY, pbPlayer.framesToRecover, pbPlayer.framesInChState, pbPlayer.activeSkillId, pbPlayer.activeSkillHit, pbPlayer.framesInvinsible, pbPlayer.speed, pbPlayer.battleState, pbPlayer.characterState, pbPlayer.joinIndex, pbPlayer.hp, pbPlayer.maxHp, pbPlayer.colliderRadius, pbPlayer.inAir, pbPlayer.onWall, pbPlayer.bulletTeamId, pbPlayer.chCollisionTeamId);
|
||||
jsPlayersArr[k] = jsPlayer;
|
||||
}
|
||||
const jsMeleeBulletsArr = new Array(pbRdf.meleeBullets.length).fill(null);
|
||||
for (let k = 0; k < pbRdf.meleeBullets.length; ++k) {
|
||||
const pbBullet = pbRdf.meleeBullets[k];
|
||||
const jsMeleeBullet = gopkgs.NewMeleeBulletJs(pbBullet.bulletLocalId, pbBullet.originatedRenderFrameId, pbBullet.offenderJoinIndex, pbBullet.startupFrames, pbBullet.cancellableStFrame, pbBullet.cancellableEdFrame, pbBullet.activeFrames, pbBullet.hitStunFrames, pbBullet.blockStunFrames, pbBullet.pushbackVelX, pbBullet.pushbackVelY, pbBullet.damage, pbBullet.selfLockVelX, pbBullet.selfLockVelY, pbBullet.hitboxOffsetX, pbBullet.hitboxOffsetY, pbBullet.hitboxSizeX, pbBullet.hitboxSizeY, pbBullet.blowUp);
|
||||
const jsMeleeBullet = gopkgs.NewMeleeBulletJs(pbBullet.bulletLocalId, pbBullet.originatedRenderFrameId, pbBullet.offenderJoinIndex, pbBullet.startupFrames, pbBullet.cancellableStFrame, pbBullet.cancellableEdFrame, pbBullet.activeFrames, pbBullet.hitStunFrames, pbBullet.blockStunFrames, pbBullet.pushbackVelX, pbBullet.pushbackVelY, pbBullet.damage, pbBullet.selfLockVelX, pbBullet.selfLockVelY, pbBullet.hitboxOffsetX, pbBullet.hitboxOffsetY, pbBullet.hitboxSizeX, pbBullet.hitboxSizeY, pbBullet.blowUp, pbBullet.teamId);
|
||||
jsMeleeBulletsArr[k] = jsMeleeBullet;
|
||||
}
|
||||
const jsFireballBulletsArr = new Array(pbRdf.fireballBullets.length).fill(null);
|
||||
@@ -720,6 +720,8 @@ cc.Class({
|
||||
|
||||
equalPlayers(lhs, rhs) {
|
||||
if (null == lhs || null == rhs) return false;
|
||||
if (null == lhs && null != rhs) return false;
|
||||
if (null != lhs && null == rhs) return false;
|
||||
if (lhs.VirtualGridX != rhs.VirtualGridX) return false;
|
||||
if (lhs.VirtualGridY != rhs.VirtualGridY) return false;
|
||||
if (lhs.DirX != rhs.DirX) return false;
|
||||
@@ -738,9 +740,30 @@ cc.Class({
|
||||
|
||||
equalMeleeBullets(lhs, rhs) {
|
||||
if (null == lhs || null == rhs) return false;
|
||||
if (lhs.BulletLocalId != rhs.BulletLocalId) return false;
|
||||
if (lhs.OffenderJoinIndex != rhs.OffenderJoinIndex) return false;
|
||||
if (lhs.OriginatedRenderFrameId != rhs.OriginatedRenderFrameId) return false;
|
||||
if (null == lhs && null != rhs) return false;
|
||||
if (null != lhs && null == rhs) return false;
|
||||
if (lhs.Bullet.BulletLocalId != rhs.Bullet.BulletLocalId) return false;
|
||||
if (lhs.Bullet.OffenderJoinIndex != rhs.Bullet.OffenderJoinIndex) return false;
|
||||
if (lhs.Bullet.OriginatedRenderFrameId != rhs.Bullet.OriginatedRenderFrameId) return false;
|
||||
return true;
|
||||
},
|
||||
|
||||
equalFireballBullets(lhs, rhs) {
|
||||
if (null == lhs || null == rhs) return false;
|
||||
if (null == lhs && null != rhs) return false;
|
||||
if (null != lhs && null == rhs) return false;
|
||||
if (lhs.Bullet.BulletLocalId != rhs.Bullet.BulletLocalId) return false;
|
||||
if (lhs.Bullet.OffenderJoinIndex != rhs.Bullet.OffenderJoinIndex) return false;
|
||||
if (lhs.Bullet.OriginatedRenderFrameId != rhs.Bullet.OriginatedRenderFrameId) return false;
|
||||
|
||||
if (lhs.Bullet.VirtualGridX != rhs.Bullet.VirtualGridX) return false;
|
||||
if (lhs.Bullet.VirtualGridY != rhs.Bullet.VirtualGridY) return false;
|
||||
if (lhs.Bullet.DirX != rhs.Bullet.DirX) return false;
|
||||
if (lhs.Bullet.DirY != rhs.Bullet.DirY) return false;
|
||||
if (lhs.Bullet.VelX != rhs.Bullet.VelX) return false;
|
||||
if (lhs.Bullet.VelY != rhs.Bullet.VelY) return false;
|
||||
if (lhs.Bullet.Speed != rhs.Bullet.Speed) return false;
|
||||
if (lhs.Bullet.SpeciesId != rhs.Bullet.SpeciesId) return false;
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -752,6 +775,9 @@ cc.Class({
|
||||
for (let k in lhs.meleeBullets) {
|
||||
if (!this.equalMeleeBullets(lhs.meleeBullets[k], rhs.meleeBullets[k])) return false;
|
||||
}
|
||||
for (let k in lhs.fireballBullet) {
|
||||
if (!this.equalMeleeBullets(lhs.meleeBullets[k], rhs.meleeBullets[k])) return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -927,17 +953,17 @@ batchInputFrameIdRange=[${batch[0].inputFrameId}, ${batch[batch.length - 1].inpu
|
||||
}
|
||||
*/
|
||||
// [WARNING] Don't try to get "prevRdf(i.e. renderFrameId == latest-1)" by "self.recentRenderCache.getByFrameId(...)" here, as the cache might have been updated by asynchronous "onRoomDownsyncFrame(...)" calls!
|
||||
if (self.othersForcedDownsyncRenderFrameDict.has(rdf.id)) {
|
||||
const delayedInputFrameId = gopkgs.ConvertToDelayedInputFrameId(rdf.id);
|
||||
const othersForcedDownsyncRenderFrame = self.othersForcedDownsyncRenderFrameDict.get(rdf.id);
|
||||
if (self.othersForcedDownsyncRenderFrameDict.has(rdf.Id)) {
|
||||
const delayedInputFrameId = gopkgs.ConvertToDelayedInputFrameId(rdf.Id);
|
||||
const othersForcedDownsyncRenderFrame = self.othersForcedDownsyncRenderFrameDict.get(rdf.Id);
|
||||
if (self.lastAllConfirmedInputFrameId >= delayedInputFrameId && !self.equalRoomDownsyncFrames(othersForcedDownsyncRenderFrame, rdf)) {
|
||||
console.warn(`Mismatched render frame@rdf.id=${rdf.id} w/ inputFrameId=${delayedInputFrameId}:
|
||||
console.warn(`Mismatched render frame@rdf.id=${rdf.Id} w/ inputFrameId=${delayedInputFrameId}:
|
||||
rdf=${JSON.stringify(rdf)}
|
||||
othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame)}`);
|
||||
// closeWSConnection(constants.RET_CODE.CLIENT_MISMATCHED_RENDER_FRAME, "");
|
||||
// self.onManualRejoinRequired("[DEBUG] CLIENT_MISMATCHED_RENDER_FRAME");
|
||||
rdf = othersForcedDownsyncRenderFrame;
|
||||
self.othersForcedDownsyncRenderFrameDict.delete(rdf.id);
|
||||
self.othersForcedDownsyncRenderFrameDict.delete(rdf.Id);
|
||||
}
|
||||
}
|
||||
self.applyRoomDownsyncFrameDynamics(rdf, prevRdf);
|
||||
@@ -1305,6 +1331,7 @@ actuallyUsedinputList:{${self.inputFrameDownsyncStr(actuallyUsedInputClone)}}`);
|
||||
case ATK_CHARACTER_STATE.BlownUp1[0]:
|
||||
case ATK_CHARACTER_STATE.InAirIdle1NoJump[0]:
|
||||
case ATK_CHARACTER_STATE.InAirIdle1ByJump[0]:
|
||||
case ATK_CHARACTER_STATE.OnWall[0]:
|
||||
[colliderWidth, colliderHeight] = [player.ColliderRadius * 2, player.ColliderRadius * 2];
|
||||
break;
|
||||
}
|
||||
|
@@ -129,7 +129,7 @@ cc.Class({
|
||||
inAir: true,
|
||||
}),
|
||||
],
|
||||
speciesIdList: [4096, 0],
|
||||
speciesIdList: [1, 4096],
|
||||
});
|
||||
|
||||
self.selfPlayerInfo = {
|
||||
|
@@ -195,15 +195,31 @@ cc.Class({
|
||||
cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, function(evt) {
|
||||
switch (evt.keyCode) {
|
||||
case cc.macro.KEY.w:
|
||||
self.cachedBtnUpLevel = 0;
|
||||
self.cachedBtnDownLevel = 0;
|
||||
self.cachedBtnLeftLevel = 0;
|
||||
self.cachedBtnRightLevel = 0;
|
||||
self.cachedBtnUpLevel = 1;
|
||||
break;
|
||||
case cc.macro.KEY.s:
|
||||
self.cachedBtnUpLevel = 0;
|
||||
self.cachedBtnDownLevel = 0;
|
||||
self.cachedBtnLeftLevel = 0;
|
||||
self.cachedBtnRightLevel = 0;
|
||||
self.cachedBtnDownLevel = 1;
|
||||
break;
|
||||
case cc.macro.KEY.a:
|
||||
self.cachedBtnUpLevel = 0;
|
||||
self.cachedBtnDownLevel = 0;
|
||||
self.cachedBtnLeftLevel = 0;
|
||||
self.cachedBtnRightLevel = 0;
|
||||
self.cachedBtnLeftLevel = 1;
|
||||
break;
|
||||
case cc.macro.KEY.d:
|
||||
self.cachedBtnUpLevel = 0;
|
||||
self.cachedBtnDownLevel = 0;
|
||||
self.cachedBtnLeftLevel = 0;
|
||||
self.cachedBtnRightLevel = 0;
|
||||
self.cachedBtnRightLevel = 1;
|
||||
break;
|
||||
case cc.macro.KEY.h:
|
||||
|
Reference in New Issue
Block a user