From 8a2274fb5bf70b69bb45d4bfb1e912c513a602eb Mon Sep 17 00:00:00 2001 From: denglang Date: Thu, 14 Apr 2022 16:47:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2d3ca13dec39dbcd2befb050d887116cb01df997 --- assets/Script/ECS/lib/{ECSFillter.ts => ECSFilter.ts} | 6 +++--- .../ECS/lib/{ECSFillter.ts.meta => ECSFilter.ts.meta} | 2 +- assets/Script/ECS/lib/ECSWorld.ts | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) rename assets/Script/ECS/lib/{ECSFillter.ts => ECSFilter.ts} (90%) rename assets/Script/ECS/lib/{ECSFillter.ts.meta => ECSFilter.ts.meta} (77%) mode change 100755 => 100644 diff --git a/assets/Script/ECS/lib/ECSFillter.ts b/assets/Script/ECS/lib/ECSFilter.ts similarity index 90% rename from assets/Script/ECS/lib/ECSFillter.ts rename to assets/Script/ECS/lib/ECSFilter.ts index 4426f67..6be870d 100755 --- a/assets/Script/ECS/lib/ECSFillter.ts +++ b/assets/Script/ECS/lib/ECSFilter.ts @@ -1,7 +1,7 @@ import { ComType, EntityIndex } from "./Const"; import { ECSWorld } from "./ECSWorld"; -export class ECSFillter { +export class ECSFilter { private _world: ECSWorld = null; private _entitiesMap = new Map(); @@ -21,7 +21,7 @@ export class ECSFillter { public onEntityEnter(entity: EntityIndex) { if(this._entitiesMap.has(entity)) { - console.warn(`[ECSFillter]: addEntity entity is had ${entity}`); + console.warn(`[ECSFilter]: addEntity entity is had ${entity}`); return true; } this._entitiesMap.set(entity, true); @@ -30,7 +30,7 @@ export class ECSFillter { public onEntityLeave(entity: EntityIndex) { if(!this._entitiesMap.has(entity)) { - console.warn(`[ECSFillter]: removeEntity entity not had ${entity}`); + console.warn(`[ECSFilter]: removeEntity entity not had ${entity}`); return true; } this._entitiesMap.delete(entity); diff --git a/assets/Script/ECS/lib/ECSFillter.ts.meta b/assets/Script/ECS/lib/ECSFilter.ts.meta old mode 100755 new mode 100644 similarity index 77% rename from assets/Script/ECS/lib/ECSFillter.ts.meta rename to assets/Script/ECS/lib/ECSFilter.ts.meta index 5875a47..f24957d --- a/assets/Script/ECS/lib/ECSFillter.ts.meta +++ b/assets/Script/ECS/lib/ECSFilter.ts.meta @@ -1,6 +1,6 @@ { "ver": "1.1.0", - "uuid": "a2265ecd-3751-461b-9d2f-755ccc56c3da", + "uuid": "9d20cc25-61b9-4be8-9e89-47bdcac35a5b", "importer": "typescript", "isPlugin": false, "loadPluginInWeb": true, diff --git a/assets/Script/ECS/lib/ECSWorld.ts b/assets/Script/ECS/lib/ECSWorld.ts index 2e19f32..6abf904 100755 --- a/assets/Script/ECS/lib/ECSWorld.ts +++ b/assets/Script/ECS/lib/ECSWorld.ts @@ -1,4 +1,4 @@ -import { ECSFillter } from "./ECSFillter" +import { ECSFilter } from "./ECSFilter" import { ECSComConstructor, GetComConstructor as GetComConstructor, GetComConstructorType } from "./ECSComponent"; import { ECSSystem } from "./ECSSystem"; import { ComPoolIndex, ComType, EntityIndex } from "./Const"; @@ -12,7 +12,7 @@ export class ECSWorld { private _reservedIds: number[] = []; // 缓存 private _entityToComponents: number[][] = []; private _componentPools: ECSComponentPool[] = []; - private _fillters = new Map(); + private _fillters = new Map(); private _entitiesToDelete: Set = new Set(); /** 获取ComponentPool */ @@ -148,14 +148,15 @@ export class ECSWorld { }); } - public getFilter(fillterKey: string): ECSFillter { + + public getFilter(fillterKey: string): ECSFilter { if(this._fillters.has(fillterKey)) { return this._fillters.get(fillterKey); } let [acceptStr, rejectStr] = fillterKey.split("-"); let accept = acceptStr && acceptStr.length > 0 ? acceptStr.split(',').map(Number) : null; let reject = rejectStr && rejectStr.length > 0 ? rejectStr.split(',').map(Number) : null; - let fillter = new ECSFillter(this, accept, reject); + let fillter = new ECSFilter(this, accept, reject); this._fillters.set(fillterKey, fillter); // 将当期的entity放入fillter for(let i=1; i