@esengine/ecs-framework 2.2.18 → 2.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +149 -2
- package/index.es5.js +2 -2
- package/index.es5.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/index.umd.js +2 -2
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @esengine/ecs-framework v2.2.
|
|
2
|
+
* @esengine/ecs-framework v2.2.20
|
|
3
3
|
* TypeScript definitions
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -5159,6 +5159,35 @@ declare class Scene implements IScene {
|
|
|
5159
5159
|
* 系统错误次数超过此阈值后将被自动禁用
|
|
5160
5160
|
*/
|
|
5161
5161
|
private _maxErrorCount;
|
|
5162
|
+
/**
|
|
5163
|
+
* 系统添加计数器
|
|
5164
|
+
*
|
|
5165
|
+
* 用于为每个添加的系统分配唯一的添加顺序,保证排序稳定性
|
|
5166
|
+
* Counter for assigning unique add order to each system for stable sorting
|
|
5167
|
+
*/
|
|
5168
|
+
private _systemAddCounter;
|
|
5169
|
+
/**
|
|
5170
|
+
* 组件ID到系统的索引映射
|
|
5171
|
+
*
|
|
5172
|
+
* 用于快速查找关心特定组件的系统,避免遍历所有系统。
|
|
5173
|
+
* 使用组件ID(数字)而非ComponentType作为key,避免类引用问题。
|
|
5174
|
+
*
|
|
5175
|
+
* Component ID to systems index map.
|
|
5176
|
+
* Used for fast lookup of systems that care about specific components.
|
|
5177
|
+
* Uses component ID (number) instead of ComponentType as key to avoid class reference issues.
|
|
5178
|
+
*/
|
|
5179
|
+
private _componentIdToSystems;
|
|
5180
|
+
/**
|
|
5181
|
+
* 需要接收所有组件变化通知的系统集合
|
|
5182
|
+
*
|
|
5183
|
+
* 包括使用 none 条件、tag/name 查询、或空匹配器的系统。
|
|
5184
|
+
* 这些系统无法通过组件ID索引优化,需要在每次组件变化时都检查。
|
|
5185
|
+
*
|
|
5186
|
+
* Systems that need to receive all component change notifications.
|
|
5187
|
+
* Includes systems using none conditions, tag/name queries, or empty matchers.
|
|
5188
|
+
* These systems cannot be optimized via component ID indexing.
|
|
5189
|
+
*/
|
|
5190
|
+
private _globalNotifySystems;
|
|
5162
5191
|
/**
|
|
5163
5192
|
* 获取场景中所有已注册的EntitySystem
|
|
5164
5193
|
*
|
|
@@ -5178,7 +5207,8 @@ declare class Scene implements IScene {
|
|
|
5178
5207
|
*/
|
|
5179
5208
|
private _filterEntitySystems;
|
|
5180
5209
|
/**
|
|
5181
|
-
* 按updateOrder
|
|
5210
|
+
* 按 updateOrder 排序系统,相同时按 addOrder 保证稳定性
|
|
5211
|
+
* Sort systems by updateOrder, use addOrder as secondary key for stability
|
|
5182
5212
|
*/
|
|
5183
5213
|
private _sortSystemsByUpdateOrder;
|
|
5184
5214
|
/**
|
|
@@ -5291,6 +5321,49 @@ declare class Scene implements IScene {
|
|
|
5291
5321
|
* 当实体或组件发生变化时调用
|
|
5292
5322
|
*/
|
|
5293
5323
|
clearSystemEntityCaches(): void;
|
|
5324
|
+
/**
|
|
5325
|
+
* 通知相关系统实体的组件发生了变化
|
|
5326
|
+
*
|
|
5327
|
+
* 这是事件驱动设计的核心:当组件被添加或移除时,立即通知相关系统检查该实体是否匹配,
|
|
5328
|
+
* 并触发 onAdded/onRemoved 回调。通过组件ID索引优化,只通知关心该组件的系统。
|
|
5329
|
+
*
|
|
5330
|
+
* This is the core of event-driven design: when a component is added or removed,
|
|
5331
|
+
* immediately notify relevant systems to check if the entity matches and trigger
|
|
5332
|
+
* onAdded/onRemoved callbacks. Optimized via component ID indexing to only notify
|
|
5333
|
+
* systems that care about the changed component.
|
|
5334
|
+
*
|
|
5335
|
+
* @param entity 组件发生变化的实体 | The entity whose components changed
|
|
5336
|
+
* @param changedComponentType 变化的组件类型(可选) | The changed component type (optional)
|
|
5337
|
+
*/
|
|
5338
|
+
notifyEntityComponentChanged(entity: Entity, changedComponentType?: ComponentType): void;
|
|
5339
|
+
/**
|
|
5340
|
+
* 将系统添加到组件索引
|
|
5341
|
+
*
|
|
5342
|
+
* 根据系统的 Matcher 条件,将系统注册到相应的组件ID索引中。
|
|
5343
|
+
*
|
|
5344
|
+
* Index a system by its interested component types.
|
|
5345
|
+
* Registers the system to component ID indices based on its Matcher conditions.
|
|
5346
|
+
*
|
|
5347
|
+
* @param system 要索引的系统 | The system to index
|
|
5348
|
+
*/
|
|
5349
|
+
private indexSystemByComponents;
|
|
5350
|
+
/**
|
|
5351
|
+
* 将系统添加到指定组件的索引
|
|
5352
|
+
*
|
|
5353
|
+
* Add system to the index for a specific component type.
|
|
5354
|
+
*
|
|
5355
|
+
* @param componentType 组件类型 | Component type
|
|
5356
|
+
* @param system 系统 | System
|
|
5357
|
+
*/
|
|
5358
|
+
private addSystemToComponentIndex;
|
|
5359
|
+
/**
|
|
5360
|
+
* 从组件索引中移除系统
|
|
5361
|
+
*
|
|
5362
|
+
* Remove a system from all component indices.
|
|
5363
|
+
*
|
|
5364
|
+
* @param system 要移除的系统 | The system to remove
|
|
5365
|
+
*/
|
|
5366
|
+
private removeSystemFromIndex;
|
|
5294
5367
|
/**
|
|
5295
5368
|
* 在场景的实体列表中添加一个实体
|
|
5296
5369
|
* @param entity 要添加的实体
|
|
@@ -5740,6 +5813,12 @@ declare class Scene implements IScene {
|
|
|
5740
5813
|
*/
|
|
5741
5814
|
declare abstract class EntitySystem implements ISystemBase, IService {
|
|
5742
5815
|
private _updateOrder;
|
|
5816
|
+
/**
|
|
5817
|
+
* 添加顺序,用于 updateOrder 相同时的稳定排序
|
|
5818
|
+
* Add order for stable sorting when updateOrder is the same
|
|
5819
|
+
* @internal
|
|
5820
|
+
*/
|
|
5821
|
+
private _addOrder;
|
|
5743
5822
|
private _enabled;
|
|
5744
5823
|
private _performanceMonitor;
|
|
5745
5824
|
private _systemName;
|
|
@@ -5767,6 +5846,18 @@ declare abstract class EntitySystem implements ISystemBase, IService {
|
|
|
5767
5846
|
*/
|
|
5768
5847
|
get updateOrder(): number;
|
|
5769
5848
|
set updateOrder(value: number);
|
|
5849
|
+
/**
|
|
5850
|
+
* 获取系统的添加顺序
|
|
5851
|
+
* Get the add order of the system
|
|
5852
|
+
* @internal
|
|
5853
|
+
*/
|
|
5854
|
+
get addOrder(): number;
|
|
5855
|
+
/**
|
|
5856
|
+
* 设置系统的添加顺序(由 Scene 在添加时设置)
|
|
5857
|
+
* Set the add order of the system (set by Scene when adding)
|
|
5858
|
+
* @internal
|
|
5859
|
+
*/
|
|
5860
|
+
set addOrder(value: number);
|
|
5770
5861
|
/**
|
|
5771
5862
|
* 获取系统的启用状态
|
|
5772
5863
|
*/
|
|
@@ -5956,8 +6047,44 @@ declare abstract class EntitySystem implements ISystemBase, IService {
|
|
|
5956
6047
|
* @returns 系统信息字符串
|
|
5957
6048
|
*/
|
|
5958
6049
|
toString(): string;
|
|
6050
|
+
/**
|
|
6051
|
+
* 检查实体是否匹配当前系统的查询条件
|
|
6052
|
+
* Check if an entity matches this system's query condition
|
|
6053
|
+
*
|
|
6054
|
+
* @param entity 要检查的实体 / The entity to check
|
|
6055
|
+
* @returns 是否匹配 / Whether the entity matches
|
|
6056
|
+
*/
|
|
6057
|
+
matchesEntity(entity: Entity): boolean;
|
|
6058
|
+
/**
|
|
6059
|
+
* 检查实体是否正在被此系统跟踪
|
|
6060
|
+
* Check if an entity is being tracked by this system
|
|
6061
|
+
*
|
|
6062
|
+
* @param entity 要检查的实体 / The entity to check
|
|
6063
|
+
* @returns 是否正在跟踪 / Whether the entity is being tracked
|
|
6064
|
+
*/
|
|
6065
|
+
isTracking(entity: Entity): boolean;
|
|
6066
|
+
/**
|
|
6067
|
+
* 当实体的组件发生变化时由 Scene 调用
|
|
6068
|
+
*
|
|
6069
|
+
* 立即检查实体是否匹配并触发 onAdded/onRemoved 回调。
|
|
6070
|
+
* 这是事件驱动设计的核心:组件变化时立即通知相关系统。
|
|
6071
|
+
*
|
|
6072
|
+
* Called by Scene when an entity's components change.
|
|
6073
|
+
* Immediately checks if the entity matches and triggers onAdded/onRemoved callbacks.
|
|
6074
|
+
* This is the core of event-driven design: notify relevant systems immediately when components change.
|
|
6075
|
+
*
|
|
6076
|
+
* @param entity 组件发生变化的实体 / The entity whose components changed
|
|
6077
|
+
* @internal 由 Scene.notifyEntityComponentChanged 调用 / Called by Scene.notifyEntityComponentChanged
|
|
6078
|
+
*/
|
|
6079
|
+
handleEntityComponentChanged(entity: Entity): void;
|
|
5959
6080
|
/**
|
|
5960
6081
|
* 更新实体跟踪,检查新增和移除的实体
|
|
6082
|
+
*
|
|
6083
|
+
* 由于采用了事件驱动设计,运行时的 onAdded/onRemoved 已在 handleEntityComponentChanged 中
|
|
6084
|
+
* 立即触发。此方法不再触发回调,只同步跟踪状态。
|
|
6085
|
+
*
|
|
6086
|
+
* With event-driven design, runtime onAdded/onRemoved are triggered immediately in
|
|
6087
|
+
* handleEntityComponentChanged. This method no longer triggers callbacks, only syncs tracking state.
|
|
5961
6088
|
*/
|
|
5962
6089
|
private updateEntityTracking;
|
|
5963
6090
|
/**
|
|
@@ -6281,8 +6408,24 @@ interface IScene {
|
|
|
6281
6408
|
createEntity(name: string): Entity;
|
|
6282
6409
|
/**
|
|
6283
6410
|
* 清除所有EntitySystem的实体缓存
|
|
6411
|
+
* Clear all EntitySystem entity caches
|
|
6284
6412
|
*/
|
|
6285
6413
|
clearSystemEntityCaches(): void;
|
|
6414
|
+
/**
|
|
6415
|
+
* 通知相关系统实体的组件发生了变化
|
|
6416
|
+
*
|
|
6417
|
+
* 当组件被添加或移除时调用,立即通知相关系统检查该实体是否匹配,
|
|
6418
|
+
* 并触发 onAdded/onRemoved 回调。通过组件ID索引优化,只通知关心该组件的系统。
|
|
6419
|
+
*
|
|
6420
|
+
* Notify relevant systems that an entity's components have changed.
|
|
6421
|
+
* Called when a component is added or removed, immediately notifying
|
|
6422
|
+
* relevant systems to check if the entity matches and trigger onAdded/onRemoved callbacks.
|
|
6423
|
+
* Optimized via component ID indexing to only notify systems that care about the changed component.
|
|
6424
|
+
*
|
|
6425
|
+
* @param entity 组件发生变化的实体 | The entity whose components changed
|
|
6426
|
+
* @param changedComponentType 变化的组件类型(可选) | The changed component type (optional)
|
|
6427
|
+
*/
|
|
6428
|
+
notifyEntityComponentChanged(entity: Entity, changedComponentType?: ComponentType): void;
|
|
6286
6429
|
/**
|
|
6287
6430
|
* 添加实体
|
|
6288
6431
|
*/
|
|
@@ -6646,6 +6789,10 @@ declare class Entity {
|
|
|
6646
6789
|
private addComponentInternal;
|
|
6647
6790
|
/**
|
|
6648
6791
|
* 通知Scene中的QuerySystem实体组件发生变动
|
|
6792
|
+
*
|
|
6793
|
+
* Notify the QuerySystem in Scene that entity components have changed
|
|
6794
|
+
*
|
|
6795
|
+
* @param changedComponentType 变化的组件类型(可选,用于优化通知) | Changed component type (optional, for optimized notification)
|
|
6649
6796
|
*/
|
|
6650
6797
|
private notifyQuerySystems;
|
|
6651
6798
|
/**
|