MCPcopy Create free account
hub / github.com/esengine/esengine / rebuildIndexes

Method rebuildIndexes

packages/core/src/ECS/Core/QuerySystem.ts:317–328  ·  view source on GitHub ↗

* 重建所有索引 * * 清空并重新构建所有查询索引。 * 通常在大量实体变更后调用以确保索引一致性。

()

Source from the content-addressed store, hash-verified

315 * 通常在大量实体变更后调用以确保索引一致性。
316 */
317 private rebuildIndexes(): void {
318 this._entityIndex.byTag.clear();
319 this._entityIndex.byName.clear();
320
321 // 清理ArchetypeSystem和ComponentIndexManager
322 this._archetypeSystem.clear();
323
324 for (const entity of this._entities) {
325 this.addEntityToIndexes(entity);
326 this._archetypeSystem.addEntity(entity);
327 }
328 }
329
330 /**
331 * 查询包含所有指定组件的实体

Callers 1

setEntitiesMethod · 0.95

Calls 3

addEntityToIndexesMethod · 0.95
clearMethod · 0.65
addEntityMethod · 0.65

Tested by

no test coverage detected