fix: 收敛战斗内存增长并强化战斗结束清理

This commit is contained in:
panw
2026-03-18 16:46:52 +08:00
parent 56227d8f3f
commit 035066752c
7 changed files with 155 additions and 58 deletions

View File

@@ -44,7 +44,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
private readonly attackPassThresholdX = 60;
private readonly minSpacingY = 30;
private readonly renderSortInterval = 0.05;
private renderSortElapsed = 0;
private lastRenderSortAt = 0;
private heroMoveMatcher: ecs.IMatcher | null = null;
private heroViewMatcher: ecs.IMatcher | null = null;
private readonly renderEntries: { node: Node; bossPriority: number; frontScore: number; spawnOrder: number; eid: number }[] = [];
@@ -405,7 +405,6 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
}
private updateRenderOrder(view: HeroViewComp) {
this.renderSortElapsed += this.dt;
const scene = smc.map?.MapView?.scene;
const actorRoot = scene?.entityLayer?.node?.getChildByName("HERO");
if (!actorRoot) return;
@@ -414,8 +413,9 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
view.node.parent = actorRoot;
}
if (this.renderSortElapsed < this.renderSortInterval) return;
this.renderSortElapsed = 0;
const now = Date.now() / 1000;
if (now - this.lastRenderSortAt < this.renderSortInterval) return;
this.lastRenderSortAt = now;
this.renderEntryCount = 0;
ecs.query(this.getHeroMoveMatcher()).forEach(e => {