Merge branch 'master' of https://github.com/esengine/ecs-framework
# Conflicts: # package-lock.json # package.json
This commit is contained in:
Submodule extensions/cocos/cocos-ecs/extensions/cocos-terrain-gen updated: 8ebcce722a...eff68e895a
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@esengine/ecs-framework",
|
"name": "@esengine/ecs-framework",
|
||||||
"version": "2.1.24",
|
"version": "2.1.25",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@esengine/ecs-framework",
|
"name": "@esengine/ecs-framework",
|
||||||
"version": "2.1.24",
|
"version": "2.1.25",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/multer": "^1.4.13",
|
"@types/multer": "^1.4.13",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@esengine/ecs-framework",
|
"name": "@esengine/ecs-framework",
|
||||||
"version": "2.1.24",
|
"version": "2.1.25",
|
||||||
"description": "用于Laya、Cocos Creator等JavaScript游戏引擎的高性能ECS框架",
|
"description": "用于Laya、Cocos Creator等JavaScript游戏引擎的高性能ECS框架",
|
||||||
"main": "bin/index.js",
|
"main": "bin/index.js",
|
||||||
"types": "bin/index.d.ts",
|
"types": "bin/index.d.ts",
|
||||||
|
|||||||
@@ -421,16 +421,17 @@ export class QuerySystem {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let entities: Entity[];
|
let entities: Entity[] = [];
|
||||||
|
|
||||||
const archetypeResult = this.archetypeSystem.queryArchetypes(componentTypes, 'AND');
|
const archetypeResult = this.archetypeSystem.queryArchetypes(componentTypes, 'AND');
|
||||||
if (archetypeResult.archetypes.length > 0) {
|
if (archetypeResult.archetypes.length > 0) {
|
||||||
this.queryStats.archetypeHits++;
|
this.queryStats.archetypeHits++;
|
||||||
entities = [];
|
|
||||||
for (const archetype of archetypeResult.archetypes) {
|
for (const archetype of archetypeResult.archetypes) {
|
||||||
entities.push(...archetype.entities);
|
entities.push(...archetype.entities);
|
||||||
}
|
}
|
||||||
} else if (componentTypes.length === 1) {
|
} else {
|
||||||
|
try {
|
||||||
|
if (componentTypes.length === 1) {
|
||||||
this.queryStats.indexHits++;
|
this.queryStats.indexHits++;
|
||||||
const indexResult = this.componentIndexManager.query(componentTypes[0]);
|
const indexResult = this.componentIndexManager.query(componentTypes[0]);
|
||||||
entities = Array.from(indexResult);
|
entities = Array.from(indexResult);
|
||||||
@@ -438,8 +439,16 @@ export class QuerySystem {
|
|||||||
const indexResult = this.componentIndexManager.queryMultiple(componentTypes, 'AND');
|
const indexResult = this.componentIndexManager.queryMultiple(componentTypes, 'AND');
|
||||||
entities = Array.from(indexResult);
|
entities = Array.from(indexResult);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
entities = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entities.length === 0 && this.entities.length > 0) {
|
||||||
|
this.queryStats.linearScans++;
|
||||||
|
entities = this.queryByLinearScan(componentTypes);
|
||||||
|
}
|
||||||
|
|
||||||
// 缓存结果
|
|
||||||
this.addToCache(cacheKey, entities);
|
this.addToCache(cacheKey, entities);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user