mirror of
https://github.com/kirikayakazuto/CocosCreator_ECS
synced 2024-12-24 10:49:08 +00:00
fix: 修改命名错误
Change-Id: I2d3ca13dec39dbcd2befb050d887116cb01df997
This commit is contained in:
parent
bad7227eec
commit
8a2274fb5b
@ -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<EntityIndex, boolean>();
|
||||
@ -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);
|
2
assets/Script/ECS/lib/ECSFillter.ts.meta → assets/Script/ECS/lib/ECSFilter.ts.meta
Executable file → Normal file
2
assets/Script/ECS/lib/ECSFillter.ts.meta → assets/Script/ECS/lib/ECSFilter.ts.meta
Executable file → Normal file
@ -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,
|
@ -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<any>[] = [];
|
||||
private _fillters = new Map<string, ECSFillter>();
|
||||
private _fillters = new Map<string, ECSFilter>();
|
||||
private _entitiesToDelete: Set<EntityIndex> = 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<this._entityToComponents.length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user