@esengine/ecs-framework 2.1.16 → 2.1.17
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/README.md +33 -10
- package/index.d.ts +216 -223
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.umd.js +1 -1
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,18 +104,41 @@ scene.addEntityProcessor(new MovementSystem());
|
|
|
104
104
|
|
|
105
105
|
### 游戏循环
|
|
106
106
|
|
|
107
|
+
ECS框架需要在游戏引擎的更新循环中调用:
|
|
108
|
+
|
|
107
109
|
```typescript
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
// 统一的API:传入deltaTime
|
|
111
|
+
Core.update(deltaTime);
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**不同引擎的集成示例:**
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// Laya引擎
|
|
118
|
+
Laya.timer.frameLoop(1, this, () => {
|
|
119
|
+
const deltaTime = Laya.timer.delta / 1000; // 转换为秒
|
|
120
|
+
Core.update(deltaTime);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Cocos Creator
|
|
124
|
+
update(deltaTime: number) {
|
|
125
|
+
Core.update(deltaTime);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Unity (C#)
|
|
129
|
+
void Update() {
|
|
130
|
+
Core.Update(Time.deltaTime);
|
|
116
131
|
}
|
|
117
132
|
|
|
118
|
-
|
|
133
|
+
// 原生浏览器环境
|
|
134
|
+
let lastTime = 0;
|
|
135
|
+
function gameLoop(currentTime: number) {
|
|
136
|
+
const deltaTime = lastTime > 0 ? (currentTime - lastTime) / 1000 : 0.016;
|
|
137
|
+
lastTime = currentTime;
|
|
138
|
+
Core.update(deltaTime);
|
|
139
|
+
requestAnimationFrame(gameLoop);
|
|
140
|
+
}
|
|
141
|
+
requestAnimationFrame(gameLoop);
|
|
119
142
|
```
|
|
120
143
|
|
|
121
144
|
## 实体管理器
|
|
@@ -312,7 +335,7 @@ ecs-framework/
|
|
|
312
335
|
|
|
313
336
|
### 🎯 新手入门
|
|
314
337
|
- **[📖 新手教程完整指南](docs/beginner-tutorials.md)** - 完整学习路径,从零开始 ⭐ **强烈推荐**
|
|
315
|
-
- [🚀 快速入门](docs/getting-started.md) -
|
|
338
|
+
- **[🚀 快速入门](docs/getting-started.md)** - 详细的入门教程,包含Laya/Cocos/Node.js集成指南 ⭐ **平台集成必读**
|
|
316
339
|
- [🧠 技术概念详解](docs/concepts-explained.md) - 通俗易懂的技术概念解释 ⭐ **推荐新手阅读**
|
|
317
340
|
- [🎯 位掩码使用指南](docs/bitmask-guide.md) - 位掩码概念、原理和高级使用技巧
|
|
318
341
|
- [💡 使用场景示例](docs/use-cases.md) - 不同类型游戏的具体应用案例
|
package/index.d.ts
CHANGED
|
@@ -1,204 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @esengine/ecs-framework v2.1.
|
|
2
|
+
* @esengine/ecs-framework v2.1.17
|
|
3
3
|
* TypeScript definitions
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
* 用于包装事件的一个小类
|
|
7
|
-
*/
|
|
8
|
-
declare class FuncPack {
|
|
9
|
-
/** 函数 */
|
|
10
|
-
func: Function;
|
|
11
|
-
/** 上下文 */
|
|
12
|
-
context: any;
|
|
13
|
-
constructor(func: Function, context: any);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* 用于事件管理
|
|
17
|
-
*/
|
|
18
|
-
declare class Emitter<T> {
|
|
19
|
-
private _messageTable;
|
|
20
|
-
constructor();
|
|
21
|
-
/**
|
|
22
|
-
* 开始监听项
|
|
23
|
-
* @param eventType 监听类型
|
|
24
|
-
* @param handler 监听函数
|
|
25
|
-
* @param context 监听上下文
|
|
26
|
-
*/
|
|
27
|
-
addObserver(eventType: T, handler: Function, context: any): void;
|
|
28
|
-
/**
|
|
29
|
-
* 移除监听项
|
|
30
|
-
* @param eventType 事件类型
|
|
31
|
-
* @param handler 事件函数
|
|
32
|
-
*/
|
|
33
|
-
removeObserver(eventType: T, handler: Function): void;
|
|
34
|
-
/**
|
|
35
|
-
* 触发该事件
|
|
36
|
-
* @param eventType 事件类型
|
|
37
|
-
* @param data 事件数据
|
|
38
|
-
*/
|
|
39
|
-
emit(eventType: T, ...data: any[]): void;
|
|
40
|
-
/**
|
|
41
|
-
* 判断是否存在该类型的观察者
|
|
42
|
-
* @param eventType 事件类型
|
|
43
|
-
* @param handler 事件函数
|
|
44
|
-
*/
|
|
45
|
-
hasObserver(eventType: T, handler: Function): boolean;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* 核心事件枚举
|
|
50
|
-
* 定义框架中的核心事件类型
|
|
51
|
-
*/
|
|
52
|
-
declare enum CoreEvents {
|
|
53
|
-
/**
|
|
54
|
-
* 当场景发生变化时触发
|
|
55
|
-
*/
|
|
56
|
-
sceneChanged = 0,
|
|
57
|
-
/**
|
|
58
|
-
* 每帧更新事件
|
|
59
|
-
*/
|
|
60
|
-
frameUpdated = 1,
|
|
61
|
-
/**
|
|
62
|
-
* 当渲染发生时触发
|
|
63
|
-
*/
|
|
64
|
-
renderChanged = 2
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* ECS事件类型枚举
|
|
68
|
-
* 定义实体组件系统中的所有事件类型
|
|
69
|
-
*/
|
|
70
|
-
declare enum ECSEventType {
|
|
71
|
-
ENTITY_CREATED = "entity:created",
|
|
72
|
-
ENTITY_DESTROYED = "entity:destroyed",
|
|
73
|
-
ENTITY_ENABLED = "entity:enabled",
|
|
74
|
-
ENTITY_DISABLED = "entity:disabled",
|
|
75
|
-
ENTITY_TAG_ADDED = "entity:tag:added",
|
|
76
|
-
ENTITY_TAG_REMOVED = "entity:tag:removed",
|
|
77
|
-
ENTITY_NAME_CHANGED = "entity:name:changed",
|
|
78
|
-
COMPONENT_ADDED = "component:added",
|
|
79
|
-
COMPONENT_REMOVED = "component:removed",
|
|
80
|
-
COMPONENT_MODIFIED = "component:modified",
|
|
81
|
-
COMPONENT_ENABLED = "component:enabled",
|
|
82
|
-
COMPONENT_DISABLED = "component:disabled",
|
|
83
|
-
SYSTEM_ADDED = "system:added",
|
|
84
|
-
SYSTEM_REMOVED = "system:removed",
|
|
85
|
-
SYSTEM_ENABLED = "system:enabled",
|
|
86
|
-
SYSTEM_DISABLED = "system:disabled",
|
|
87
|
-
SYSTEM_PROCESSING_START = "system:processing:start",
|
|
88
|
-
SYSTEM_PROCESSING_END = "system:processing:end",
|
|
89
|
-
SYSTEM_ERROR = "system:error",
|
|
90
|
-
SCENE_CREATED = "scene:created",
|
|
91
|
-
SCENE_DESTROYED = "scene:destroyed",
|
|
92
|
-
SCENE_ACTIVATED = "scene:activated",
|
|
93
|
-
SCENE_DEACTIVATED = "scene:deactivated",
|
|
94
|
-
SCENE_PAUSED = "scene:paused",
|
|
95
|
-
SCENE_RESUMED = "scene:resumed",
|
|
96
|
-
QUERY_EXECUTED = "query:executed",
|
|
97
|
-
QUERY_CACHE_HIT = "query:cache:hit",
|
|
98
|
-
QUERY_CACHE_MISS = "query:cache:miss",
|
|
99
|
-
QUERY_OPTIMIZED = "query:optimized",
|
|
100
|
-
PERFORMANCE_WARNING = "performance:warning",
|
|
101
|
-
PERFORMANCE_CRITICAL = "performance:critical",
|
|
102
|
-
MEMORY_USAGE_HIGH = "memory:usage:high",
|
|
103
|
-
FRAME_RATE_DROP = "frame:rate:drop",
|
|
104
|
-
INDEX_CREATED = "index:created",
|
|
105
|
-
INDEX_UPDATED = "index:updated",
|
|
106
|
-
INDEX_OPTIMIZED = "index:optimized",
|
|
107
|
-
ARCHETYPE_CREATED = "archetype:created",
|
|
108
|
-
ARCHETYPE_ENTITY_ADDED = "archetype:entity:added",
|
|
109
|
-
ARCHETYPE_ENTITY_REMOVED = "archetype:entity:removed",
|
|
110
|
-
DIRTY_MARK_ADDED = "dirty:mark:added",
|
|
111
|
-
DIRTY_BATCH_PROCESSED = "dirty:batch:processed",
|
|
112
|
-
ERROR_OCCURRED = "error:occurred",
|
|
113
|
-
WARNING_ISSUED = "warning:issued",
|
|
114
|
-
FRAMEWORK_INITIALIZED = "framework:initialized",
|
|
115
|
-
FRAMEWORK_SHUTDOWN = "framework:shutdown",
|
|
116
|
-
DEBUG_INFO = "debug:info",
|
|
117
|
-
DEBUG_STATS_UPDATED = "debug:stats:updated"
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* 事件优先级枚举
|
|
121
|
-
* 定义事件处理的优先级级别
|
|
122
|
-
*/
|
|
123
|
-
declare enum EventPriority {
|
|
124
|
-
LOWEST = 0,
|
|
125
|
-
LOW = 25,
|
|
126
|
-
NORMAL = 50,
|
|
127
|
-
HIGH = 75,
|
|
128
|
-
HIGHEST = 100,
|
|
129
|
-
CRITICAL = 200
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* 预定义的事件类型常量
|
|
133
|
-
* 提供类型安全的事件类型字符串
|
|
134
|
-
*/
|
|
135
|
-
declare const EVENT_TYPES: {
|
|
136
|
-
readonly CORE: {
|
|
137
|
-
readonly SCENE_CHANGED: "core:scene:changed";
|
|
138
|
-
readonly FRAME_UPDATED: "core:frame:updated";
|
|
139
|
-
readonly RENDER_CHANGED: "core:render:changed";
|
|
140
|
-
};
|
|
141
|
-
readonly ENTITY: {
|
|
142
|
-
readonly CREATED: ECSEventType.ENTITY_CREATED;
|
|
143
|
-
readonly DESTROYED: ECSEventType.ENTITY_DESTROYED;
|
|
144
|
-
readonly ENABLED: ECSEventType.ENTITY_ENABLED;
|
|
145
|
-
readonly DISABLED: ECSEventType.ENTITY_DISABLED;
|
|
146
|
-
readonly TAG_ADDED: ECSEventType.ENTITY_TAG_ADDED;
|
|
147
|
-
readonly TAG_REMOVED: ECSEventType.ENTITY_TAG_REMOVED;
|
|
148
|
-
readonly NAME_CHANGED: ECSEventType.ENTITY_NAME_CHANGED;
|
|
149
|
-
};
|
|
150
|
-
readonly COMPONENT: {
|
|
151
|
-
readonly ADDED: ECSEventType.COMPONENT_ADDED;
|
|
152
|
-
readonly REMOVED: ECSEventType.COMPONENT_REMOVED;
|
|
153
|
-
readonly MODIFIED: ECSEventType.COMPONENT_MODIFIED;
|
|
154
|
-
readonly ENABLED: ECSEventType.COMPONENT_ENABLED;
|
|
155
|
-
readonly DISABLED: ECSEventType.COMPONENT_DISABLED;
|
|
156
|
-
};
|
|
157
|
-
readonly SYSTEM: {
|
|
158
|
-
readonly ADDED: ECSEventType.SYSTEM_ADDED;
|
|
159
|
-
readonly REMOVED: ECSEventType.SYSTEM_REMOVED;
|
|
160
|
-
readonly ENABLED: ECSEventType.SYSTEM_ENABLED;
|
|
161
|
-
readonly DISABLED: ECSEventType.SYSTEM_DISABLED;
|
|
162
|
-
readonly PROCESSING_START: ECSEventType.SYSTEM_PROCESSING_START;
|
|
163
|
-
readonly PROCESSING_END: ECSEventType.SYSTEM_PROCESSING_END;
|
|
164
|
-
readonly ERROR: ECSEventType.SYSTEM_ERROR;
|
|
165
|
-
};
|
|
166
|
-
readonly PERFORMANCE: {
|
|
167
|
-
readonly WARNING: ECSEventType.PERFORMANCE_WARNING;
|
|
168
|
-
readonly CRITICAL: ECSEventType.PERFORMANCE_CRITICAL;
|
|
169
|
-
readonly MEMORY_HIGH: ECSEventType.MEMORY_USAGE_HIGH;
|
|
170
|
-
readonly FRAME_DROP: ECSEventType.FRAME_RATE_DROP;
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* 事件类型验证器
|
|
175
|
-
* 验证事件类型是否有效
|
|
176
|
-
*/
|
|
177
|
-
declare class EventTypeValidator {
|
|
178
|
-
private static validTypes;
|
|
179
|
-
/**
|
|
180
|
-
* 验证事件类型是否有效
|
|
181
|
-
* @param eventType 事件类型
|
|
182
|
-
* @returns 是否有效
|
|
183
|
-
*/
|
|
184
|
-
static isValid(eventType: string): boolean;
|
|
185
|
-
/**
|
|
186
|
-
* 获取所有有效的事件类型
|
|
187
|
-
* @returns 事件类型数组
|
|
188
|
-
*/
|
|
189
|
-
static getAllValidTypes(): string[];
|
|
190
|
-
/**
|
|
191
|
-
* 添加自定义事件类型
|
|
192
|
-
* @param eventType 事件类型
|
|
193
|
-
*/
|
|
194
|
-
static addCustomType(eventType: string): void;
|
|
195
|
-
/**
|
|
196
|
-
* 移除自定义事件类型
|
|
197
|
-
* @param eventType 事件类型
|
|
198
|
-
*/
|
|
199
|
-
static removeCustomType(eventType: string): void;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
5
|
/**
|
|
203
6
|
* 全局管理器的基类。所有全局管理器都应该从此类继承。
|
|
204
7
|
*/
|
|
@@ -3920,7 +3723,7 @@ declare function createECSAPI(scene: Scene, querySystem: QuerySystem, eventSyste
|
|
|
3920
3723
|
* 游戏引擎核心类
|
|
3921
3724
|
*
|
|
3922
3725
|
* 负责管理游戏的生命周期、场景切换、全局管理器和定时器系统。
|
|
3923
|
-
*
|
|
3726
|
+
* 提供统一的游戏循环管理。
|
|
3924
3727
|
*
|
|
3925
3728
|
* @example
|
|
3926
3729
|
* ```typescript
|
|
@@ -3930,6 +3733,12 @@ declare function createECSAPI(scene: Scene, querySystem: QuerySystem, eventSyste
|
|
|
3930
3733
|
* // 设置场景
|
|
3931
3734
|
* Core.scene = new MyScene();
|
|
3932
3735
|
*
|
|
3736
|
+
* // 在游戏循环中更新(Laya引擎示例)
|
|
3737
|
+
* Laya.timer.frameLoop(1, this, () => {
|
|
3738
|
+
* const deltaTime = Laya.timer.delta / 1000;
|
|
3739
|
+
* Core.update(deltaTime);
|
|
3740
|
+
* });
|
|
3741
|
+
*
|
|
3933
3742
|
* // 调度定时器
|
|
3934
3743
|
* Core.schedule(1.0, false, null, (timer) => {
|
|
3935
3744
|
* console.log("1秒后执行");
|
|
@@ -3937,12 +3746,6 @@ declare function createECSAPI(scene: Scene, querySystem: QuerySystem, eventSyste
|
|
|
3937
3746
|
* ```
|
|
3938
3747
|
*/
|
|
3939
3748
|
declare class Core {
|
|
3940
|
-
/**
|
|
3941
|
-
* 核心事件发射器
|
|
3942
|
-
*
|
|
3943
|
-
* 用于发布和订阅核心级别的事件,如帧更新、场景切换等。
|
|
3944
|
-
*/
|
|
3945
|
-
static emitter: Emitter<CoreEvents>;
|
|
3946
3749
|
/**
|
|
3947
3750
|
* 游戏暂停状态
|
|
3948
3751
|
*
|
|
@@ -4039,10 +3842,36 @@ declare class Core {
|
|
|
4039
3842
|
* 如果实例已存在,则返回现有实例。
|
|
4040
3843
|
*
|
|
4041
3844
|
* @param debug - 是否为调试模式,默认为true
|
|
4042
|
-
* @param options - 额外的配置选项
|
|
4043
3845
|
* @returns Core实例
|
|
4044
3846
|
*/
|
|
4045
3847
|
static create(debug?: boolean): Core;
|
|
3848
|
+
/**
|
|
3849
|
+
* 更新游戏逻辑
|
|
3850
|
+
*
|
|
3851
|
+
* 此方法应该在游戏引擎的更新循环中调用。
|
|
3852
|
+
*
|
|
3853
|
+
* @param deltaTime - 外部引擎提供的帧时间间隔(秒)
|
|
3854
|
+
*
|
|
3855
|
+
* @example
|
|
3856
|
+
* ```typescript
|
|
3857
|
+
* // Laya引擎
|
|
3858
|
+
* Laya.timer.frameLoop(1, this, () => {
|
|
3859
|
+
* const deltaTime = Laya.timer.delta / 1000;
|
|
3860
|
+
* Core.update(deltaTime);
|
|
3861
|
+
* });
|
|
3862
|
+
*
|
|
3863
|
+
* // Cocos Creator
|
|
3864
|
+
* update(deltaTime: number) {
|
|
3865
|
+
* Core.update(deltaTime);
|
|
3866
|
+
* }
|
|
3867
|
+
*
|
|
3868
|
+
* // Unity (C#)
|
|
3869
|
+
* void Update() {
|
|
3870
|
+
* Core.Update(Time.deltaTime);
|
|
3871
|
+
* }
|
|
3872
|
+
* ```
|
|
3873
|
+
*/
|
|
3874
|
+
static update(deltaTime: number): void;
|
|
4046
3875
|
/**
|
|
4047
3876
|
* 注册全局管理器
|
|
4048
3877
|
*
|
|
@@ -4097,13 +3926,185 @@ declare class Core {
|
|
|
4097
3926
|
*/
|
|
4098
3927
|
protected initialize(): void;
|
|
4099
3928
|
/**
|
|
4100
|
-
*
|
|
3929
|
+
* 内部更新方法
|
|
4101
3930
|
*
|
|
4102
|
-
*
|
|
4103
|
-
|
|
4104
|
-
|
|
3931
|
+
* @param deltaTime - 帧时间间隔(秒)
|
|
3932
|
+
*/
|
|
3933
|
+
private updateInternal;
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
/**
|
|
3937
|
+
* 用于包装事件的一个小类
|
|
3938
|
+
*/
|
|
3939
|
+
declare class FuncPack {
|
|
3940
|
+
/** 函数 */
|
|
3941
|
+
func: Function;
|
|
3942
|
+
/** 上下文 */
|
|
3943
|
+
context: any;
|
|
3944
|
+
constructor(func: Function, context: any);
|
|
3945
|
+
}
|
|
3946
|
+
/**
|
|
3947
|
+
* 用于事件管理
|
|
3948
|
+
*/
|
|
3949
|
+
declare class Emitter<T> {
|
|
3950
|
+
private _messageTable;
|
|
3951
|
+
constructor();
|
|
3952
|
+
/**
|
|
3953
|
+
* 开始监听项
|
|
3954
|
+
* @param eventType 监听类型
|
|
3955
|
+
* @param handler 监听函数
|
|
3956
|
+
* @param context 监听上下文
|
|
3957
|
+
*/
|
|
3958
|
+
addObserver(eventType: T, handler: Function, context: any): void;
|
|
3959
|
+
/**
|
|
3960
|
+
* 移除监听项
|
|
3961
|
+
* @param eventType 事件类型
|
|
3962
|
+
* @param handler 事件函数
|
|
3963
|
+
*/
|
|
3964
|
+
removeObserver(eventType: T, handler: Function): void;
|
|
3965
|
+
/**
|
|
3966
|
+
* 触发该事件
|
|
3967
|
+
* @param eventType 事件类型
|
|
3968
|
+
* @param data 事件数据
|
|
3969
|
+
*/
|
|
3970
|
+
emit(eventType: T, ...data: any[]): void;
|
|
3971
|
+
/**
|
|
3972
|
+
* 判断是否存在该类型的观察者
|
|
3973
|
+
* @param eventType 事件类型
|
|
3974
|
+
* @param handler 事件函数
|
|
3975
|
+
*/
|
|
3976
|
+
hasObserver(eventType: T, handler: Function): boolean;
|
|
3977
|
+
}
|
|
3978
|
+
|
|
3979
|
+
/**
|
|
3980
|
+
* ECS事件类型枚举
|
|
3981
|
+
* 定义实体组件系统中的所有事件类型
|
|
3982
|
+
*/
|
|
3983
|
+
declare enum ECSEventType {
|
|
3984
|
+
ENTITY_CREATED = "entity:created",
|
|
3985
|
+
ENTITY_DESTROYED = "entity:destroyed",
|
|
3986
|
+
ENTITY_ENABLED = "entity:enabled",
|
|
3987
|
+
ENTITY_DISABLED = "entity:disabled",
|
|
3988
|
+
ENTITY_TAG_ADDED = "entity:tag:added",
|
|
3989
|
+
ENTITY_TAG_REMOVED = "entity:tag:removed",
|
|
3990
|
+
ENTITY_NAME_CHANGED = "entity:name:changed",
|
|
3991
|
+
COMPONENT_ADDED = "component:added",
|
|
3992
|
+
COMPONENT_REMOVED = "component:removed",
|
|
3993
|
+
COMPONENT_MODIFIED = "component:modified",
|
|
3994
|
+
COMPONENT_ENABLED = "component:enabled",
|
|
3995
|
+
COMPONENT_DISABLED = "component:disabled",
|
|
3996
|
+
SYSTEM_ADDED = "system:added",
|
|
3997
|
+
SYSTEM_REMOVED = "system:removed",
|
|
3998
|
+
SYSTEM_ENABLED = "system:enabled",
|
|
3999
|
+
SYSTEM_DISABLED = "system:disabled",
|
|
4000
|
+
SYSTEM_PROCESSING_START = "system:processing:start",
|
|
4001
|
+
SYSTEM_PROCESSING_END = "system:processing:end",
|
|
4002
|
+
SYSTEM_ERROR = "system:error",
|
|
4003
|
+
SCENE_CREATED = "scene:created",
|
|
4004
|
+
SCENE_DESTROYED = "scene:destroyed",
|
|
4005
|
+
SCENE_ACTIVATED = "scene:activated",
|
|
4006
|
+
SCENE_DEACTIVATED = "scene:deactivated",
|
|
4007
|
+
SCENE_PAUSED = "scene:paused",
|
|
4008
|
+
SCENE_RESUMED = "scene:resumed",
|
|
4009
|
+
QUERY_EXECUTED = "query:executed",
|
|
4010
|
+
QUERY_CACHE_HIT = "query:cache:hit",
|
|
4011
|
+
QUERY_CACHE_MISS = "query:cache:miss",
|
|
4012
|
+
QUERY_OPTIMIZED = "query:optimized",
|
|
4013
|
+
PERFORMANCE_WARNING = "performance:warning",
|
|
4014
|
+
PERFORMANCE_CRITICAL = "performance:critical",
|
|
4015
|
+
MEMORY_USAGE_HIGH = "memory:usage:high",
|
|
4016
|
+
FRAME_RATE_DROP = "frame:rate:drop",
|
|
4017
|
+
INDEX_CREATED = "index:created",
|
|
4018
|
+
INDEX_UPDATED = "index:updated",
|
|
4019
|
+
INDEX_OPTIMIZED = "index:optimized",
|
|
4020
|
+
ARCHETYPE_CREATED = "archetype:created",
|
|
4021
|
+
ARCHETYPE_ENTITY_ADDED = "archetype:entity:added",
|
|
4022
|
+
ARCHETYPE_ENTITY_REMOVED = "archetype:entity:removed",
|
|
4023
|
+
DIRTY_MARK_ADDED = "dirty:mark:added",
|
|
4024
|
+
DIRTY_BATCH_PROCESSED = "dirty:batch:processed",
|
|
4025
|
+
ERROR_OCCURRED = "error:occurred",
|
|
4026
|
+
WARNING_ISSUED = "warning:issued",
|
|
4027
|
+
FRAMEWORK_INITIALIZED = "framework:initialized",
|
|
4028
|
+
FRAMEWORK_SHUTDOWN = "framework:shutdown",
|
|
4029
|
+
DEBUG_INFO = "debug:info",
|
|
4030
|
+
DEBUG_STATS_UPDATED = "debug:stats:updated"
|
|
4031
|
+
}
|
|
4032
|
+
/**
|
|
4033
|
+
* 事件优先级枚举
|
|
4034
|
+
* 定义事件处理的优先级级别
|
|
4035
|
+
*/
|
|
4036
|
+
declare enum EventPriority {
|
|
4037
|
+
LOWEST = 0,
|
|
4038
|
+
LOW = 25,
|
|
4039
|
+
NORMAL = 50,
|
|
4040
|
+
HIGH = 75,
|
|
4041
|
+
HIGHEST = 100,
|
|
4042
|
+
CRITICAL = 200
|
|
4043
|
+
}
|
|
4044
|
+
/**
|
|
4045
|
+
* 预定义的事件类型常量
|
|
4046
|
+
* 提供类型安全的事件类型字符串
|
|
4047
|
+
*/
|
|
4048
|
+
declare const EVENT_TYPES: {
|
|
4049
|
+
readonly ENTITY: {
|
|
4050
|
+
readonly CREATED: ECSEventType.ENTITY_CREATED;
|
|
4051
|
+
readonly DESTROYED: ECSEventType.ENTITY_DESTROYED;
|
|
4052
|
+
readonly ENABLED: ECSEventType.ENTITY_ENABLED;
|
|
4053
|
+
readonly DISABLED: ECSEventType.ENTITY_DISABLED;
|
|
4054
|
+
readonly TAG_ADDED: ECSEventType.ENTITY_TAG_ADDED;
|
|
4055
|
+
readonly TAG_REMOVED: ECSEventType.ENTITY_TAG_REMOVED;
|
|
4056
|
+
readonly NAME_CHANGED: ECSEventType.ENTITY_NAME_CHANGED;
|
|
4057
|
+
};
|
|
4058
|
+
readonly COMPONENT: {
|
|
4059
|
+
readonly ADDED: ECSEventType.COMPONENT_ADDED;
|
|
4060
|
+
readonly REMOVED: ECSEventType.COMPONENT_REMOVED;
|
|
4061
|
+
readonly MODIFIED: ECSEventType.COMPONENT_MODIFIED;
|
|
4062
|
+
readonly ENABLED: ECSEventType.COMPONENT_ENABLED;
|
|
4063
|
+
readonly DISABLED: ECSEventType.COMPONENT_DISABLED;
|
|
4064
|
+
};
|
|
4065
|
+
readonly SYSTEM: {
|
|
4066
|
+
readonly ADDED: ECSEventType.SYSTEM_ADDED;
|
|
4067
|
+
readonly REMOVED: ECSEventType.SYSTEM_REMOVED;
|
|
4068
|
+
readonly ENABLED: ECSEventType.SYSTEM_ENABLED;
|
|
4069
|
+
readonly DISABLED: ECSEventType.SYSTEM_DISABLED;
|
|
4070
|
+
readonly PROCESSING_START: ECSEventType.SYSTEM_PROCESSING_START;
|
|
4071
|
+
readonly PROCESSING_END: ECSEventType.SYSTEM_PROCESSING_END;
|
|
4072
|
+
readonly ERROR: ECSEventType.SYSTEM_ERROR;
|
|
4073
|
+
};
|
|
4074
|
+
readonly PERFORMANCE: {
|
|
4075
|
+
readonly WARNING: ECSEventType.PERFORMANCE_WARNING;
|
|
4076
|
+
readonly CRITICAL: ECSEventType.PERFORMANCE_CRITICAL;
|
|
4077
|
+
readonly MEMORY_HIGH: ECSEventType.MEMORY_USAGE_HIGH;
|
|
4078
|
+
readonly FRAME_DROP: ECSEventType.FRAME_RATE_DROP;
|
|
4079
|
+
};
|
|
4080
|
+
};
|
|
4081
|
+
/**
|
|
4082
|
+
* 事件类型验证器
|
|
4083
|
+
* 验证事件类型是否有效
|
|
4084
|
+
*/
|
|
4085
|
+
declare class EventTypeValidator {
|
|
4086
|
+
private static validTypes;
|
|
4087
|
+
/**
|
|
4088
|
+
* 验证事件类型是否有效
|
|
4089
|
+
* @param eventType 事件类型
|
|
4090
|
+
* @returns 是否有效
|
|
4091
|
+
*/
|
|
4092
|
+
static isValid(eventType: string): boolean;
|
|
4093
|
+
/**
|
|
4094
|
+
* 获取所有有效的事件类型
|
|
4095
|
+
* @returns 事件类型数组
|
|
4105
4096
|
*/
|
|
4106
|
-
|
|
4097
|
+
static getAllValidTypes(): string[];
|
|
4098
|
+
/**
|
|
4099
|
+
* 添加自定义事件类型
|
|
4100
|
+
* @param eventType 事件类型
|
|
4101
|
+
*/
|
|
4102
|
+
static addCustomType(eventType: string): void;
|
|
4103
|
+
/**
|
|
4104
|
+
* 移除自定义事件类型
|
|
4105
|
+
* @param eventType 事件类型
|
|
4106
|
+
*/
|
|
4107
|
+
static removeCustomType(eventType: string): void;
|
|
4107
4108
|
}
|
|
4108
4109
|
|
|
4109
4110
|
/**
|
|
@@ -5043,18 +5044,10 @@ declare class Time {
|
|
|
5043
5044
|
*/
|
|
5044
5045
|
static frameCount: number;
|
|
5045
5046
|
/**
|
|
5046
|
-
*
|
|
5047
|
-
|
|
5048
|
-
private static _lastTime;
|
|
5049
|
-
/**
|
|
5050
|
-
* 是否为第一次更新
|
|
5051
|
-
*/
|
|
5052
|
-
private static _isFirstUpdate;
|
|
5053
|
-
/**
|
|
5054
|
-
* 更新时间信息
|
|
5055
|
-
* @param currentTime 当前时间戳(毫秒)
|
|
5047
|
+
* 使用外部引擎提供的deltaTime更新时间信息
|
|
5048
|
+
* @param deltaTime 外部引擎提供的帧时间间隔(秒)
|
|
5056
5049
|
*/
|
|
5057
|
-
static update(
|
|
5050
|
+
static update(deltaTime: number): void;
|
|
5058
5051
|
/**
|
|
5059
5052
|
* 场景改变时重置时间
|
|
5060
5053
|
*/
|
|
@@ -5068,5 +5061,5 @@ declare class Time {
|
|
|
5068
5061
|
static checkEvery(interval: number, lastTime: number): boolean;
|
|
5069
5062
|
}
|
|
5070
5063
|
|
|
5071
|
-
export { ArchetypeSystem, AsyncEventHandler$1 as AsyncEventHandler, BitMaskOptimizer, BitmapComponentIndex, Bits, Component, ComponentIndexManager, ComponentPool, ComponentStorage, ComponentTypeManager, Core,
|
|
5064
|
+
export { ArchetypeSystem, AsyncEventHandler$1 as AsyncEventHandler, BitMaskOptimizer, BitmapComponentIndex, Bits, Component, ComponentIndexManager, ComponentPool, ComponentStorage, ComponentTypeManager, Core, DirtyFlag, DirtyTrackingSystem, ECSEventType, ECSFluentAPI, EVENT_TYPES, Emitter, Entity, EntityList, EntityManager, EntityProcessorList, EntityQueryBuilder, EntitySystem, EventBus, EventHandler$1 as EventHandler, EventPriority, EventTypeValidator, FuncPack, GlobalEventBus, GlobalManager, HashComponentIndex, IdentifierPool, IndexType, IndexUpdateBatcher, IntervalSystem, Matcher, NumberExtension, PassiveSystem, PerformanceMonitor, PerformanceWarningType, Pool, PoolManager, ProcessingSystem, QuerySystem, Scene, TieredObjectPool, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, createECSAPI };
|
|
5072
5065
|
export type { Archetype, ArchetypeQueryResult, ComponentType$1 as ComponentType, DirtyData, DirtyListener, EventListenerConfig, EventStats, IComponent, IComponentEventData, IEntityEventData, IEventBus, IEventData, IEventListenerConfig, IEventStats, IPerformanceEventData, IPoolable, ISceneEventData, ISystemBase, ISystemEventData, ITimer, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PoolStats };
|