knight-web 2.0.2 → 2.0.4
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/frame/base/AbstractObject.d.ts +36 -36
- package/frame/base/AbstractPanel.d.ts +4 -4
- package/frame/base/index.d.ts +2 -2
- package/frame/core/Knight.d.ts +42 -42
- package/frame/core/Navgation.d.ts +26 -26
- package/frame/core/index.d.ts +2 -2
- package/frame/index.d.ts +3 -4
- package/frame/utility/BrowserUtility.d.ts +320 -320
- package/frame/utility/ConfigUtility.d.ts +33 -33
- package/frame/utility/CryptoUtility.d.ts +215 -215
- package/frame/utility/EnumUtility.d.ts +886 -886
- package/frame/utility/FileUtility.d.ts +31 -31
- package/frame/utility/InputUtility.d.ts +20 -20
- package/frame/utility/InterfaceUtility.d.ts +13 -13
- package/frame/utility/LogUtility.d.ts +44 -44
- package/frame/utility/MathUtility.d.ts +559 -559
- package/frame/utility/NetworkUtility.d.ts +155 -155
- package/frame/utility/ObjectUtility.d.ts +308 -308
- package/frame/utility/ProfilerUtility.d.ts +37 -37
- package/frame/utility/PromiseUtility.d.ts +89 -89
- package/frame/utility/ReflectionUtility.d.ts +316 -316
- package/frame/utility/StringUtility.d.ts +55 -55
- package/frame/utility/index.d.ts +15 -15
- package/index.d.ts +1 -1
- package/knight-web.js +84 -0
- package/knight-web.js.map +1 -0
- package/package.json +2 -2
- package/readme.md +36 -0
- package/knight.js +0 -63
- package/knight.js.map +0 -1
|
@@ -1,308 +1,308 @@
|
|
|
1
|
-
/*********************************************************************************
|
|
2
|
-
* FileName : ObjectPool
|
|
3
|
-
* FileBasename : ObjectPool.ts
|
|
4
|
-
* Author : Seven_9t
|
|
5
|
-
* Date : Sat Mar 25 2023 15:05:05 GMT+0800 (中国标准时间)
|
|
6
|
-
* Description : db://assets/frame/script/base/ObjectPool.ts
|
|
7
|
-
* Version : v3.6
|
|
8
|
-
* Others : 修改默认TS脚本模板路径 D:\Cocos\CocosDashboard\resources\.editors\Creator\<Version>\resources\resources\3d\engine\editor\assets\default_file_content\ts
|
|
9
|
-
* ManualUrl : <指南手册> https://docs.cocos.com/creator/3.6/manual/zh/
|
|
10
|
-
* : <脚本手册> https://docs.cocos.com/creator/3.6/manual/zh/scripting/
|
|
11
|
-
* : <接口手册> https://docs.cocos.com/creator/api/zh/#/docs/3.6/zh/README
|
|
12
|
-
* : <生命周期手册>https://docs.cocos.com/creator/3.6/manual/zh/scripting/life-cycle-callbacks.html
|
|
13
|
-
|
|
14
|
-
**********************************************************************************/
|
|
15
|
-
import { InterfaceUtility } from "./InterfaceUtility";
|
|
16
|
-
/** 对象工具 */
|
|
17
|
-
export declare namespace ObjectUtility {
|
|
18
|
-
/** 空对象类 */
|
|
19
|
-
export class EmptyObject {
|
|
20
|
-
}
|
|
21
|
-
/** 获取对象所有属性 */
|
|
22
|
-
export function GetPropertys<T>(_object: T): Array<string>;
|
|
23
|
-
/** 检测对象属性是否存在 */
|
|
24
|
-
export function HasProperty(_object: object, _propertyKey: string): boolean;
|
|
25
|
-
/** 是否是对象 */
|
|
26
|
-
export function IsObject(_target: any): boolean;
|
|
27
|
-
/** 是否是数组 */
|
|
28
|
-
export function IsArray(_target: any): boolean;
|
|
29
|
-
/** 是否是函数 */
|
|
30
|
-
export function IsFunction(_target: any): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* 判断是否继承自基类
|
|
33
|
-
* @param _target 目标对象实例
|
|
34
|
-
* @param _className 基类类名
|
|
35
|
-
* @returns 匹配结果
|
|
36
|
-
*/
|
|
37
|
-
export function InstanceOf(_target: object, _className: string): boolean;
|
|
38
|
-
/** 克隆对象 */
|
|
39
|
-
export function Clone<T>(_target: T, ...params: any[]): T;
|
|
40
|
-
/** 克隆并赋值 */
|
|
41
|
-
export function CloneAssign<T>(_target: T, ...params: any[]): T;
|
|
42
|
-
/** 数据赋值 */
|
|
43
|
-
export function Assign<T extends object>(_target: T, _source: Partial<object>): T;
|
|
44
|
-
/**
|
|
45
|
-
* 将对象序列化为Json字符串
|
|
46
|
-
* @param _object 一个JavaScript值,通常是要转换的对象或数组。
|
|
47
|
-
* @param _replacer 转换结果的函数。
|
|
48
|
-
* @param _space 在返回值JSON文本中添加缩进、空白和换行字符,使其更易于阅读。
|
|
49
|
-
* @returns 序列化后对象(需要自行转JSON.stringify)
|
|
50
|
-
*/
|
|
51
|
-
export function Encode(_object: object, _replacer?: (this: any, key: string, value: any) => any, _space?: string | number): Record<string, any>;
|
|
52
|
-
/** 将Json字符串反序列化为对象(对象带有函数则无效,需要执行浅拷贝或深拷贝) */
|
|
53
|
-
export function Decode<T extends object>(_target: InterfaceUtility.IType<T>, _source: T, ...params: any[]): T;
|
|
54
|
-
/** 浅拷贝 */
|
|
55
|
-
export function ShallowCopy<T extends object>(_target: InterfaceUtility.IType<T>, _source: T, ...params: any[]): T;
|
|
56
|
-
/** 深拷贝 */
|
|
57
|
-
export function DeepCopy<T extends object>(_target: InterfaceUtility.IType<T>, _source: T, ...params: any[]): T;
|
|
58
|
-
/** 深拷贝 TODO */
|
|
59
|
-
export function Deep(_target: any, _bitmask: boolean): any;
|
|
60
|
-
/** 深拷贝数组 */
|
|
61
|
-
export function DeepCopyArray(_target: any): any;
|
|
62
|
-
/** 对象操作泛型接口 */
|
|
63
|
-
interface IObjectOperation<T> {
|
|
64
|
-
/** 获取数量 */
|
|
65
|
-
get Count(): number;
|
|
66
|
-
/** 获取对象 */
|
|
67
|
-
Get(_key: number | string): T;
|
|
68
|
-
/** 获取对象组 */
|
|
69
|
-
Gets(_keys: Array<number | string>): Array<T>;
|
|
70
|
-
/** 获取所有对象 */
|
|
71
|
-
GetAll(): Array<T> | Map<string, T>;
|
|
72
|
-
/** 添加对象实例 */
|
|
73
|
-
Add(..._param: any[]): boolean;
|
|
74
|
-
/** 移除对象实例 */
|
|
75
|
-
Remove(_t: number | string | T): boolean;
|
|
76
|
-
/** 移除所有对象实例 */
|
|
77
|
-
RemoveAll(): void;
|
|
78
|
-
/** 对象实例是否存在 */
|
|
79
|
-
Exist(_t: number | string | T): boolean;
|
|
80
|
-
}
|
|
81
|
-
/** 对象池<数组> */
|
|
82
|
-
export class ArrayPool<T extends object | any> implements IObjectOperation<T> {
|
|
83
|
-
/** 对象池 */
|
|
84
|
-
private _tPools;
|
|
85
|
-
/** 构造函数 */
|
|
86
|
-
constructor();
|
|
87
|
-
/** 获取数量 */
|
|
88
|
-
get Count(): number;
|
|
89
|
-
/** 获取对象 */
|
|
90
|
-
Get<K extends T>(_index: number): K;
|
|
91
|
-
/** 获取对象组 */
|
|
92
|
-
Gets<K extends T>(_indexs: Array<number>): Array<K>;
|
|
93
|
-
/** 获取所有对象 */
|
|
94
|
-
GetAll(): Array<T>;
|
|
95
|
-
/** 添加对象实例 */
|
|
96
|
-
Add(_t: T): boolean;
|
|
97
|
-
/** 移除对象实例 */
|
|
98
|
-
Remove(_t: T | number): boolean;
|
|
99
|
-
/** 移除所有对象实例 */
|
|
100
|
-
RemoveAll(): void;
|
|
101
|
-
/** 对象实例是否存在 */
|
|
102
|
-
Exist(_t: T | number): boolean;
|
|
103
|
-
}
|
|
104
|
-
/** 对象池<字典> */
|
|
105
|
-
export class MapPool<T extends object> implements IObjectOperation<T> {
|
|
106
|
-
/** 对象池 */
|
|
107
|
-
private _tPools;
|
|
108
|
-
/** 构造函数 */
|
|
109
|
-
constructor(_map?: Map<string, T>);
|
|
110
|
-
/** 获取数量 */
|
|
111
|
-
get Count(): number;
|
|
112
|
-
/** 获取对象 */
|
|
113
|
-
Get<K extends T>(_key: string): K;
|
|
114
|
-
/** 获取对象组 */
|
|
115
|
-
Gets<K extends T>(_keys: Array<string>): Array<K>;
|
|
116
|
-
/** 获取所有对象 */
|
|
117
|
-
GetAll(): Map<string, T>;
|
|
118
|
-
/** 添加对象实例 */
|
|
119
|
-
Add(_key: string, _t: T): boolean;
|
|
120
|
-
/** 设置对象 */
|
|
121
|
-
Set<K extends T>(_key: string, _t: T): K;
|
|
122
|
-
/** 移除对象实例 */
|
|
123
|
-
Remove(_key: string): boolean;
|
|
124
|
-
/** 移除所有对象实例 */
|
|
125
|
-
RemoveAll(): void;
|
|
126
|
-
/** 对象实例是否存在 */
|
|
127
|
-
Exist(_t: string): boolean;
|
|
128
|
-
/** 所有键转数组 */
|
|
129
|
-
KeysToArray(): Array<string>;
|
|
130
|
-
/** 所有值转数组 */
|
|
131
|
-
ValuesToArray(): Array<T>;
|
|
132
|
-
}
|
|
133
|
-
/** 队列池<队列> */
|
|
134
|
-
export class QueuePool<T extends object> {
|
|
135
|
-
/** 队列数组 */
|
|
136
|
-
private _tPools;
|
|
137
|
-
constructor();
|
|
138
|
-
/** 入队 */
|
|
139
|
-
Enqueue(_t: T): void;
|
|
140
|
-
/** 出队 */
|
|
141
|
-
Dequeue(): T | undefined;
|
|
142
|
-
/** 查看队首元素 */
|
|
143
|
-
Peek(): T | undefined;
|
|
144
|
-
/** 判断队列是否为空 */
|
|
145
|
-
IsEmpty(): boolean;
|
|
146
|
-
/** 获取队列大小 */
|
|
147
|
-
Size(): number;
|
|
148
|
-
/** 清空队列 */
|
|
149
|
-
Clear(): void;
|
|
150
|
-
/** 克隆 */
|
|
151
|
-
Clone(): Array<T>;
|
|
152
|
-
}
|
|
153
|
-
/** 管线 */
|
|
154
|
-
export class PipeLine<T extends object> {
|
|
155
|
-
/** 事件管线 */
|
|
156
|
-
private _tPools;
|
|
157
|
-
/** 管线是否已启动 */
|
|
158
|
-
private _isStarted;
|
|
159
|
-
/** 管线是否已启动 */
|
|
160
|
-
private _isEnded;
|
|
161
|
-
/** 开关 */
|
|
162
|
-
private _switch;
|
|
163
|
-
constructor();
|
|
164
|
-
/** 获取数量 */
|
|
165
|
-
get Count(): number;
|
|
166
|
-
/** 注册事件 */
|
|
167
|
-
Register(_pipeline: ((_params: T) => Promise<T>) | PipeLine<T>): boolean;
|
|
168
|
-
/** 注销事件 */
|
|
169
|
-
Degister(_pipeline: ((_params: T) => Promise<T>) | PipeLine<T>): boolean;
|
|
170
|
-
/** 启动事件 */
|
|
171
|
-
Start(_params: T): Promise<T>;
|
|
172
|
-
/** 停止事件 */
|
|
173
|
-
Stop(): void;
|
|
174
|
-
}
|
|
175
|
-
/** 委托接口 */
|
|
176
|
-
export interface IDelegate {
|
|
177
|
-
/** 注册 */
|
|
178
|
-
Register(_key: string, _callback: InterfaceUtility.IEvent, _target: any, _times: number): boolean;
|
|
179
|
-
/** 注销 */
|
|
180
|
-
Degister(_key: string, _callback: InterfaceUtility.IEvent, _target: any): boolean;
|
|
181
|
-
/** 通知 */
|
|
182
|
-
Invoke(_key: string, ...params: Array<any>): Promise<void>;
|
|
183
|
-
/** 清除 */
|
|
184
|
-
Clear(): void;
|
|
185
|
-
}
|
|
186
|
-
/** 委托池(多绑定) */
|
|
187
|
-
export class DelegateMultiplePool implements IDelegate {
|
|
188
|
-
/** 对象池 */
|
|
189
|
-
private _tPools;
|
|
190
|
-
/** 构造函数 */
|
|
191
|
-
constructor();
|
|
192
|
-
/**
|
|
193
|
-
* 注册监听事件
|
|
194
|
-
* @param _key 事件名称
|
|
195
|
-
* @param _event 回调函数
|
|
196
|
-
* @param _target 绑定对象
|
|
197
|
-
* @param _times 执行次数
|
|
198
|
-
*/
|
|
199
|
-
Register(_key: string, _event: InterfaceUtility.IEvent, _times?: number): boolean;
|
|
200
|
-
/**
|
|
201
|
-
* 移除监听事件
|
|
202
|
-
* @param _key 事件名称
|
|
203
|
-
* @param _event 回调函数
|
|
204
|
-
* @param _target 绑定对象
|
|
205
|
-
*/
|
|
206
|
-
Degister(_key: string, _event: InterfaceUtility.IEvent): boolean;
|
|
207
|
-
/**
|
|
208
|
-
* 派发监听事件
|
|
209
|
-
* @param _key 事件名称
|
|
210
|
-
* @param _params 回调参数
|
|
211
|
-
*/
|
|
212
|
-
Invoke<T>(_key: string, ..._params: Array<any>): Promise<void>;
|
|
213
|
-
/** 清空所有事件 */
|
|
214
|
-
Clear(): void;
|
|
215
|
-
}
|
|
216
|
-
/** 委托池(单绑定) */
|
|
217
|
-
export class DelegateSinglePool implements IDelegate {
|
|
218
|
-
/** 对象池 */
|
|
219
|
-
private _tPools;
|
|
220
|
-
/** 构造函数 */
|
|
221
|
-
constructor();
|
|
222
|
-
/**
|
|
223
|
-
* 注册监听事件
|
|
224
|
-
* @param _key 事件名称
|
|
225
|
-
* @param _event 回调函数
|
|
226
|
-
* @param _target 绑定对象
|
|
227
|
-
* @param _times 执行次数
|
|
228
|
-
*/
|
|
229
|
-
Register(_key: string, _event: InterfaceUtility.IEvent, _target: any, _times?: number): boolean;
|
|
230
|
-
/**
|
|
231
|
-
* 移除监听事件
|
|
232
|
-
* @param _key 事件名称
|
|
233
|
-
* @param _target 绑定对象
|
|
234
|
-
* @param _event 回调函数
|
|
235
|
-
*/
|
|
236
|
-
Degister(_key: string, _event: InterfaceUtility.IEvent, _target: any): boolean;
|
|
237
|
-
/**
|
|
238
|
-
* 派发监听事件
|
|
239
|
-
* @param _key 事件名称
|
|
240
|
-
* @param _params 回调函数参数
|
|
241
|
-
*/
|
|
242
|
-
Invoke<T>(_key: string, ..._params: Array<any>): Promise<void>;
|
|
243
|
-
/** 清空所有事件 */
|
|
244
|
-
Clear(): void;
|
|
245
|
-
}
|
|
246
|
-
/** 反射池<字典> */
|
|
247
|
-
export class ReflectionPool<T> {
|
|
248
|
-
/** 反射池 */
|
|
249
|
-
private _reflectionPool;
|
|
250
|
-
/** 构造函数 */
|
|
251
|
-
constructor();
|
|
252
|
-
/** 获取数量 */
|
|
253
|
-
get Count(): number;
|
|
254
|
-
/** 获取反射类型 */
|
|
255
|
-
GetObject(_key: string): InterfaceUtility.IType<T>;
|
|
256
|
-
/** 获取类型 */
|
|
257
|
-
GetType(_key: string): InterfaceUtility.IType<T>;
|
|
258
|
-
/** 获取所有反射类型 */
|
|
259
|
-
GetObjects(): Map<string, InterfaceUtility.IType<T>>;
|
|
260
|
-
/** 创建反射实例 */
|
|
261
|
-
CreatInstance<K extends T>(_key: string, ...params: any[]): K;
|
|
262
|
-
/** 添加反射类型 */
|
|
263
|
-
Add(_key: string, _t: InterfaceUtility.IType<T>): boolean;
|
|
264
|
-
/** 移除反射类型 */
|
|
265
|
-
Remove(_key: string): boolean;
|
|
266
|
-
/** 移除所有反射类型 */
|
|
267
|
-
RemoveAll(): void;
|
|
268
|
-
/** 反射类型是否存在 */
|
|
269
|
-
Exist(_key: string): boolean;
|
|
270
|
-
}
|
|
271
|
-
/** 事件系统 */
|
|
272
|
-
export class EventSystem {
|
|
273
|
-
/** 目标对象管理池 */
|
|
274
|
-
private _objects;
|
|
275
|
-
constructor(_objects: ObjectUtility.MapPool<object>);
|
|
276
|
-
/** 事务映射池 */
|
|
277
|
-
private static _delegateMappingPool;
|
|
278
|
-
/**
|
|
279
|
-
* 添加事件装饰器
|
|
280
|
-
* @param _key 触发主键
|
|
281
|
-
* @param _times 触发次数
|
|
282
|
-
* @params 提示:绑定的函数回参:OnName(sender:object,...params[])
|
|
283
|
-
*/
|
|
284
|
-
static Decorator(_key: string, _times?: number): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
285
|
-
/**
|
|
286
|
-
* 派发(广播)事件
|
|
287
|
-
* @param _sender 派发者
|
|
288
|
-
* @param _key 事件Key
|
|
289
|
-
* @param params 透传参数
|
|
290
|
-
* @returns 触发结果
|
|
291
|
-
*/
|
|
292
|
-
Invoke(_sender: object, _key: string, ...params: Array<any>): void;
|
|
293
|
-
/** 获取所有事件 */
|
|
294
|
-
GetAll(): ObjectUtility.ArrayPool<IDelegateEvent>;
|
|
295
|
-
}
|
|
296
|
-
/** 委托事件接口 */
|
|
297
|
-
export interface IDelegateEvent {
|
|
298
|
-
/** 派发键 */
|
|
299
|
-
key: string;
|
|
300
|
-
/** 派发类名 */
|
|
301
|
-
className: string;
|
|
302
|
-
/** 派发事件名 */
|
|
303
|
-
eventName: string;
|
|
304
|
-
/** 派发次数 */
|
|
305
|
-
times: number;
|
|
306
|
-
}
|
|
307
|
-
export {};
|
|
308
|
-
}
|
|
1
|
+
/*********************************************************************************
|
|
2
|
+
* FileName : ObjectPool
|
|
3
|
+
* FileBasename : ObjectPool.ts
|
|
4
|
+
* Author : Seven_9t
|
|
5
|
+
* Date : Sat Mar 25 2023 15:05:05 GMT+0800 (中国标准时间)
|
|
6
|
+
* Description : db://assets/frame/script/base/ObjectPool.ts
|
|
7
|
+
* Version : v3.6
|
|
8
|
+
* Others : 修改默认TS脚本模板路径 D:\Cocos\CocosDashboard\resources\.editors\Creator\<Version>\resources\resources\3d\engine\editor\assets\default_file_content\ts
|
|
9
|
+
* ManualUrl : <指南手册> https://docs.cocos.com/creator/3.6/manual/zh/
|
|
10
|
+
* : <脚本手册> https://docs.cocos.com/creator/3.6/manual/zh/scripting/
|
|
11
|
+
* : <接口手册> https://docs.cocos.com/creator/api/zh/#/docs/3.6/zh/README
|
|
12
|
+
* : <生命周期手册>https://docs.cocos.com/creator/3.6/manual/zh/scripting/life-cycle-callbacks.html
|
|
13
|
+
|
|
14
|
+
**********************************************************************************/
|
|
15
|
+
import { InterfaceUtility } from "./InterfaceUtility";
|
|
16
|
+
/** 对象工具 */
|
|
17
|
+
export declare namespace ObjectUtility {
|
|
18
|
+
/** 空对象类 */
|
|
19
|
+
export class EmptyObject {
|
|
20
|
+
}
|
|
21
|
+
/** 获取对象所有属性 */
|
|
22
|
+
export function GetPropertys<T>(_object: T): Array<string>;
|
|
23
|
+
/** 检测对象属性是否存在 */
|
|
24
|
+
export function HasProperty(_object: object, _propertyKey: string): boolean;
|
|
25
|
+
/** 是否是对象 */
|
|
26
|
+
export function IsObject(_target: any): boolean;
|
|
27
|
+
/** 是否是数组 */
|
|
28
|
+
export function IsArray(_target: any): boolean;
|
|
29
|
+
/** 是否是函数 */
|
|
30
|
+
export function IsFunction(_target: any): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 判断是否继承自基类
|
|
33
|
+
* @param _target 目标对象实例
|
|
34
|
+
* @param _className 基类类名
|
|
35
|
+
* @returns 匹配结果
|
|
36
|
+
*/
|
|
37
|
+
export function InstanceOf(_target: object, _className: string): boolean;
|
|
38
|
+
/** 克隆对象 */
|
|
39
|
+
export function Clone<T>(_target: T, ...params: any[]): T;
|
|
40
|
+
/** 克隆并赋值 */
|
|
41
|
+
export function CloneAssign<T>(_target: T, ...params: any[]): T;
|
|
42
|
+
/** 数据赋值 */
|
|
43
|
+
export function Assign<T extends object>(_target: T, _source: Partial<object>): T;
|
|
44
|
+
/**
|
|
45
|
+
* 将对象序列化为Json字符串
|
|
46
|
+
* @param _object 一个JavaScript值,通常是要转换的对象或数组。
|
|
47
|
+
* @param _replacer 转换结果的函数。
|
|
48
|
+
* @param _space 在返回值JSON文本中添加缩进、空白和换行字符,使其更易于阅读。
|
|
49
|
+
* @returns 序列化后对象(需要自行转JSON.stringify)
|
|
50
|
+
*/
|
|
51
|
+
export function Encode(_object: object, _replacer?: (this: any, key: string, value: any) => any, _space?: string | number): Record<string, any>;
|
|
52
|
+
/** 将Json字符串反序列化为对象(对象带有函数则无效,需要执行浅拷贝或深拷贝) */
|
|
53
|
+
export function Decode<T extends object>(_target: InterfaceUtility.IType<T>, _source: T, ...params: any[]): T;
|
|
54
|
+
/** 浅拷贝 */
|
|
55
|
+
export function ShallowCopy<T extends object>(_target: InterfaceUtility.IType<T>, _source: T, ...params: any[]): T;
|
|
56
|
+
/** 深拷贝 */
|
|
57
|
+
export function DeepCopy<T extends object>(_target: InterfaceUtility.IType<T>, _source: T, ...params: any[]): T;
|
|
58
|
+
/** 深拷贝 TODO */
|
|
59
|
+
export function Deep(_target: any, _bitmask: boolean): any;
|
|
60
|
+
/** 深拷贝数组 */
|
|
61
|
+
export function DeepCopyArray(_target: any): any;
|
|
62
|
+
/** 对象操作泛型接口 */
|
|
63
|
+
interface IObjectOperation<T> {
|
|
64
|
+
/** 获取数量 */
|
|
65
|
+
get Count(): number;
|
|
66
|
+
/** 获取对象 */
|
|
67
|
+
Get(_key: number | string): T;
|
|
68
|
+
/** 获取对象组 */
|
|
69
|
+
Gets(_keys: Array<number | string>): Array<T>;
|
|
70
|
+
/** 获取所有对象 */
|
|
71
|
+
GetAll(): Array<T> | Map<string, T>;
|
|
72
|
+
/** 添加对象实例 */
|
|
73
|
+
Add(..._param: any[]): boolean;
|
|
74
|
+
/** 移除对象实例 */
|
|
75
|
+
Remove(_t: number | string | T): boolean;
|
|
76
|
+
/** 移除所有对象实例 */
|
|
77
|
+
RemoveAll(): void;
|
|
78
|
+
/** 对象实例是否存在 */
|
|
79
|
+
Exist(_t: number | string | T): boolean;
|
|
80
|
+
}
|
|
81
|
+
/** 对象池<数组> */
|
|
82
|
+
export class ArrayPool<T extends object | any> implements IObjectOperation<T> {
|
|
83
|
+
/** 对象池 */
|
|
84
|
+
private _tPools;
|
|
85
|
+
/** 构造函数 */
|
|
86
|
+
constructor();
|
|
87
|
+
/** 获取数量 */
|
|
88
|
+
get Count(): number;
|
|
89
|
+
/** 获取对象 */
|
|
90
|
+
Get<K extends T>(_index: number): K;
|
|
91
|
+
/** 获取对象组 */
|
|
92
|
+
Gets<K extends T>(_indexs: Array<number>): Array<K>;
|
|
93
|
+
/** 获取所有对象 */
|
|
94
|
+
GetAll(): Array<T>;
|
|
95
|
+
/** 添加对象实例 */
|
|
96
|
+
Add(_t: T): boolean;
|
|
97
|
+
/** 移除对象实例 */
|
|
98
|
+
Remove(_t: T | number): boolean;
|
|
99
|
+
/** 移除所有对象实例 */
|
|
100
|
+
RemoveAll(): void;
|
|
101
|
+
/** 对象实例是否存在 */
|
|
102
|
+
Exist(_t: T | number): boolean;
|
|
103
|
+
}
|
|
104
|
+
/** 对象池<字典> */
|
|
105
|
+
export class MapPool<T extends object> implements IObjectOperation<T> {
|
|
106
|
+
/** 对象池 */
|
|
107
|
+
private _tPools;
|
|
108
|
+
/** 构造函数 */
|
|
109
|
+
constructor(_map?: Map<string, T>);
|
|
110
|
+
/** 获取数量 */
|
|
111
|
+
get Count(): number;
|
|
112
|
+
/** 获取对象 */
|
|
113
|
+
Get<K extends T>(_key: string): K;
|
|
114
|
+
/** 获取对象组 */
|
|
115
|
+
Gets<K extends T>(_keys: Array<string>): Array<K>;
|
|
116
|
+
/** 获取所有对象 */
|
|
117
|
+
GetAll(): Map<string, T>;
|
|
118
|
+
/** 添加对象实例 */
|
|
119
|
+
Add(_key: string, _t: T): boolean;
|
|
120
|
+
/** 设置对象 */
|
|
121
|
+
Set<K extends T>(_key: string, _t: T): K;
|
|
122
|
+
/** 移除对象实例 */
|
|
123
|
+
Remove(_key: string): boolean;
|
|
124
|
+
/** 移除所有对象实例 */
|
|
125
|
+
RemoveAll(): void;
|
|
126
|
+
/** 对象实例是否存在 */
|
|
127
|
+
Exist(_t: string): boolean;
|
|
128
|
+
/** 所有键转数组 */
|
|
129
|
+
KeysToArray(): Array<string>;
|
|
130
|
+
/** 所有值转数组 */
|
|
131
|
+
ValuesToArray(): Array<T>;
|
|
132
|
+
}
|
|
133
|
+
/** 队列池<队列> */
|
|
134
|
+
export class QueuePool<T extends object> {
|
|
135
|
+
/** 队列数组 */
|
|
136
|
+
private _tPools;
|
|
137
|
+
constructor();
|
|
138
|
+
/** 入队 */
|
|
139
|
+
Enqueue(_t: T): void;
|
|
140
|
+
/** 出队 */
|
|
141
|
+
Dequeue(): T | undefined;
|
|
142
|
+
/** 查看队首元素 */
|
|
143
|
+
Peek(): T | undefined;
|
|
144
|
+
/** 判断队列是否为空 */
|
|
145
|
+
IsEmpty(): boolean;
|
|
146
|
+
/** 获取队列大小 */
|
|
147
|
+
Size(): number;
|
|
148
|
+
/** 清空队列 */
|
|
149
|
+
Clear(): void;
|
|
150
|
+
/** 克隆 */
|
|
151
|
+
Clone(): Array<T>;
|
|
152
|
+
}
|
|
153
|
+
/** 管线 */
|
|
154
|
+
export class PipeLine<T extends object> {
|
|
155
|
+
/** 事件管线 */
|
|
156
|
+
private _tPools;
|
|
157
|
+
/** 管线是否已启动 */
|
|
158
|
+
private _isStarted;
|
|
159
|
+
/** 管线是否已启动 */
|
|
160
|
+
private _isEnded;
|
|
161
|
+
/** 开关 */
|
|
162
|
+
private _switch;
|
|
163
|
+
constructor();
|
|
164
|
+
/** 获取数量 */
|
|
165
|
+
get Count(): number;
|
|
166
|
+
/** 注册事件 */
|
|
167
|
+
Register(_pipeline: ((_params: T) => Promise<T>) | PipeLine<T>): boolean;
|
|
168
|
+
/** 注销事件 */
|
|
169
|
+
Degister(_pipeline: ((_params: T) => Promise<T>) | PipeLine<T>): boolean;
|
|
170
|
+
/** 启动事件 */
|
|
171
|
+
Start(_params: T): Promise<T>;
|
|
172
|
+
/** 停止事件 */
|
|
173
|
+
Stop(): void;
|
|
174
|
+
}
|
|
175
|
+
/** 委托接口 */
|
|
176
|
+
export interface IDelegate {
|
|
177
|
+
/** 注册 */
|
|
178
|
+
Register(_key: string, _callback: InterfaceUtility.IEvent, _target: any, _times: number): boolean;
|
|
179
|
+
/** 注销 */
|
|
180
|
+
Degister(_key: string, _callback: InterfaceUtility.IEvent, _target: any): boolean;
|
|
181
|
+
/** 通知 */
|
|
182
|
+
Invoke(_key: string, ...params: Array<any>): Promise<void>;
|
|
183
|
+
/** 清除 */
|
|
184
|
+
Clear(): void;
|
|
185
|
+
}
|
|
186
|
+
/** 委托池(多绑定) */
|
|
187
|
+
export class DelegateMultiplePool implements IDelegate {
|
|
188
|
+
/** 对象池 */
|
|
189
|
+
private _tPools;
|
|
190
|
+
/** 构造函数 */
|
|
191
|
+
constructor();
|
|
192
|
+
/**
|
|
193
|
+
* 注册监听事件
|
|
194
|
+
* @param _key 事件名称
|
|
195
|
+
* @param _event 回调函数
|
|
196
|
+
* @param _target 绑定对象
|
|
197
|
+
* @param _times 执行次数
|
|
198
|
+
*/
|
|
199
|
+
Register(_key: string, _event: InterfaceUtility.IEvent, _times?: number): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* 移除监听事件
|
|
202
|
+
* @param _key 事件名称
|
|
203
|
+
* @param _event 回调函数
|
|
204
|
+
* @param _target 绑定对象
|
|
205
|
+
*/
|
|
206
|
+
Degister(_key: string, _event: InterfaceUtility.IEvent): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* 派发监听事件
|
|
209
|
+
* @param _key 事件名称
|
|
210
|
+
* @param _params 回调参数
|
|
211
|
+
*/
|
|
212
|
+
Invoke<T>(_key: string, ..._params: Array<any>): Promise<void>;
|
|
213
|
+
/** 清空所有事件 */
|
|
214
|
+
Clear(): void;
|
|
215
|
+
}
|
|
216
|
+
/** 委托池(单绑定) */
|
|
217
|
+
export class DelegateSinglePool implements IDelegate {
|
|
218
|
+
/** 对象池 */
|
|
219
|
+
private _tPools;
|
|
220
|
+
/** 构造函数 */
|
|
221
|
+
constructor();
|
|
222
|
+
/**
|
|
223
|
+
* 注册监听事件
|
|
224
|
+
* @param _key 事件名称
|
|
225
|
+
* @param _event 回调函数
|
|
226
|
+
* @param _target 绑定对象
|
|
227
|
+
* @param _times 执行次数
|
|
228
|
+
*/
|
|
229
|
+
Register(_key: string, _event: InterfaceUtility.IEvent, _target: any, _times?: number): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* 移除监听事件
|
|
232
|
+
* @param _key 事件名称
|
|
233
|
+
* @param _target 绑定对象
|
|
234
|
+
* @param _event 回调函数
|
|
235
|
+
*/
|
|
236
|
+
Degister(_key: string, _event: InterfaceUtility.IEvent, _target: any): boolean;
|
|
237
|
+
/**
|
|
238
|
+
* 派发监听事件
|
|
239
|
+
* @param _key 事件名称
|
|
240
|
+
* @param _params 回调函数参数
|
|
241
|
+
*/
|
|
242
|
+
Invoke<T>(_key: string, ..._params: Array<any>): Promise<void>;
|
|
243
|
+
/** 清空所有事件 */
|
|
244
|
+
Clear(): void;
|
|
245
|
+
}
|
|
246
|
+
/** 反射池<字典> */
|
|
247
|
+
export class ReflectionPool<T> {
|
|
248
|
+
/** 反射池 */
|
|
249
|
+
private _reflectionPool;
|
|
250
|
+
/** 构造函数 */
|
|
251
|
+
constructor();
|
|
252
|
+
/** 获取数量 */
|
|
253
|
+
get Count(): number;
|
|
254
|
+
/** 获取反射类型 */
|
|
255
|
+
GetObject(_key: string): InterfaceUtility.IType<T>;
|
|
256
|
+
/** 获取类型 */
|
|
257
|
+
GetType(_key: string): InterfaceUtility.IType<T>;
|
|
258
|
+
/** 获取所有反射类型 */
|
|
259
|
+
GetObjects(): Map<string, InterfaceUtility.IType<T>>;
|
|
260
|
+
/** 创建反射实例 */
|
|
261
|
+
CreatInstance<K extends T>(_key: string, ...params: any[]): K;
|
|
262
|
+
/** 添加反射类型 */
|
|
263
|
+
Add(_key: string, _t: InterfaceUtility.IType<T>): boolean;
|
|
264
|
+
/** 移除反射类型 */
|
|
265
|
+
Remove(_key: string): boolean;
|
|
266
|
+
/** 移除所有反射类型 */
|
|
267
|
+
RemoveAll(): void;
|
|
268
|
+
/** 反射类型是否存在 */
|
|
269
|
+
Exist(_key: string): boolean;
|
|
270
|
+
}
|
|
271
|
+
/** 事件系统 */
|
|
272
|
+
export class EventSystem {
|
|
273
|
+
/** 目标对象管理池 */
|
|
274
|
+
private _objects;
|
|
275
|
+
constructor(_objects: ObjectUtility.MapPool<object>);
|
|
276
|
+
/** 事务映射池 */
|
|
277
|
+
private static _delegateMappingPool;
|
|
278
|
+
/**
|
|
279
|
+
* 添加事件装饰器
|
|
280
|
+
* @param _key 触发主键
|
|
281
|
+
* @param _times 触发次数
|
|
282
|
+
* @params 提示:绑定的函数回参:OnName(sender:object,...params[])
|
|
283
|
+
*/
|
|
284
|
+
static Decorator(_key: string, _times?: number): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
285
|
+
/**
|
|
286
|
+
* 派发(广播)事件
|
|
287
|
+
* @param _sender 派发者
|
|
288
|
+
* @param _key 事件Key
|
|
289
|
+
* @param params 透传参数
|
|
290
|
+
* @returns 触发结果
|
|
291
|
+
*/
|
|
292
|
+
Invoke(_sender: object, _key: string, ...params: Array<any>): void;
|
|
293
|
+
/** 获取所有事件 */
|
|
294
|
+
GetAll(): ObjectUtility.ArrayPool<IDelegateEvent>;
|
|
295
|
+
}
|
|
296
|
+
/** 委托事件接口 */
|
|
297
|
+
export interface IDelegateEvent {
|
|
298
|
+
/** 派发键 */
|
|
299
|
+
key: string;
|
|
300
|
+
/** 派发类名 */
|
|
301
|
+
className: string;
|
|
302
|
+
/** 派发事件名 */
|
|
303
|
+
eventName: string;
|
|
304
|
+
/** 派发次数 */
|
|
305
|
+
times: number;
|
|
306
|
+
}
|
|
307
|
+
export {};
|
|
308
|
+
}
|