@zhongguo168a/yxeditor-common 0.0.1
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 +29 -0
- package/dist/index.d.ts +4355 -0
- package/dist/index.esm.js +14172 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +53 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4355 @@
|
|
|
1
|
+
import { HorizontalTextAlignment, VerticalTextAlignment, Scheduler, ISchedulable, Node, Vec2, EventTouch, EventMouse, Prefab, Component, Color, Vec3, Vec4, AssetManager, SpriteAtlas } from 'cc';
|
|
2
|
+
|
|
3
|
+
interface error {
|
|
4
|
+
isCancel(): boolean;
|
|
5
|
+
is(ident: string): boolean;
|
|
6
|
+
toString(): string;
|
|
7
|
+
has(ident: string): boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 链式错误
|
|
11
|
+
* err1 <argA=val&argB=val>
|
|
12
|
+
*/
|
|
13
|
+
declare class LinkError {
|
|
14
|
+
next: LinkError;
|
|
15
|
+
ident: string;
|
|
16
|
+
args: {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 判断当前错误是否 cancel 错误
|
|
21
|
+
*/
|
|
22
|
+
isCancel(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* 当前的错误编号是否与指定的错误编号一致
|
|
25
|
+
* @param ident
|
|
26
|
+
*/
|
|
27
|
+
is(ident: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 错误链中是否包含有 指定的错误编号
|
|
30
|
+
* @param ident
|
|
31
|
+
*/
|
|
32
|
+
has(ident: string): boolean;
|
|
33
|
+
toString(): string;
|
|
34
|
+
}
|
|
35
|
+
declare class ErrorUtil {
|
|
36
|
+
parse(errString: string): LinkError;
|
|
37
|
+
create(ident: string, args?: {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}): LinkError;
|
|
40
|
+
warp(err: LinkError, ident: any, args?: {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}): LinkError;
|
|
43
|
+
to(err: error): LinkError;
|
|
44
|
+
}
|
|
45
|
+
declare const errorutil: ErrorUtil;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 单例的UI对象
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
interface IUIObject {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
z: number;
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
}
|
|
58
|
+
declare class UISingleConfig {
|
|
59
|
+
/**
|
|
60
|
+
* 创建函数
|
|
61
|
+
*/
|
|
62
|
+
creator: () => any;
|
|
63
|
+
/**
|
|
64
|
+
* 指定键值
|
|
65
|
+
* 可通过键值获得 ui对象
|
|
66
|
+
*/
|
|
67
|
+
name: string;
|
|
68
|
+
constructor({ name, creator, }: {
|
|
69
|
+
name: string;
|
|
70
|
+
creator: () => any;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 单例的UI对象
|
|
75
|
+
*/
|
|
76
|
+
declare class UIPoolConfig {
|
|
77
|
+
/**
|
|
78
|
+
* 创建函数
|
|
79
|
+
* 对象需要实现recycle方法
|
|
80
|
+
*/
|
|
81
|
+
creator: () => any;
|
|
82
|
+
/**
|
|
83
|
+
* 指定键值
|
|
84
|
+
* 可通过键值获得 ui对象
|
|
85
|
+
*/
|
|
86
|
+
name: string;
|
|
87
|
+
/**
|
|
88
|
+
* 过期帧数,默认为永不过期(0)
|
|
89
|
+
*/
|
|
90
|
+
expired: number;
|
|
91
|
+
constructor({ name, creator, expired, }: {
|
|
92
|
+
name: string;
|
|
93
|
+
expired?: number;
|
|
94
|
+
creator: () => any;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* UI对象的缓存管理器,自动管理UI对象的创建和销毁
|
|
99
|
+
* 为了避免页面中的组件经常创建和销毁,可使用此对象管理
|
|
100
|
+
* 例如各种面板,背包栏等,不想每次关闭页面都重新创建对象,影响操作流畅性。在内存足够的情况下,交由 UIManager 管理。
|
|
101
|
+
* 另外可以使用UI管理器中的对象池
|
|
102
|
+
* 对于不需要管理的对象,直接在页面中创建,释放/等待垃圾回收
|
|
103
|
+
*
|
|
104
|
+
* 需要注册
|
|
105
|
+
*/
|
|
106
|
+
declare class UIManager {
|
|
107
|
+
/**
|
|
108
|
+
* ui单例对象缓存数量的最大值
|
|
109
|
+
*/
|
|
110
|
+
singleObjectMax: number;
|
|
111
|
+
protected singleObjs: any;
|
|
112
|
+
protected singleList: any[];
|
|
113
|
+
protected singleCounts: any;
|
|
114
|
+
protected singleConfigs: any;
|
|
115
|
+
protected pools: any;
|
|
116
|
+
protected poolConfig: any;
|
|
117
|
+
constructor();
|
|
118
|
+
/**
|
|
119
|
+
* 注册一个ui对象配置
|
|
120
|
+
* @param config
|
|
121
|
+
*/
|
|
122
|
+
registerPool(config: UIPoolConfig): void;
|
|
123
|
+
/**
|
|
124
|
+
* 获取UI对象池中的一个对象
|
|
125
|
+
* @param key
|
|
126
|
+
*/
|
|
127
|
+
getPoolObject(key: string): [any, error];
|
|
128
|
+
/**
|
|
129
|
+
* 返回UI到对象池中
|
|
130
|
+
* @param key
|
|
131
|
+
* @param obj
|
|
132
|
+
*/
|
|
133
|
+
backPoolObject(key: string, obj: any): void;
|
|
134
|
+
/**
|
|
135
|
+
* 注册一个ui对象配置
|
|
136
|
+
* @param config
|
|
137
|
+
*/
|
|
138
|
+
registerSingle(config: UISingleConfig): void;
|
|
139
|
+
/**
|
|
140
|
+
* 获取单例的UI对象
|
|
141
|
+
* 引用计数+1
|
|
142
|
+
* @param key
|
|
143
|
+
*/
|
|
144
|
+
getSingle(key: string): [any, error];
|
|
145
|
+
/**
|
|
146
|
+
* 返还UI对象
|
|
147
|
+
* 引用计数-1,当引用计数等于0时,放入待清理列表
|
|
148
|
+
* @param key
|
|
149
|
+
*/
|
|
150
|
+
backSingle(key: string): void;
|
|
151
|
+
private mark;
|
|
152
|
+
private unmark;
|
|
153
|
+
private clean;
|
|
154
|
+
protected addCleanList(key: string): void;
|
|
155
|
+
protected cleanObjects(): void;
|
|
156
|
+
showTips(msg: string): void;
|
|
157
|
+
alignObject(alignment: HorizontalTextAlignment, a: IUIObject, b: IUIObject, offset?: number): void;
|
|
158
|
+
alignVertObject(alignment: VerticalTextAlignment, a: IUIObject, b: IUIObject, offset?: number): void;
|
|
159
|
+
}
|
|
160
|
+
declare var uimgr: UIManager;
|
|
161
|
+
|
|
162
|
+
declare class Timer {
|
|
163
|
+
get scheduler(): Scheduler;
|
|
164
|
+
private _scheduler;
|
|
165
|
+
constructor();
|
|
166
|
+
/**
|
|
167
|
+
* 定时执行一次。
|
|
168
|
+
* @param delay 延迟时间(单位为毫秒)。
|
|
169
|
+
* @param caller 执行域(this)。
|
|
170
|
+
* @param method 定时器回调函数。
|
|
171
|
+
*/
|
|
172
|
+
once(delay: number, caller: any, method: (dt?: number) => void): void;
|
|
173
|
+
/**
|
|
174
|
+
* 定时重复执行。
|
|
175
|
+
* @param delay 间隔时间(单位毫秒)。
|
|
176
|
+
* @param caller 执行域(this)。
|
|
177
|
+
* @param method 定时器回调函数。
|
|
178
|
+
*/
|
|
179
|
+
loop(delay: number, caller: any, method: (dt?: number) => void): void;
|
|
180
|
+
/**
|
|
181
|
+
* 清理定时器。
|
|
182
|
+
* @param caller 执行域(this)。
|
|
183
|
+
* @param method 定时器回调函数。
|
|
184
|
+
*/
|
|
185
|
+
clear(caller: any, method: Function): void;
|
|
186
|
+
/**
|
|
187
|
+
* 清理对象身上的所有定时器。
|
|
188
|
+
* @param caller 执行域(this)。
|
|
189
|
+
*/
|
|
190
|
+
clearAll(caller: any): void;
|
|
191
|
+
/**
|
|
192
|
+
* 延迟执行。
|
|
193
|
+
* @param caller 执行域(this)。
|
|
194
|
+
* @param method 定时器回调函数。
|
|
195
|
+
*/
|
|
196
|
+
callLater(caller: any, method: (dt?: number) => void): void;
|
|
197
|
+
/**
|
|
198
|
+
* 暂停时钟
|
|
199
|
+
*/
|
|
200
|
+
pause(caller: any): void;
|
|
201
|
+
/**
|
|
202
|
+
* 恢复时钟
|
|
203
|
+
*/
|
|
204
|
+
resume(caller: any): void;
|
|
205
|
+
recycle(): void;
|
|
206
|
+
dispose(): void;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
declare const timer: Timer;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Endian 类中包含一些值,它们表示用于表示多字节数字的字节顺序。
|
|
213
|
+
* 字节顺序为 bigEndian(最高有效字节位于最前)或 littleEndian(最低有效字节位于最前)。
|
|
214
|
+
*/
|
|
215
|
+
declare class Endian {
|
|
216
|
+
/**
|
|
217
|
+
* 表示多字节数字的最低有效字节位于字节序列的最前面。
|
|
218
|
+
* 十六进制数字 0x12345678 包含 4 个字节(每个字节包含 2 个十六进制数字)。最高有效字节为 0x12。最低有效字节为 0x78。(对于等效的十进制数字 305419896,最高有效数字是 3,最低有效数字是 6)。
|
|
219
|
+
*/
|
|
220
|
+
static LITTLE_ENDIAN: string;
|
|
221
|
+
/**
|
|
222
|
+
* 表示多字节数字的最高有效字节位于字节序列的最前面。
|
|
223
|
+
* 十六进制数字 0x12345678 包含 4 个字节(每个字节包含 2 个十六进制数字)。最高有效字节为 0x12。最低有效字节为 0x78。(对于等效的十进制数字 305419896,最高有效数字是 3,最低有效数字是 6)。
|
|
224
|
+
*/
|
|
225
|
+
static BIG_ENDIAN: string;
|
|
226
|
+
}
|
|
227
|
+
declare const enum EndianConst {
|
|
228
|
+
LITTLE_ENDIAN = 0,
|
|
229
|
+
BIG_ENDIAN = 1
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* ByteArray 类提供用于优化读取、写入以及处理二进制数据的方法和属性。
|
|
233
|
+
* 注意:ByteArray 类适用于需要在字节层访问数据的高级开发人员。
|
|
234
|
+
*/
|
|
235
|
+
declare class ByteArray {
|
|
236
|
+
/**
|
|
237
|
+
* @private
|
|
238
|
+
*/
|
|
239
|
+
protected bufferExtSize: number;
|
|
240
|
+
protected data: DataView;
|
|
241
|
+
protected _bytes: Uint8Array;
|
|
242
|
+
/**
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
245
|
+
protected _position: number;
|
|
246
|
+
/**
|
|
247
|
+
*
|
|
248
|
+
* 已经使用的字节偏移量
|
|
249
|
+
*/
|
|
250
|
+
protected write_position: number;
|
|
251
|
+
/**
|
|
252
|
+
* 更改或读取数据的字节顺序;egret.EndianConst.BIG_ENDIAN 或 egret.EndianConst.LITTLE_ENDIAN。
|
|
253
|
+
*/
|
|
254
|
+
get endian(): string;
|
|
255
|
+
set endian(value: string);
|
|
256
|
+
protected $endian: EndianConst;
|
|
257
|
+
constructor(buffer?: ArrayBuffer | Uint8Array, bufferExtSize?: number);
|
|
258
|
+
/**
|
|
259
|
+
* @deprecated
|
|
260
|
+
* @version Egret 2.4
|
|
261
|
+
* @platform Web,Native
|
|
262
|
+
*/
|
|
263
|
+
setArrayBuffer(buffer: ArrayBuffer): void;
|
|
264
|
+
/**
|
|
265
|
+
* 可读的剩余字节数
|
|
266
|
+
* @returns
|
|
267
|
+
*/
|
|
268
|
+
get readAvailable(): number;
|
|
269
|
+
get buffer(): ArrayBuffer;
|
|
270
|
+
get rawBuffer(): ArrayBuffer;
|
|
271
|
+
/**
|
|
272
|
+
* @private
|
|
273
|
+
*/
|
|
274
|
+
set buffer(value: ArrayBuffer);
|
|
275
|
+
get bytes(): Uint8Array;
|
|
276
|
+
/**
|
|
277
|
+
* @private
|
|
278
|
+
*/
|
|
279
|
+
get dataPage(): DataView;
|
|
280
|
+
/**
|
|
281
|
+
* @private
|
|
282
|
+
*/
|
|
283
|
+
set dataPage(value: DataView);
|
|
284
|
+
/**
|
|
285
|
+
* @private
|
|
286
|
+
*/
|
|
287
|
+
get bufferOffset(): number;
|
|
288
|
+
/**
|
|
289
|
+
* 将文件指针的当前位置(以字节为单位)移动或返回到 ByteArray 对象中。下一次调用读取方法时将在此位置开始读取,或者下一次调用写入方法时将在此位置开始写入。
|
|
290
|
+
*/
|
|
291
|
+
get position(): number;
|
|
292
|
+
set position(value: number);
|
|
293
|
+
/**
|
|
294
|
+
* ByteArray 对象的长度(以字节为单位)。
|
|
295
|
+
* 如果将长度设置为大于当前长度的值,则用零填充字节数组的右侧。
|
|
296
|
+
* 如果将长度设置为小于当前长度的值,将会截断该字节数组。
|
|
297
|
+
*/
|
|
298
|
+
get length(): number;
|
|
299
|
+
set length(value: number);
|
|
300
|
+
protected _validateBuffer(value: number): void;
|
|
301
|
+
/**
|
|
302
|
+
* 可从字节数组的当前位置到数组末尾读取的数据的字节数。
|
|
303
|
+
* 每次访问 ByteArray 对象时,将 bytesAvailable 属性与读取方法结合使用,以确保读取有效的数据。
|
|
304
|
+
*/
|
|
305
|
+
get bytesAvailable(): number;
|
|
306
|
+
/**
|
|
307
|
+
* 清除字节数组的内容,并将 length 和 position 属性重置为 0。
|
|
308
|
+
*/
|
|
309
|
+
clear(): void;
|
|
310
|
+
/**
|
|
311
|
+
* 从字节流中读取布尔值。读取单个字节,如果字节非零,则返回 true,否则返回 false
|
|
312
|
+
* @return 如果字节不为零,则返回 true,否则返回 false
|
|
313
|
+
*/
|
|
314
|
+
readBool(): boolean;
|
|
315
|
+
/**
|
|
316
|
+
* 从字节流中读取带符号的字节
|
|
317
|
+
* @return 介于 -128 和 127 之间的整数
|
|
318
|
+
*/
|
|
319
|
+
readByte(): number;
|
|
320
|
+
/**
|
|
321
|
+
* 从字节流中读取 length 参数指定的数据字节数。从 offset 指定的位置开始,将字节读入 bytes 参数指定的 ByteArray 对象中,并将字节写入目标 ByteArray 中
|
|
322
|
+
* @param bytes 要将数据读入的 ByteArray 对象
|
|
323
|
+
* @param offset bytes 中的偏移(位置),应从该位置写入读取的数据
|
|
324
|
+
* @param length 要读取的字节数。默认值 0 导致读取所有可用的数据
|
|
325
|
+
*/
|
|
326
|
+
readBytes(bytes: ByteArray, offset?: number, length?: number): void;
|
|
327
|
+
/**
|
|
328
|
+
* 从字节流中读取一个 IEEE 754 双精度(64 位)浮点数
|
|
329
|
+
* @return 双精度(64 位)浮点数
|
|
330
|
+
*/
|
|
331
|
+
readFloat64(): number;
|
|
332
|
+
/**
|
|
333
|
+
* 从字节流中读取一个 IEEE 754 单精度(32 位)浮点数
|
|
334
|
+
* @return 单精度(32 位)浮点数
|
|
335
|
+
*/
|
|
336
|
+
readFloat32(): number;
|
|
337
|
+
/**
|
|
338
|
+
* 从字节流中读取一个带符号的 32 位整数
|
|
339
|
+
* @return 介于 -2147483648 和 2147483647 之间的 32 位带符号整数
|
|
340
|
+
*/
|
|
341
|
+
readInt32(): number;
|
|
342
|
+
/**
|
|
343
|
+
* 从字节流中读取一个带符号的 32 位整数数组
|
|
344
|
+
*/
|
|
345
|
+
readInt32Array(): number[];
|
|
346
|
+
/**
|
|
347
|
+
* 从字节流中读取一个带符号的 16 位整数
|
|
348
|
+
* @return 介于 -32768 和 32767 之间的 16 位带符号整数
|
|
349
|
+
*/
|
|
350
|
+
readInt16(): number;
|
|
351
|
+
/**
|
|
352
|
+
* 从字节流中读取无符号的字节
|
|
353
|
+
* @return 介于 0 和 255 之间的无符号整数
|
|
354
|
+
*/
|
|
355
|
+
readInt8(): number;
|
|
356
|
+
/**
|
|
357
|
+
* 从字节流中读取无符号的字节
|
|
358
|
+
* @return 介于 0 和 255 之间的无符号整数
|
|
359
|
+
*/
|
|
360
|
+
readUint8(): number;
|
|
361
|
+
/**
|
|
362
|
+
* 从字节流中读取一个无符号的 32 位整数
|
|
363
|
+
* @return 介于 0 和 4294967295 之间的 32 位无符号整数
|
|
364
|
+
*/
|
|
365
|
+
readUint32(): number;
|
|
366
|
+
/**
|
|
367
|
+
* 从字节流中读取一个无符号的 16 位整数
|
|
368
|
+
* @return 介于 0 和 65535 之间的 16 位无符号整数
|
|
369
|
+
*/
|
|
370
|
+
readUint16(): number;
|
|
371
|
+
/**
|
|
372
|
+
* 从字节流中读取一个 UTF-8 字符串。假定字符串的前缀是无符号的短整型(以字节表示长度)
|
|
373
|
+
* @return UTF-8 编码的字符串
|
|
374
|
+
*/
|
|
375
|
+
readUTF(): string;
|
|
376
|
+
/**
|
|
377
|
+
* 从字节流中读取一个由 length 参数指定的 UTF-8 字节序列,并返回一个字符串
|
|
378
|
+
* @param length 指明 UTF-8 字节长度的无符号短整型数
|
|
379
|
+
* @return 由指定长度的 UTF-8 字节组成的字符串
|
|
380
|
+
*/
|
|
381
|
+
readUTFBytes(length: number): string;
|
|
382
|
+
/**
|
|
383
|
+
* 写入布尔值。根据 value 参数写入单个字节。如果为 true,则写入 1,如果为 false,则写入 0
|
|
384
|
+
* @param value 确定写入哪个字节的布尔值。如果该参数为 true,则该方法写入 1;如果该参数为 false,则该方法写入 0
|
|
385
|
+
*/
|
|
386
|
+
writeBool(value: boolean): void;
|
|
387
|
+
/**
|
|
388
|
+
* 在字节流中写入一个字节
|
|
389
|
+
* 使用参数的低 8 位。忽略高 24 位
|
|
390
|
+
* @param value 一个 32 位整数。低 8 位将被写入字节流
|
|
391
|
+
*/
|
|
392
|
+
writeByte(value: number): void;
|
|
393
|
+
/**
|
|
394
|
+
* 将指定字节数组 bytes(起始偏移量为 offset,从零开始的索引)中包含 length 个字节的字节序列写入字节流
|
|
395
|
+
* 如果省略 length 参数,则使用默认长度 0;该方法将从 offset 开始写入整个缓冲区。如果还省略了 offset 参数,则写入整个缓冲区
|
|
396
|
+
* 如果 offset 或 length 超出范围,它们将被锁定到 bytes 数组的开头和结尾
|
|
397
|
+
* @param bytes ByteArray 对象
|
|
398
|
+
* @param offset 从 0 开始的索引,表示在数组中开始写入的位置
|
|
399
|
+
* @param length 一个无符号整数,表示在缓冲区中的写入范围
|
|
400
|
+
*/
|
|
401
|
+
writeBytes(bytes: ByteArray, offset?: number, length?: number): void;
|
|
402
|
+
/**
|
|
403
|
+
* 在字节流中写入一个 IEEE 754 双精度(64 位)浮点数
|
|
404
|
+
* @param value 双精度(64 位)浮点数
|
|
405
|
+
*/
|
|
406
|
+
writeDouble(value: number): void;
|
|
407
|
+
/**
|
|
408
|
+
* 在字节流中写入一个 IEEE 754 单精度(32 位)浮点数
|
|
409
|
+
* @param value 单精度(32 位)浮点数
|
|
410
|
+
*/
|
|
411
|
+
writeFloat(value: number): void;
|
|
412
|
+
/**
|
|
413
|
+
* 在字节流中写入一个带符号的 32 位整数
|
|
414
|
+
* @param value 要写入字节流的整数
|
|
415
|
+
*/
|
|
416
|
+
writeInt(value: number): void;
|
|
417
|
+
/**
|
|
418
|
+
* 在字节流中写入一个 16 位整数。使用参数的低 16 位。忽略高 16 位
|
|
419
|
+
* @param value 32 位整数,该整数的低 16 位将被写入字节流
|
|
420
|
+
*/
|
|
421
|
+
writeShort(value: number): void;
|
|
422
|
+
/**
|
|
423
|
+
* 在字节流中写入一个无符号的 32 位整数
|
|
424
|
+
* @param value 要写入字节流的无符号整数
|
|
425
|
+
*/
|
|
426
|
+
writeUnsignedInt(value: number): void;
|
|
427
|
+
/**
|
|
428
|
+
* 在字节流中写入一个无符号的 16 位整数
|
|
429
|
+
* @param value 要写入字节流的无符号整数
|
|
430
|
+
*/
|
|
431
|
+
writeUnsignedShort(value: number): void;
|
|
432
|
+
/**
|
|
433
|
+
* 将 UTF-8 字符串写入字节流。先写入以字节表示的 UTF-8 字符串长度(作为 16 位整数),然后写入表示字符串字符的字节
|
|
434
|
+
* @param value 要写入的字符串值
|
|
435
|
+
*/
|
|
436
|
+
writeUTF(value: string): void;
|
|
437
|
+
/**
|
|
438
|
+
* 将 UTF-8 字符串写入字节流。类似于 writeUTF() 方法,但 writeUTFBytes() 不使用 16 位长度的词为字符串添加前缀
|
|
439
|
+
* @param value 要写入的字符串值
|
|
440
|
+
*/
|
|
441
|
+
writeUTFBytes(value: string): void;
|
|
442
|
+
/**
|
|
443
|
+
* @returns
|
|
444
|
+
*/
|
|
445
|
+
toString(): string;
|
|
446
|
+
/**
|
|
447
|
+
* @private
|
|
448
|
+
* 将 Uint8Array 写入字节流
|
|
449
|
+
* @param bytes 要写入的Uint8Array
|
|
450
|
+
* @param validateBuffer
|
|
451
|
+
*/
|
|
452
|
+
_writeUint8Array(bytes: Uint8Array | ArrayLike<number>, validateBuffer?: boolean): void;
|
|
453
|
+
/**
|
|
454
|
+
* @param len
|
|
455
|
+
* @returns
|
|
456
|
+
*/
|
|
457
|
+
validate(len: number): boolean;
|
|
458
|
+
/**********************/
|
|
459
|
+
/**********************/
|
|
460
|
+
/**
|
|
461
|
+
* @private
|
|
462
|
+
* @param len
|
|
463
|
+
* @param needReplace
|
|
464
|
+
*/
|
|
465
|
+
protected validateBuffer(len: number): void;
|
|
466
|
+
/**
|
|
467
|
+
* @private
|
|
468
|
+
* UTF-8 Encoding/Decoding
|
|
469
|
+
*/
|
|
470
|
+
private encodeUTF8;
|
|
471
|
+
/**
|
|
472
|
+
* @private
|
|
473
|
+
*
|
|
474
|
+
* @param data
|
|
475
|
+
* @returns
|
|
476
|
+
*/
|
|
477
|
+
private decodeUTF8;
|
|
478
|
+
/**
|
|
479
|
+
* @private
|
|
480
|
+
*
|
|
481
|
+
* @param code_point
|
|
482
|
+
*/
|
|
483
|
+
private encoderError;
|
|
484
|
+
/**
|
|
485
|
+
* @private
|
|
486
|
+
*
|
|
487
|
+
* @param fatal
|
|
488
|
+
* @param opt_code_point
|
|
489
|
+
* @returns
|
|
490
|
+
*/
|
|
491
|
+
private decoderError;
|
|
492
|
+
/**
|
|
493
|
+
* @private
|
|
494
|
+
*/
|
|
495
|
+
private EOF_byte;
|
|
496
|
+
/**
|
|
497
|
+
* @private
|
|
498
|
+
*/
|
|
499
|
+
private EOF_code_point;
|
|
500
|
+
/**
|
|
501
|
+
* @private
|
|
502
|
+
*
|
|
503
|
+
* @param a
|
|
504
|
+
* @param min
|
|
505
|
+
* @param max
|
|
506
|
+
*/
|
|
507
|
+
private inRange;
|
|
508
|
+
/**
|
|
509
|
+
* @private
|
|
510
|
+
*
|
|
511
|
+
* @param n
|
|
512
|
+
* @param d
|
|
513
|
+
*/
|
|
514
|
+
private div;
|
|
515
|
+
/**
|
|
516
|
+
* @private
|
|
517
|
+
*
|
|
518
|
+
* @param string
|
|
519
|
+
*/
|
|
520
|
+
private stringToCodePoints;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
declare enum ConnectState {
|
|
524
|
+
Wait = 0,
|
|
525
|
+
Closed = 1,
|
|
526
|
+
Connecting = 2,
|
|
527
|
+
Connected = 3
|
|
528
|
+
}
|
|
529
|
+
declare enum ValidState {
|
|
530
|
+
Unknown = 0,
|
|
531
|
+
Validing = 1,
|
|
532
|
+
Valid = 2
|
|
533
|
+
}
|
|
534
|
+
declare enum NetIdent {
|
|
535
|
+
Send = "Send"
|
|
536
|
+
}
|
|
537
|
+
declare enum NetSub {
|
|
538
|
+
All = 0,
|
|
539
|
+
NotConnected = 1,
|
|
540
|
+
Invalid = 2
|
|
541
|
+
}
|
|
542
|
+
declare enum ResponseSub {
|
|
543
|
+
All = 0,
|
|
544
|
+
Succeed = 1,
|
|
545
|
+
Failed = 2,
|
|
546
|
+
Timeout = 3
|
|
547
|
+
}
|
|
548
|
+
declare enum SerializeMode {
|
|
549
|
+
JSON = 0,
|
|
550
|
+
JSON_REF = 1,
|
|
551
|
+
BYTE = 2
|
|
552
|
+
}
|
|
553
|
+
declare enum PushTag {
|
|
554
|
+
Unknown = 0,
|
|
555
|
+
Response = 1,
|
|
556
|
+
Push = 2,
|
|
557
|
+
Event = 3,
|
|
558
|
+
Command = 4,
|
|
559
|
+
SyncCreate = 5,
|
|
560
|
+
SyncUpdate = 6,
|
|
561
|
+
SyncDelete = 7
|
|
562
|
+
}
|
|
563
|
+
declare enum HttpResponseType {
|
|
564
|
+
/**
|
|
565
|
+
* 返回字符串。HttpRequest.responseType属性的默认值。
|
|
566
|
+
*/
|
|
567
|
+
TEXT = "text",
|
|
568
|
+
/**
|
|
569
|
+
* 返回二进制的ArrayBuffer对象。
|
|
570
|
+
*/
|
|
571
|
+
ARRAY_BUFFER = "arraybuffer",
|
|
572
|
+
BLOB = "blob",
|
|
573
|
+
DOCUMENT = "document",
|
|
574
|
+
JSON = "json"
|
|
575
|
+
}
|
|
576
|
+
declare enum HttpMethod {
|
|
577
|
+
GET = "GET",
|
|
578
|
+
POST = "POST"
|
|
579
|
+
}
|
|
580
|
+
declare enum WebSocketType {
|
|
581
|
+
/**
|
|
582
|
+
* 以字符串格式发送和接收数据
|
|
583
|
+
*/
|
|
584
|
+
STRING = "webSocketTypeString",
|
|
585
|
+
/**
|
|
586
|
+
* 以二进制格式发送和接收数据
|
|
587
|
+
*/
|
|
588
|
+
BINARY = "webSocketTypeBinary"
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* 事件
|
|
593
|
+
*/
|
|
594
|
+
declare class XEvent {
|
|
595
|
+
/**
|
|
596
|
+
*
|
|
597
|
+
*/
|
|
598
|
+
dispatcher: any;
|
|
599
|
+
/**
|
|
600
|
+
* 子事件
|
|
601
|
+
*/
|
|
602
|
+
sub: string;
|
|
603
|
+
/**
|
|
604
|
+
* 子事件
|
|
605
|
+
*/
|
|
606
|
+
sub2: string;
|
|
607
|
+
/**
|
|
608
|
+
* 事件
|
|
609
|
+
*/
|
|
610
|
+
type: string;
|
|
611
|
+
/**
|
|
612
|
+
* 监听时传递的参数
|
|
613
|
+
*/
|
|
614
|
+
onParams: any;
|
|
615
|
+
/**
|
|
616
|
+
* 触发时传递的参数
|
|
617
|
+
*/
|
|
618
|
+
dispatchParams: any;
|
|
619
|
+
toString(): string;
|
|
620
|
+
clone(): XEvent;
|
|
621
|
+
recycle(): void;
|
|
622
|
+
dispose(): void;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
declare class EventItem {
|
|
626
|
+
recycle(): void;
|
|
627
|
+
dispose(): void;
|
|
628
|
+
dispatch(event: XEvent): void;
|
|
629
|
+
listener: (event: XEvent) => void;
|
|
630
|
+
caller: any;
|
|
631
|
+
/**
|
|
632
|
+
* 事件类型
|
|
633
|
+
*/
|
|
634
|
+
type: string;
|
|
635
|
+
/**
|
|
636
|
+
* 子事件
|
|
637
|
+
* 如果sub == "" 或者 sub == "*", 则不需要检查sub值
|
|
638
|
+
*/
|
|
639
|
+
sub: string;
|
|
640
|
+
/**
|
|
641
|
+
* 子事件2
|
|
642
|
+
* 如果sub == "" 或者 sub == "*", 则不需要检查sub值
|
|
643
|
+
*/
|
|
644
|
+
sub2: string;
|
|
645
|
+
args: any;
|
|
646
|
+
once: boolean;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
interface IEventManager {
|
|
650
|
+
has(type: string, caller: any, listener: Function): boolean;
|
|
651
|
+
/**
|
|
652
|
+
* 监听事件
|
|
653
|
+
* @param type
|
|
654
|
+
* @param caller
|
|
655
|
+
* @param listener 为了性能考虑, event使用了对象池处理。因此处理函数不应该保存event的引用。如有需要,可通过新建对象或Event.Clone()实现
|
|
656
|
+
* @param args
|
|
657
|
+
*/
|
|
658
|
+
on(type: string, caller: any, listener: (event: XEvent) => void, ...args: any[]): EventItem;
|
|
659
|
+
once(type: string, caller: any, listener: Function, ...args: any[]): EventItem;
|
|
660
|
+
offItem(item: EventItem): any;
|
|
661
|
+
off(type: string, caller: any, listener: Function): void;
|
|
662
|
+
offAll(type?: string): void;
|
|
663
|
+
offAllCaller(caller: any): any;
|
|
664
|
+
/**
|
|
665
|
+
* 派发事件
|
|
666
|
+
* @param type
|
|
667
|
+
* @param params
|
|
668
|
+
*/
|
|
669
|
+
dispatch(type: string, ...params: any[]): void;
|
|
670
|
+
dispose(): any;
|
|
671
|
+
pause(): any;
|
|
672
|
+
resume(): any;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* 事件字符串分隔符
|
|
677
|
+
*/
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* 事件派发器
|
|
681
|
+
*/
|
|
682
|
+
declare class EventManager implements IEventManager {
|
|
683
|
+
constructor();
|
|
684
|
+
dispose(): void;
|
|
685
|
+
/**
|
|
686
|
+
* 暂停监听
|
|
687
|
+
*/
|
|
688
|
+
pause(): void;
|
|
689
|
+
resume(): void;
|
|
690
|
+
protected _isPause: boolean;
|
|
691
|
+
has(type: string, caller: any, listener: Function): boolean;
|
|
692
|
+
getItem(type: string, caller: any, listener: Function): EventItem;
|
|
693
|
+
/**
|
|
694
|
+
* 监听事件,如果监听已经存在则返回
|
|
695
|
+
* @param type
|
|
696
|
+
* @param caller
|
|
697
|
+
* @param listener 为了性能考虑, event使用了对象池处理。因此处理函数不应该保存event的引用。如有需要,可通过新建对象或Event.Clone()实现
|
|
698
|
+
* @param args
|
|
699
|
+
*/
|
|
700
|
+
on(type: string, caller: any, listener: (event: XEvent, dispatchParams: any) => void, args?: any): EventItem;
|
|
701
|
+
once(type: string, caller: any, listener: (event: XEvent) => void, args?: any): EventItem;
|
|
702
|
+
offItem(item: EventItem): void;
|
|
703
|
+
off(type: string, caller: any, listener: Function): void;
|
|
704
|
+
offAll(type?: string): void;
|
|
705
|
+
offAllCaller(caller: any): void;
|
|
706
|
+
/**
|
|
707
|
+
* 派发事件
|
|
708
|
+
* @param type 事件类型
|
|
709
|
+
* @param params 事件参数
|
|
710
|
+
* @param disableLog
|
|
711
|
+
*/
|
|
712
|
+
dispatch(type: string, params?: any, disableLog?: boolean): void;
|
|
713
|
+
/**
|
|
714
|
+
* 派发事件
|
|
715
|
+
* @param type 事件类型.子事件.子事件2
|
|
716
|
+
* @param params 事件参数
|
|
717
|
+
* @param disableLog
|
|
718
|
+
*/
|
|
719
|
+
dispatchSub(type: string, params?: any, disableLog?: boolean): void;
|
|
720
|
+
toString(): string;
|
|
721
|
+
protected getOnEventItems(type: string): EventItem[];
|
|
722
|
+
id?: string;
|
|
723
|
+
uuid?: string;
|
|
724
|
+
name: string;
|
|
725
|
+
private _onEventItems;
|
|
726
|
+
protected isDispose: boolean;
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* 全局的事件派发器
|
|
730
|
+
*/
|
|
731
|
+
declare const eventmgr: EventManager;
|
|
732
|
+
|
|
733
|
+
declare class Caller<ARGS = any, RESULT = any> extends EventManager {
|
|
734
|
+
protocol: string;
|
|
735
|
+
constructor(protocol: string);
|
|
736
|
+
newArgs(): ARGS;
|
|
737
|
+
/**
|
|
738
|
+
* 获取参数的方法或者直接赋值
|
|
739
|
+
* @param val
|
|
740
|
+
*/
|
|
741
|
+
argsGetter(val: (ctx: Caller<ARGS, RESULT>) => void): this;
|
|
742
|
+
argsCondition(val: (ctx: Caller<ARGS, RESULT>) => error): this;
|
|
743
|
+
setConn(key: string): this;
|
|
744
|
+
setTimeout(val?: number): this;
|
|
745
|
+
noValid(): this;
|
|
746
|
+
onSimulate(val: (ctx: Caller<ARGS, RESULT>) => void): this;
|
|
747
|
+
/**
|
|
748
|
+
* 添加响应返回时的处理函数
|
|
749
|
+
* @param val
|
|
750
|
+
*/
|
|
751
|
+
onResponse(val: (ctx: Caller<ARGS, RESULT>) => void): this;
|
|
752
|
+
send(): this;
|
|
753
|
+
/**
|
|
754
|
+
* 等待发送的结果
|
|
755
|
+
* 如果返回 null,表示主动取消 [cancel]
|
|
756
|
+
*/
|
|
757
|
+
wait(): Promise<this>;
|
|
758
|
+
protected _send(): LinkError;
|
|
759
|
+
protected get connection(): IConn;
|
|
760
|
+
response(data: any, err: LinkError): void;
|
|
761
|
+
cancel(): void;
|
|
762
|
+
dispose(): void;
|
|
763
|
+
protected timeoutHandler(): void;
|
|
764
|
+
get hasResponse(): boolean;
|
|
765
|
+
/**
|
|
766
|
+
* 连接的名字
|
|
767
|
+
*/
|
|
768
|
+
protected _conn: string;
|
|
769
|
+
/**
|
|
770
|
+
* 无需验证
|
|
771
|
+
*/
|
|
772
|
+
protected _noValid: boolean;
|
|
773
|
+
protected _onSimulate: Function;
|
|
774
|
+
protected _argsGetter: Function | any;
|
|
775
|
+
protected _argsCondition: Function;
|
|
776
|
+
private _hasResponse;
|
|
777
|
+
protected _seq: number;
|
|
778
|
+
/**
|
|
779
|
+
* 消息额参数
|
|
780
|
+
*/
|
|
781
|
+
args: ARGS;
|
|
782
|
+
result: RESULT;
|
|
783
|
+
error: LinkError;
|
|
784
|
+
get timeout(): number;
|
|
785
|
+
protected _timeout: number;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
interface IConn {
|
|
789
|
+
key: string;
|
|
790
|
+
token: string;
|
|
791
|
+
send(caller: Caller): any;
|
|
792
|
+
connected: boolean;
|
|
793
|
+
isValid(): boolean;
|
|
794
|
+
update(): any;
|
|
795
|
+
lastSeqResp: number;
|
|
796
|
+
lastSeqSend: number;
|
|
797
|
+
seqToCaller: {
|
|
798
|
+
[key: string]: Caller;
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
declare class SyncHandler {
|
|
803
|
+
create: (key: string, obj: any) => void;
|
|
804
|
+
update: (key: string, obj: any) => void;
|
|
805
|
+
remove: (key: string, obj: any) => void;
|
|
806
|
+
}
|
|
807
|
+
declare class NetManager extends EventManager {
|
|
808
|
+
init(): void;
|
|
809
|
+
/**
|
|
810
|
+
* 创建一个socket链接
|
|
811
|
+
* 可通过SendMessageCtrl.SetConn指定
|
|
812
|
+
* @param key
|
|
813
|
+
* @param addr
|
|
814
|
+
*/
|
|
815
|
+
createSocket(key: string, addr: string): IConn;
|
|
816
|
+
/**
|
|
817
|
+
* 创建一个http链接
|
|
818
|
+
* 可通过SendMessageCtrl.SetConn指定
|
|
819
|
+
* @param key
|
|
820
|
+
* @param addr
|
|
821
|
+
*/
|
|
822
|
+
createHttp(key: string, addr: string): IConn;
|
|
823
|
+
/**
|
|
824
|
+
* 设置默认的链接
|
|
825
|
+
* ctrlz.SendMessageAction默认使用此链接
|
|
826
|
+
* 一个游戏可能包括多个链接:主socket,战斗socket,聊天socket,功能http
|
|
827
|
+
* @param key
|
|
828
|
+
*/
|
|
829
|
+
setDefault(key: string): void;
|
|
830
|
+
/**
|
|
831
|
+
* 获取链接
|
|
832
|
+
* @param key
|
|
833
|
+
*/
|
|
834
|
+
getConn(key: string): IConn;
|
|
835
|
+
/**
|
|
836
|
+
* 获取默认的链接
|
|
837
|
+
*/
|
|
838
|
+
getDefault(): IConn;
|
|
839
|
+
/**
|
|
840
|
+
* 注册Caller的创建函数
|
|
841
|
+
* 通常在打开界面的时候注册
|
|
842
|
+
* ```
|
|
843
|
+
* netmgr.register(this.uuid, rg_opt.Http.S数据表创建, ()=>{
|
|
844
|
+
* return new Caller(rg_opt.Http.S数据表读取)
|
|
845
|
+
* .argsGetter((caller?) => {
|
|
846
|
+
* return null;
|
|
847
|
+
* })
|
|
848
|
+
* .argsCondition((caller) => {
|
|
849
|
+
* return null;
|
|
850
|
+
* })
|
|
851
|
+
* .onResponse((caller) => {
|
|
852
|
+
*
|
|
853
|
+
* })
|
|
854
|
+
* })
|
|
855
|
+
* ```
|
|
856
|
+
* @param group
|
|
857
|
+
* @param id
|
|
858
|
+
* @param creator
|
|
859
|
+
*/
|
|
860
|
+
register(group: string, id: string, creator: Function): void;
|
|
861
|
+
/**
|
|
862
|
+
* 如果有全局调用的需求,可以设置group为 "global"
|
|
863
|
+
* @param id
|
|
864
|
+
* @param creator
|
|
865
|
+
*/
|
|
866
|
+
registerGlobal(id: string, creator: Function): void;
|
|
867
|
+
/**
|
|
868
|
+
* 获取调用者
|
|
869
|
+
* @param group
|
|
870
|
+
* @param id
|
|
871
|
+
*/
|
|
872
|
+
getCaller(group: string, id: string): Caller;
|
|
873
|
+
getCallerGlobal(id: string): Caller;
|
|
874
|
+
protected getCallerCreator(group: string, id: string): any;
|
|
875
|
+
removeGroup(group: string): void;
|
|
876
|
+
removeGroupGlobal(): void;
|
|
877
|
+
removeAll(): void;
|
|
878
|
+
registerCommandPriority(handler: (cmd: any, args: any) => void): void;
|
|
879
|
+
registerCommand(cmd: string, handler: (args: any) => void): void;
|
|
880
|
+
executeCommand(key: string, args: any): void;
|
|
881
|
+
registerSyncHandler(handler: SyncHandler): void;
|
|
882
|
+
useSimulate(): void;
|
|
883
|
+
isSimulate(): boolean;
|
|
884
|
+
protected _syncHandler: SyncHandler;
|
|
885
|
+
protected _cmdHandlers: {
|
|
886
|
+
[key: string]: (args: any) => void;
|
|
887
|
+
};
|
|
888
|
+
protected _cmdPriority: Function;
|
|
889
|
+
protected _callerCreator: any[];
|
|
890
|
+
protected _simulate: boolean;
|
|
891
|
+
conns: {
|
|
892
|
+
[key: string]: IConn;
|
|
893
|
+
};
|
|
894
|
+
defaultKey: string;
|
|
895
|
+
serialMode: SerializeMode;
|
|
896
|
+
}
|
|
897
|
+
declare var netmgr: NetManager;
|
|
898
|
+
|
|
899
|
+
declare class HttpRequest {
|
|
900
|
+
constructor();
|
|
901
|
+
/**
|
|
902
|
+
* @private
|
|
903
|
+
*/
|
|
904
|
+
private _xhr;
|
|
905
|
+
/**
|
|
906
|
+
*
|
|
907
|
+
*/
|
|
908
|
+
timeout: number;
|
|
909
|
+
/**
|
|
910
|
+
*
|
|
911
|
+
*/
|
|
912
|
+
onError: (request: HttpRequest) => void;
|
|
913
|
+
/**
|
|
914
|
+
*
|
|
915
|
+
*/
|
|
916
|
+
onComplete: (request: HttpRequest) => void;
|
|
917
|
+
/**
|
|
918
|
+
*
|
|
919
|
+
*/
|
|
920
|
+
onProgress: (request: HttpRequest, event: any) => void;
|
|
921
|
+
/**
|
|
922
|
+
* 出现错误时的错误信息
|
|
923
|
+
*/
|
|
924
|
+
error: error;
|
|
925
|
+
/**
|
|
926
|
+
* @private
|
|
927
|
+
* 本次请求返回的数据,数据类型根据responseType设置的值确定。
|
|
928
|
+
*/
|
|
929
|
+
get response(): any;
|
|
930
|
+
/**
|
|
931
|
+
* @private
|
|
932
|
+
*/
|
|
933
|
+
private _responseType;
|
|
934
|
+
/**
|
|
935
|
+
* @private
|
|
936
|
+
* 设置返回的数据格式,请使用 HttpResponseType 里定义的枚举值。设置非法的值或不设置,都将使用HttpResponseType.TEXT。
|
|
937
|
+
*/
|
|
938
|
+
get responseType(): HttpResponseType;
|
|
939
|
+
set responseType(value: HttpResponseType);
|
|
940
|
+
/**
|
|
941
|
+
* @private
|
|
942
|
+
*/
|
|
943
|
+
private _withCredentials;
|
|
944
|
+
/**
|
|
945
|
+
* @private
|
|
946
|
+
* 表明在进行跨站(cross-site)的访问控制(Access-Control)请求时,是否使用认证信息(例如cookie或授权的header)。 默认为 false。(这个标志不会影响同站的请求)
|
|
947
|
+
*/
|
|
948
|
+
get withCredentials(): boolean;
|
|
949
|
+
set withCredentials(value: boolean);
|
|
950
|
+
/**
|
|
951
|
+
* @private
|
|
952
|
+
*/
|
|
953
|
+
private _url;
|
|
954
|
+
private _method;
|
|
955
|
+
/**
|
|
956
|
+
* @private
|
|
957
|
+
*
|
|
958
|
+
* @returns
|
|
959
|
+
*/
|
|
960
|
+
private getXHR;
|
|
961
|
+
/**
|
|
962
|
+
* @private
|
|
963
|
+
* 初始化一个请求.注意,若在已经发出请求的对象上调用此方法,相当于立即调用abort().
|
|
964
|
+
* @param url 该请求所要访问的URL该请求所要访问的URL
|
|
965
|
+
* @param method 请求所使用的HTTP方法, 请使用 HttpMethod 定义的枚举值.
|
|
966
|
+
*/
|
|
967
|
+
open(url: string, method?: HttpMethod): void;
|
|
968
|
+
/**
|
|
969
|
+
* @private
|
|
970
|
+
* 发送请求.
|
|
971
|
+
* @param data 需要发送的数据
|
|
972
|
+
*/
|
|
973
|
+
send(data?: any): void;
|
|
974
|
+
/**
|
|
975
|
+
* @private
|
|
976
|
+
* 如果请求已经被发送,则立刻中止请求.
|
|
977
|
+
*/
|
|
978
|
+
abort(): void;
|
|
979
|
+
/**
|
|
980
|
+
* @private
|
|
981
|
+
* 返回所有响应头信息(响应头名和值), 如果响应头还没接受,则返回"".
|
|
982
|
+
*/
|
|
983
|
+
getAllResponseHeaders(): string;
|
|
984
|
+
private headerObj;
|
|
985
|
+
/**
|
|
986
|
+
* @private
|
|
987
|
+
* 给指定的HTTP请求头赋值.在这之前,您必须确认已经调用 open() 方法打开了一个url.
|
|
988
|
+
* @param header 将要被赋值的请求头名称.
|
|
989
|
+
* @param value 给指定的请求头赋的值.
|
|
990
|
+
*/
|
|
991
|
+
setRequestHeader(header: string, value: string): void;
|
|
992
|
+
/**
|
|
993
|
+
* @private
|
|
994
|
+
* 返回指定的响应头的值, 如果响应头还没被接受,或该响应头不存在,则返回"".
|
|
995
|
+
* @param header 要返回的响应头名称
|
|
996
|
+
*/
|
|
997
|
+
getResponseHeader(header: string): string;
|
|
998
|
+
/**
|
|
999
|
+
* @private
|
|
1000
|
+
*/
|
|
1001
|
+
private onTimeout;
|
|
1002
|
+
private callOnError;
|
|
1003
|
+
private callOnProgress;
|
|
1004
|
+
private callOnComplete;
|
|
1005
|
+
/**
|
|
1006
|
+
* @private
|
|
1007
|
+
*/
|
|
1008
|
+
private onReadyStateChange;
|
|
1009
|
+
/**
|
|
1010
|
+
* @private
|
|
1011
|
+
*/
|
|
1012
|
+
private updateProgress;
|
|
1013
|
+
/**
|
|
1014
|
+
* @private
|
|
1015
|
+
*/
|
|
1016
|
+
private onload;
|
|
1017
|
+
/**
|
|
1018
|
+
* @private
|
|
1019
|
+
*/
|
|
1020
|
+
private onerror;
|
|
1021
|
+
}
|
|
1022
|
+
declare class NetHttp {
|
|
1023
|
+
/**
|
|
1024
|
+
* 地址
|
|
1025
|
+
*/
|
|
1026
|
+
addr: string;
|
|
1027
|
+
key: string;
|
|
1028
|
+
token: string;
|
|
1029
|
+
lastSeqResp: number;
|
|
1030
|
+
lastSeqSend: number;
|
|
1031
|
+
seqToCaller: any;
|
|
1032
|
+
valid: ValidState;
|
|
1033
|
+
constructor();
|
|
1034
|
+
isValid(): boolean;
|
|
1035
|
+
send(caller: Caller): Caller<any, any>;
|
|
1036
|
+
update(): void;
|
|
1037
|
+
get connected(): boolean;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
declare function parseData(mode: number, data: any | ByteArray, route?: string): [any, error];
|
|
1041
|
+
declare function receiveData(conn: IConn, ba: ByteArray, endian: string): void;
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
*
|
|
1045
|
+
*/
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* egret.WebSocket 类启用代码以建立传输控制协议 (TCP) 套接字连接,用于发送和接收字符串或二进制数据。
|
|
1049
|
+
* 要使用 egret.WebSocket 类的方法,请先使用构造函数 new egret.WebSocket 创建一个 egret.WebSocket 对象。
|
|
1050
|
+
* 套接字以异步方式传输和接收数据。
|
|
1051
|
+
*/
|
|
1052
|
+
declare class FrameWebSocket {
|
|
1053
|
+
/**
|
|
1054
|
+
* 以字符串格式发送和接收数据
|
|
1055
|
+
*/
|
|
1056
|
+
static TYPE_STRING: string;
|
|
1057
|
+
/**
|
|
1058
|
+
* 以二进制格式发送和接收数据
|
|
1059
|
+
*/
|
|
1060
|
+
static TYPE_BINARY: string;
|
|
1061
|
+
private _writeMessage;
|
|
1062
|
+
private _readMessage;
|
|
1063
|
+
private _connected;
|
|
1064
|
+
private _connecting;
|
|
1065
|
+
private _socket;
|
|
1066
|
+
private _url;
|
|
1067
|
+
/**
|
|
1068
|
+
* 出现错误时的错误信息
|
|
1069
|
+
*/
|
|
1070
|
+
error: error;
|
|
1071
|
+
/**
|
|
1072
|
+
* 根据提供的url连接
|
|
1073
|
+
* @param url 全地址。如ws://echo.websocket.org:80
|
|
1074
|
+
*/
|
|
1075
|
+
constructor(url?: string);
|
|
1076
|
+
onOpen: (socket: FrameWebSocket) => void;
|
|
1077
|
+
onClose: (socket: FrameWebSocket) => void;
|
|
1078
|
+
onMessage: (socket: FrameWebSocket) => void;
|
|
1079
|
+
onError: (socket: FrameWebSocket) => void;
|
|
1080
|
+
private callOnOpen;
|
|
1081
|
+
private callOnClose;
|
|
1082
|
+
private callOnMessage;
|
|
1083
|
+
private callOnError;
|
|
1084
|
+
/**
|
|
1085
|
+
* 根据提供的url连接
|
|
1086
|
+
* @param url 全地址。如ws://echo.websocket.org:80
|
|
1087
|
+
*/
|
|
1088
|
+
connect(url: string): void;
|
|
1089
|
+
/**
|
|
1090
|
+
* 关闭套接字
|
|
1091
|
+
*/
|
|
1092
|
+
close(): void;
|
|
1093
|
+
/**
|
|
1094
|
+
* 对套接字输出缓冲区中积累的所有数据进行刷新
|
|
1095
|
+
*/
|
|
1096
|
+
flush(): void;
|
|
1097
|
+
private _isReadySend;
|
|
1098
|
+
/**
|
|
1099
|
+
* 将字符串数据写入套接字
|
|
1100
|
+
* @param message 要写入套接字的字符串
|
|
1101
|
+
*/
|
|
1102
|
+
writeUTF(message: string): void;
|
|
1103
|
+
/**
|
|
1104
|
+
* 从套接字读取一个 UTF-8 字符串
|
|
1105
|
+
* @returns {string}
|
|
1106
|
+
*/
|
|
1107
|
+
readUTF(): string;
|
|
1108
|
+
private _readByte;
|
|
1109
|
+
private _writeByte;
|
|
1110
|
+
private _bytesWrite;
|
|
1111
|
+
/**
|
|
1112
|
+
* 从指定的字节数组写入一系列字节。写入操作从 offset 指定的位置开始。
|
|
1113
|
+
* 如果省略了 length 参数,则默认长度 0 将导致该方法从 offset 开始写入整个缓冲区。
|
|
1114
|
+
* 如果还省略了 offset 参数,则写入整个缓冲区。
|
|
1115
|
+
* @param bytes 要从中读取数据的 ByteArray 对象
|
|
1116
|
+
* @param offset ByteArray 对象中从零开始的偏移量,应由此开始执行数据写入
|
|
1117
|
+
* @param length 要写入的字节数。默认值 0 导致从 offset 参数指定的值开始写入整个缓冲区
|
|
1118
|
+
|
|
1119
|
+
*/
|
|
1120
|
+
writeBytes(bytes: ByteArray, offset?: number, length?: number): void;
|
|
1121
|
+
/**
|
|
1122
|
+
* 从套接字读取 length 参数指定的数据字节数。从 offset 所表示的位置开始,将这些字节读入指定的字节数组
|
|
1123
|
+
* @param bytes 要将数据读入的 ByteArray 对象
|
|
1124
|
+
* @param offset 数据读取的偏移量应从该字节数组中开始
|
|
1125
|
+
* @param length 要读取的字节数。默认值 0 导致读取所有可用的数据
|
|
1126
|
+
*/
|
|
1127
|
+
readBytes(bytes: ByteArray, offset?: number, length?: number): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* 表示此 Socket 对象目前是否已连接
|
|
1130
|
+
*/
|
|
1131
|
+
get connected(): boolean;
|
|
1132
|
+
/**
|
|
1133
|
+
* @private
|
|
1134
|
+
*/
|
|
1135
|
+
private _type;
|
|
1136
|
+
/**
|
|
1137
|
+
* 发送和接收数据的格式,默认是字符串格式
|
|
1138
|
+
*/
|
|
1139
|
+
get type(): WebSocketType;
|
|
1140
|
+
set type(value: WebSocketType);
|
|
1141
|
+
static URI: "ws://" | "wss://";
|
|
1142
|
+
}
|
|
1143
|
+
declare class NetSocket extends EventManager {
|
|
1144
|
+
static EVENT_CONNECTED: string;
|
|
1145
|
+
static EVENT_CLOSED: string;
|
|
1146
|
+
static EVENT_TIMEOUT: string;
|
|
1147
|
+
/**
|
|
1148
|
+
* 连接校验失败,并超过重试次数
|
|
1149
|
+
*/
|
|
1150
|
+
static EVENT_VALID_FAIL: string;
|
|
1151
|
+
/**
|
|
1152
|
+
* 连接校验成功
|
|
1153
|
+
*/
|
|
1154
|
+
static EVENT_VALID: string;
|
|
1155
|
+
key: string;
|
|
1156
|
+
protected reconnectMax: number;
|
|
1157
|
+
protected reconnectCount: number;
|
|
1158
|
+
protected reconnectSpace: number;
|
|
1159
|
+
addr: string;
|
|
1160
|
+
state: ConnectState;
|
|
1161
|
+
valid: ValidState;
|
|
1162
|
+
private lastReconnectTime;
|
|
1163
|
+
lastSeqSend: number;
|
|
1164
|
+
lastSeqResp: number;
|
|
1165
|
+
seqToCaller: {
|
|
1166
|
+
[key: string]: Caller;
|
|
1167
|
+
};
|
|
1168
|
+
endian: string;
|
|
1169
|
+
protected _socket: FrameWebSocket;
|
|
1170
|
+
token: string;
|
|
1171
|
+
serialMode: SerializeMode;
|
|
1172
|
+
constructor();
|
|
1173
|
+
get connected(): boolean;
|
|
1174
|
+
isValid(): boolean;
|
|
1175
|
+
update(): void;
|
|
1176
|
+
protected createVerifyConnectionCaller(): Caller;
|
|
1177
|
+
protected createHeartBeatCaller(): Caller;
|
|
1178
|
+
protected updateValid(): void;
|
|
1179
|
+
protected _validCaller: Caller;
|
|
1180
|
+
protected _validMax: number;
|
|
1181
|
+
protected _validCount: number;
|
|
1182
|
+
getReconnectSpace(): number;
|
|
1183
|
+
reconnect(): void;
|
|
1184
|
+
connect(): void;
|
|
1185
|
+
close(): void;
|
|
1186
|
+
waitConnect(): Promise<boolean>;
|
|
1187
|
+
waitValid(): Promise<boolean>;
|
|
1188
|
+
/**
|
|
1189
|
+
*
|
|
1190
|
+
* @param caller
|
|
1191
|
+
*/
|
|
1192
|
+
send(caller: Caller): Caller;
|
|
1193
|
+
protected _onOpen(e: any): void;
|
|
1194
|
+
protected _流量: number;
|
|
1195
|
+
reset流量(): void;
|
|
1196
|
+
protected _流量时间: number;
|
|
1197
|
+
protected _count: number;
|
|
1198
|
+
protected _onMessage(): void;
|
|
1199
|
+
protected _onClose(e: any): void;
|
|
1200
|
+
protected _onError(e: any): void;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
declare class RequestProtocol {
|
|
1204
|
+
id: string;
|
|
1205
|
+
seq: number;
|
|
1206
|
+
serialMode: number;
|
|
1207
|
+
token: string;
|
|
1208
|
+
data: any;
|
|
1209
|
+
pack(writer: ByteArray): void;
|
|
1210
|
+
}
|
|
1211
|
+
declare class ResponseProtocol {
|
|
1212
|
+
seq: number;
|
|
1213
|
+
serialMode: number;
|
|
1214
|
+
error: string;
|
|
1215
|
+
data: ByteArray;
|
|
1216
|
+
unpack(reader: ByteArray, endian: string): void;
|
|
1217
|
+
}
|
|
1218
|
+
declare class PushProtocol {
|
|
1219
|
+
serialMode: number;
|
|
1220
|
+
data: any;
|
|
1221
|
+
unpack(reader: ByteArray): void;
|
|
1222
|
+
}
|
|
1223
|
+
declare class CreateProtocol {
|
|
1224
|
+
key: string;
|
|
1225
|
+
serialMode: number;
|
|
1226
|
+
data: any;
|
|
1227
|
+
unpack(reader: ByteArray): void;
|
|
1228
|
+
}
|
|
1229
|
+
declare class UpdateProtocol {
|
|
1230
|
+
key: string;
|
|
1231
|
+
serialMode: number;
|
|
1232
|
+
data: any;
|
|
1233
|
+
unpack(reader: ByteArray): void;
|
|
1234
|
+
}
|
|
1235
|
+
declare class DeleteProtocol {
|
|
1236
|
+
key: string;
|
|
1237
|
+
unpack(reader: ByteArray): void;
|
|
1238
|
+
}
|
|
1239
|
+
declare class EventProtocol {
|
|
1240
|
+
key: string;
|
|
1241
|
+
serialMode: number;
|
|
1242
|
+
data: any;
|
|
1243
|
+
unpack(reader: ByteArray): void;
|
|
1244
|
+
}
|
|
1245
|
+
declare class CommandProtocol {
|
|
1246
|
+
key: string;
|
|
1247
|
+
serialMode: number;
|
|
1248
|
+
data: any;
|
|
1249
|
+
unpack(reader: ByteArray): void;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
declare class ListIterator {
|
|
1253
|
+
break(): void;
|
|
1254
|
+
isBreak(): boolean;
|
|
1255
|
+
protected _isBreak: any;
|
|
1256
|
+
}
|
|
1257
|
+
declare class List<T = any> {
|
|
1258
|
+
constructor();
|
|
1259
|
+
onSet(caller: any, handler: (value: T) => void): void;
|
|
1260
|
+
onDelete(caller: any, handler: (value: T) => void): void;
|
|
1261
|
+
firstByCondition(conf: (index: number, item: T) => boolean): [number, T];
|
|
1262
|
+
lastByCondition(conf: (index: number, item: T) => boolean): [number, T];
|
|
1263
|
+
forEach(handler: (index: number, item: T, iterator: ListIterator) => void): ListIterator;
|
|
1264
|
+
/**
|
|
1265
|
+
* 移除符合条件的项, 从后往前遍历
|
|
1266
|
+
* @param cond 可以使用【iterator】中断遍历
|
|
1267
|
+
* @param removedList 设置后,可获得被移除的项
|
|
1268
|
+
*/
|
|
1269
|
+
removeByCondition(cond: (index: number, val: T, iterator: ListIterator) => boolean, removedList?: List): this;
|
|
1270
|
+
/**
|
|
1271
|
+
* 查找符合条件的项保存到【target】对象中,并返回【target】对象
|
|
1272
|
+
* @param cond 可以使用【iterator】中断遍历
|
|
1273
|
+
* @param target 存到目标对象中
|
|
1274
|
+
*/
|
|
1275
|
+
findByCondition(cond: (index: number, val: T, iterator: ListIterator) => boolean, target: List): this;
|
|
1276
|
+
pop(): T;
|
|
1277
|
+
shift(): T;
|
|
1278
|
+
first(): T;
|
|
1279
|
+
last(): T;
|
|
1280
|
+
removeAt(index: number): void;
|
|
1281
|
+
remove(item: T): void;
|
|
1282
|
+
/**
|
|
1283
|
+
* 把【other】的项合并到自身
|
|
1284
|
+
* @param other
|
|
1285
|
+
*/
|
|
1286
|
+
removeList(other: List<T>): void;
|
|
1287
|
+
sort(compareFn?: (a: T, b: T) => number): void;
|
|
1288
|
+
reverse(): void;
|
|
1289
|
+
clear(): void;
|
|
1290
|
+
/**
|
|
1291
|
+
* 克隆自身所有项到【target】对象,并返回【target】对象
|
|
1292
|
+
* @param target
|
|
1293
|
+
*/
|
|
1294
|
+
clone(target: this): this;
|
|
1295
|
+
get length(): number;
|
|
1296
|
+
insertAt(index: number, ...item: T[]): void;
|
|
1297
|
+
/**
|
|
1298
|
+
* @param beforeItem
|
|
1299
|
+
* @param item
|
|
1300
|
+
*/
|
|
1301
|
+
insertBefore(beforeItem: T, ...item: T[]): void;
|
|
1302
|
+
/**
|
|
1303
|
+
* @param afterItem
|
|
1304
|
+
* @param item
|
|
1305
|
+
*/
|
|
1306
|
+
insertAfter(afterItem: T, ...item: T[]): void;
|
|
1307
|
+
at(index: number): T;
|
|
1308
|
+
set(index: number, item: T): void;
|
|
1309
|
+
indexOf(item: T): number;
|
|
1310
|
+
has(item: T): boolean;
|
|
1311
|
+
push(item: T): void;
|
|
1312
|
+
/**
|
|
1313
|
+
* 把【other】的项合并到自身
|
|
1314
|
+
* @param other
|
|
1315
|
+
*/
|
|
1316
|
+
pushList(other: List<T>): void;
|
|
1317
|
+
getData(): T[];
|
|
1318
|
+
resetData(val: T[]): void;
|
|
1319
|
+
/**
|
|
1320
|
+
* 随机获取【count】个项,并返回【target】对象
|
|
1321
|
+
* @param count
|
|
1322
|
+
* @param enableRepeat 允许重复
|
|
1323
|
+
* @param target
|
|
1324
|
+
*/
|
|
1325
|
+
random(count: number, enableRepeat?: boolean, target?: List<T>): List<T>;
|
|
1326
|
+
protected callPush(value: any): void;
|
|
1327
|
+
protected callRemove(value: any): void;
|
|
1328
|
+
protected _data: any[];
|
|
1329
|
+
private _onSet;
|
|
1330
|
+
private _onDelete;
|
|
1331
|
+
private _onSetCaller;
|
|
1332
|
+
private _onDeleteCaller;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
/**
|
|
1336
|
+
* 事件字符串分隔符
|
|
1337
|
+
*/
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* 回调列表
|
|
1341
|
+
*/
|
|
1342
|
+
declare class CallbackList<PARAMS = any> {
|
|
1343
|
+
constructor();
|
|
1344
|
+
addListener(listener: Listener): void;
|
|
1345
|
+
removeListener(listener: Listener): void;
|
|
1346
|
+
/**
|
|
1347
|
+
*/
|
|
1348
|
+
create(): Listener<PARAMS>;
|
|
1349
|
+
/**
|
|
1350
|
+
* 如果监听器已经不存在,则创建
|
|
1351
|
+
* @param ident
|
|
1352
|
+
*/
|
|
1353
|
+
createByIdent(ident: any): Listener<PARAMS>;
|
|
1354
|
+
removeByIdent(ident: any): void;
|
|
1355
|
+
removeByCaller(caller: any): void;
|
|
1356
|
+
getByIdent(ident: any): Listener;
|
|
1357
|
+
/**
|
|
1358
|
+
* 派发事件
|
|
1359
|
+
* @param params 事件参数
|
|
1360
|
+
* @param subIdent
|
|
1361
|
+
*/
|
|
1362
|
+
dispatch(params?: PARAMS, subIdent?: string): void;
|
|
1363
|
+
protected _data: List<Listener<any>>;
|
|
1364
|
+
protected _indexIdent: {};
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
declare class Listener<PARAMS = any> {
|
|
1368
|
+
static create(ident?: string): Listener<any>;
|
|
1369
|
+
constructor(ident?: string);
|
|
1370
|
+
getCaller(): any;
|
|
1371
|
+
setCaller(caller: any): this;
|
|
1372
|
+
setSubIdent(val: string): this;
|
|
1373
|
+
setCondition(condition: (listener: Listener<PARAMS>) => boolean): this;
|
|
1374
|
+
setHandler(handler: (listener: Listener<PARAMS>) => void): this;
|
|
1375
|
+
setOnParams(val: any): this;
|
|
1376
|
+
getIdent(): string;
|
|
1377
|
+
on(): this;
|
|
1378
|
+
off(): this;
|
|
1379
|
+
isOn(): boolean;
|
|
1380
|
+
remove(): void;
|
|
1381
|
+
/**
|
|
1382
|
+
* 内部使用
|
|
1383
|
+
* @param params
|
|
1384
|
+
* @param subIdent 子编号
|
|
1385
|
+
*/
|
|
1386
|
+
_dispatch(params: PARAMS, subIdent?: string): void;
|
|
1387
|
+
getOnParams(): any;
|
|
1388
|
+
getParams(): PARAMS;
|
|
1389
|
+
protected onParams: any;
|
|
1390
|
+
protected params: PARAMS;
|
|
1391
|
+
protected ident: string;
|
|
1392
|
+
protected _subIdent: string;
|
|
1393
|
+
protected source: CallbackList;
|
|
1394
|
+
protected _handler: (any: any) => void;
|
|
1395
|
+
protected _condition: (any: any) => boolean;
|
|
1396
|
+
protected caller: any;
|
|
1397
|
+
protected _isOn: boolean;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
declare class DictIterator {
|
|
1401
|
+
break(): void;
|
|
1402
|
+
isBreak(): boolean;
|
|
1403
|
+
protected _isBreak: any;
|
|
1404
|
+
}
|
|
1405
|
+
declare class Dictionary<K = string, V = any> {
|
|
1406
|
+
constructor(data?: any);
|
|
1407
|
+
reset(data: any): void;
|
|
1408
|
+
protected _reset(data: any, size?: number): void;
|
|
1409
|
+
getData(): any;
|
|
1410
|
+
/**
|
|
1411
|
+
* 如果使用了 onSet or onDelete,需要注意清理
|
|
1412
|
+
*/
|
|
1413
|
+
clear(): void;
|
|
1414
|
+
/**
|
|
1415
|
+
* 克隆自身所有项到【target】对象,并返回【target】对象
|
|
1416
|
+
* @param target
|
|
1417
|
+
*/
|
|
1418
|
+
clone(target: this): this;
|
|
1419
|
+
resetByDict(dict: Dictionary): void;
|
|
1420
|
+
onSet(caller: any, handler: (key: K, value: V) => void): void;
|
|
1421
|
+
onDelete(caller: any, handler: (key: K, value: V) => void): void;
|
|
1422
|
+
/**
|
|
1423
|
+
* 设置键值对,如果没有发生变化,不会触发onSet函数
|
|
1424
|
+
* @param key
|
|
1425
|
+
* @param value
|
|
1426
|
+
*/
|
|
1427
|
+
set(key: K, value: V): void;
|
|
1428
|
+
private setData;
|
|
1429
|
+
setByMap(m: any): void;
|
|
1430
|
+
addDictionary(other: Dictionary<K, V>): void;
|
|
1431
|
+
deleteDictionary(other: Dictionary<K, V>): void;
|
|
1432
|
+
/**
|
|
1433
|
+
* 如果不存在,返回 undefined
|
|
1434
|
+
* @param key
|
|
1435
|
+
*/
|
|
1436
|
+
get(key: K): V;
|
|
1437
|
+
exist(key: K): boolean;
|
|
1438
|
+
delete(key: K): void;
|
|
1439
|
+
private deleteData;
|
|
1440
|
+
exists(key: K): boolean;
|
|
1441
|
+
length(): number;
|
|
1442
|
+
pop(key: K): [V, boolean];
|
|
1443
|
+
isEmpty(): boolean;
|
|
1444
|
+
items(): V[];
|
|
1445
|
+
keys(): K[];
|
|
1446
|
+
/**
|
|
1447
|
+
*
|
|
1448
|
+
* @param handler 可以使用【iterator】中断遍历
|
|
1449
|
+
* @return iterator 获取是否中断了
|
|
1450
|
+
*/
|
|
1451
|
+
forEach(handler: (key: K, val: V, iterator: DictIterator) => void): DictIterator;
|
|
1452
|
+
/**
|
|
1453
|
+
*/
|
|
1454
|
+
first(): V | undefined;
|
|
1455
|
+
/**
|
|
1456
|
+
* @param handler 返回true结束迭代
|
|
1457
|
+
*/
|
|
1458
|
+
firstByCondition(handler: (key: K, val: V) => boolean): V | undefined;
|
|
1459
|
+
/**
|
|
1460
|
+
* 移除符合条件的项
|
|
1461
|
+
* @param cond 可以使用【iterator】中断遍历
|
|
1462
|
+
*/
|
|
1463
|
+
removeByCondition(cond: (key: K, val: V, iterator: DictIterator) => boolean): void;
|
|
1464
|
+
/**
|
|
1465
|
+
* 查找符合条件的项保存到【target】对象中,并返回【target】对象
|
|
1466
|
+
* @param cond 可以使用【iterator】中断遍历
|
|
1467
|
+
* @param target 存到目标对象中
|
|
1468
|
+
*/
|
|
1469
|
+
findByCondition(cond: (key: K, val: V, iterator: DictIterator) => boolean, target: Dictionary): this;
|
|
1470
|
+
groupByCondition(createKey: (key: K, val: V) => string, ITEM_CLASS?: any): {
|
|
1471
|
+
[key: string]: any;
|
|
1472
|
+
};
|
|
1473
|
+
protected size: number;
|
|
1474
|
+
private _data;
|
|
1475
|
+
private _onSet;
|
|
1476
|
+
private _onDelete;
|
|
1477
|
+
private _onSetCaller;
|
|
1478
|
+
private _onDeleteCaller;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
/**
|
|
1482
|
+
* 事件字符串分隔符
|
|
1483
|
+
*/
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* 事件派发器
|
|
1487
|
+
*/
|
|
1488
|
+
declare class Dispatcher implements ISchedulable {
|
|
1489
|
+
constructor(name?: string);
|
|
1490
|
+
dispose(): void;
|
|
1491
|
+
create(type: string, listener: Listener): void;
|
|
1492
|
+
remove(type: string, listener: Listener): void;
|
|
1493
|
+
getByIdent(type: string, ident: string): Listener;
|
|
1494
|
+
/**
|
|
1495
|
+
* @param type
|
|
1496
|
+
* @param ident
|
|
1497
|
+
*/
|
|
1498
|
+
createByIdent(type: string, ident: string): Listener;
|
|
1499
|
+
/**
|
|
1500
|
+
* 派发事件
|
|
1501
|
+
* @param eventType 事件类型
|
|
1502
|
+
* @param params 事件参数
|
|
1503
|
+
*/
|
|
1504
|
+
dispatch(eventType: string, params?: any): void;
|
|
1505
|
+
protected getList(type: string): CallbackList;
|
|
1506
|
+
id?: string;
|
|
1507
|
+
uuid?: string;
|
|
1508
|
+
name: string;
|
|
1509
|
+
protected isDispose: boolean;
|
|
1510
|
+
protected typeToList: Dictionary<string, CallbackList<any>>;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
interface ITriggerEvent extends ISchedulable {
|
|
1514
|
+
/**
|
|
1515
|
+
*
|
|
1516
|
+
* @param val
|
|
1517
|
+
*/
|
|
1518
|
+
callback(val: (event: this) => void): this;
|
|
1519
|
+
/**
|
|
1520
|
+
* 执行触发器
|
|
1521
|
+
*/
|
|
1522
|
+
execute(): any;
|
|
1523
|
+
/**
|
|
1524
|
+
* 允许触发器
|
|
1525
|
+
*/
|
|
1526
|
+
enable(): any;
|
|
1527
|
+
/**
|
|
1528
|
+
* 禁止触发器
|
|
1529
|
+
*/
|
|
1530
|
+
disable(): any;
|
|
1531
|
+
/**
|
|
1532
|
+
* 重置触发器
|
|
1533
|
+
*/
|
|
1534
|
+
reset(): any;
|
|
1535
|
+
/**
|
|
1536
|
+
* 释放触发器
|
|
1537
|
+
*/
|
|
1538
|
+
dispose(): any;
|
|
1539
|
+
/**
|
|
1540
|
+
* 设置触发后,下一帧再执行
|
|
1541
|
+
* @param val
|
|
1542
|
+
*/
|
|
1543
|
+
setCallLater(val: boolean): this;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* 触发器
|
|
1548
|
+
*/
|
|
1549
|
+
declare class TriggerEvent implements ITriggerEvent {
|
|
1550
|
+
id?: string;
|
|
1551
|
+
uuid?: string;
|
|
1552
|
+
protected _enable: boolean;
|
|
1553
|
+
protected _callback: Function;
|
|
1554
|
+
protected _args: any | Function;
|
|
1555
|
+
protected _ident: string;
|
|
1556
|
+
protected _condition: Function;
|
|
1557
|
+
private _isNextFrame;
|
|
1558
|
+
constructor();
|
|
1559
|
+
reset(): void;
|
|
1560
|
+
setCondition(val: (event: this) => boolean): this;
|
|
1561
|
+
/**
|
|
1562
|
+
* 可通过ident直接控制触发器
|
|
1563
|
+
*/
|
|
1564
|
+
setIdent(ident?: string): this;
|
|
1565
|
+
/**
|
|
1566
|
+
* 设置触发后,下一帧再执行
|
|
1567
|
+
* @param val
|
|
1568
|
+
*/
|
|
1569
|
+
setCallLater(val: boolean): this;
|
|
1570
|
+
/**
|
|
1571
|
+
* @param val
|
|
1572
|
+
*/
|
|
1573
|
+
callback(val: (event: this) => void): this;
|
|
1574
|
+
execute(): void;
|
|
1575
|
+
enable(): void;
|
|
1576
|
+
disable(): void;
|
|
1577
|
+
dispose(): void;
|
|
1578
|
+
/**
|
|
1579
|
+
* 用于异步函数, 等待事件
|
|
1580
|
+
*/
|
|
1581
|
+
wait(): Promise<ITriggerEvent>;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* 事件触发器
|
|
1586
|
+
* 注意: 列表项中监听全局的事件容易导致所有项都进行了监听.
|
|
1587
|
+
*/
|
|
1588
|
+
|
|
1589
|
+
/**
|
|
1590
|
+
* 触发器-监听框架的事件
|
|
1591
|
+
*/
|
|
1592
|
+
declare class FrameEvent extends TriggerEvent {
|
|
1593
|
+
dispatcher: IEventManager;
|
|
1594
|
+
eventName: string;
|
|
1595
|
+
static create(dispatcher: IEventManager, eventName: string): FrameEvent;
|
|
1596
|
+
/**
|
|
1597
|
+
* 数据发生变化时使用,默认参数为 集合的编号
|
|
1598
|
+
* 可通过 event.dispatchParams 获取发生变化的配置
|
|
1599
|
+
*/
|
|
1600
|
+
static MAP_CHANGE: string;
|
|
1601
|
+
/**
|
|
1602
|
+
*
|
|
1603
|
+
*/
|
|
1604
|
+
static DATA_CHANGE: string;
|
|
1605
|
+
/**
|
|
1606
|
+
*
|
|
1607
|
+
*/
|
|
1608
|
+
static CHANGED: string;
|
|
1609
|
+
/**
|
|
1610
|
+
* 派发的事件;
|
|
1611
|
+
*/
|
|
1612
|
+
event: XEvent;
|
|
1613
|
+
constructor(dispatcher: IEventManager, eventName: string);
|
|
1614
|
+
enable(): void;
|
|
1615
|
+
protected handler(event: XEvent): void;
|
|
1616
|
+
disable(): void;
|
|
1617
|
+
dispose(): void;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* 用于扩展
|
|
1622
|
+
*/
|
|
1623
|
+
|
|
1624
|
+
declare class Trigger {
|
|
1625
|
+
/**
|
|
1626
|
+
*
|
|
1627
|
+
* @param group 设置所在组,通常为当前界面的uuid
|
|
1628
|
+
* @param ident 默认为不用设置,如果需要对触发器进行操作,可指定ident
|
|
1629
|
+
*/
|
|
1630
|
+
constructor(group: string, ident?: any);
|
|
1631
|
+
enable(): void;
|
|
1632
|
+
disable(): void;
|
|
1633
|
+
destroy(): void;
|
|
1634
|
+
/**
|
|
1635
|
+
* 把当前的行为转化为异步,等待当前行为结束
|
|
1636
|
+
*/
|
|
1637
|
+
waitAction(): void;
|
|
1638
|
+
/**
|
|
1639
|
+
* 当前行为结束,执行下一个行为
|
|
1640
|
+
*/
|
|
1641
|
+
nextAction(): void;
|
|
1642
|
+
protected setIdent(ident: any): this;
|
|
1643
|
+
getTimer(): Timer;
|
|
1644
|
+
when(val: ITriggerEvent): this;
|
|
1645
|
+
protected callback(event: ITriggerEvent): void;
|
|
1646
|
+
protected _when(val: ITriggerEvent, callback: (event: ITriggerEvent) => void): this;
|
|
1647
|
+
action(val: (trigger: Trigger) => void | Promise<any>): this;
|
|
1648
|
+
once(): this;
|
|
1649
|
+
protected _isOnce: boolean;
|
|
1650
|
+
protected executeNextAction(): void;
|
|
1651
|
+
/**
|
|
1652
|
+
* 完成时, 执行的方法
|
|
1653
|
+
* @param f
|
|
1654
|
+
*/
|
|
1655
|
+
onComplete(f: (action: this) => any): this;
|
|
1656
|
+
complete(...args: any[]): void;
|
|
1657
|
+
protected callOnComplete(...args: any[]): void;
|
|
1658
|
+
get lastEvent(): ITriggerEvent;
|
|
1659
|
+
get group(): string;
|
|
1660
|
+
get ident(): string;
|
|
1661
|
+
protected _disposed: boolean;
|
|
1662
|
+
private _ident;
|
|
1663
|
+
protected _events: ITriggerEvent[];
|
|
1664
|
+
protected _actions: (Function | Promise<any>)[];
|
|
1665
|
+
protected _actionExectuingIndex: number;
|
|
1666
|
+
protected _actionWaiting: boolean;
|
|
1667
|
+
protected _actionExecuting: any;
|
|
1668
|
+
protected _onCompleteHandler: Function;
|
|
1669
|
+
protected _runing: boolean;
|
|
1670
|
+
private _lastEvent;
|
|
1671
|
+
private _group;
|
|
1672
|
+
protected _nodeEvent: FrameEvent;
|
|
1673
|
+
id?: string;
|
|
1674
|
+
uuid?: string;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
declare class TriggerManager extends EventManager {
|
|
1678
|
+
triggers: Trigger[];
|
|
1679
|
+
constructor();
|
|
1680
|
+
enable(group: string, ident: any): void;
|
|
1681
|
+
disable(group: string, ident: any): void;
|
|
1682
|
+
remove(group: string, ident: any): void;
|
|
1683
|
+
removeTrigger(trigger: Trigger): void;
|
|
1684
|
+
removeGroup(name: string): void;
|
|
1685
|
+
removeAll(): void;
|
|
1686
|
+
/**
|
|
1687
|
+
* 当节点[node]销毁时,移除触发器组[destroyGroup]
|
|
1688
|
+
* @param node
|
|
1689
|
+
* @param destroyGroup
|
|
1690
|
+
*/
|
|
1691
|
+
removeOnNodeDestroyed(node: Node, destroyGroup: string): void;
|
|
1692
|
+
register(trigger: Trigger): void;
|
|
1693
|
+
getById(group: string, ident: any): Trigger;
|
|
1694
|
+
}
|
|
1695
|
+
declare const triggermgr: TriggerManager;
|
|
1696
|
+
|
|
1697
|
+
/**
|
|
1698
|
+
* 触发器-定时器
|
|
1699
|
+
*/
|
|
1700
|
+
declare class TimerEvent extends TriggerEvent {
|
|
1701
|
+
protected _updateAtStart: boolean;
|
|
1702
|
+
protected _count: number;
|
|
1703
|
+
protected _countLimit: number;
|
|
1704
|
+
protected _internal: number;
|
|
1705
|
+
protected _handler: Function;
|
|
1706
|
+
/**
|
|
1707
|
+
*
|
|
1708
|
+
* @param _internal 默认为帧频
|
|
1709
|
+
*/
|
|
1710
|
+
constructor(_internal?: number);
|
|
1711
|
+
dispose(): void;
|
|
1712
|
+
/**
|
|
1713
|
+
* 设置次数
|
|
1714
|
+
* @param val
|
|
1715
|
+
*/
|
|
1716
|
+
setCount(val: number): TimerEvent;
|
|
1717
|
+
/**
|
|
1718
|
+
* 开始的时候是否执行一次update
|
|
1719
|
+
* @param updateAtStart
|
|
1720
|
+
*/
|
|
1721
|
+
setUpdateAtStart(updateAtStart?: boolean): TimerEvent;
|
|
1722
|
+
enable(): this;
|
|
1723
|
+
disable(): void;
|
|
1724
|
+
protected onTimerLoop(): void;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* 点击目标区域后触发事件
|
|
1729
|
+
*/
|
|
1730
|
+
declare class ClickEvent extends TriggerEvent {
|
|
1731
|
+
get target(): Node;
|
|
1732
|
+
static create(target: Node, rangeOut?: boolean): ClickEvent;
|
|
1733
|
+
get position(): Vec2;
|
|
1734
|
+
private _target;
|
|
1735
|
+
protected _openTime: number;
|
|
1736
|
+
protected _rangeOut: boolean;
|
|
1737
|
+
private _position;
|
|
1738
|
+
private _isButton;
|
|
1739
|
+
/**
|
|
1740
|
+
*
|
|
1741
|
+
* @param target
|
|
1742
|
+
* @param rangeOut 点击除去目标的区域时触发
|
|
1743
|
+
*/
|
|
1744
|
+
constructor(target: Node, rangeOut?: boolean);
|
|
1745
|
+
enable(): void;
|
|
1746
|
+
disable(): void;
|
|
1747
|
+
dispose(): void;
|
|
1748
|
+
onTarget(): void;
|
|
1749
|
+
offTarget(): void;
|
|
1750
|
+
onCanvas(): void;
|
|
1751
|
+
offCanvas(): void;
|
|
1752
|
+
protected onTargetDestroyedHandler(): void;
|
|
1753
|
+
protected _parentChanged(): void;
|
|
1754
|
+
protected onCanvasTouchEndHandler(evt: EventTouch): void;
|
|
1755
|
+
protected onCanvasMouseDownHandler(evt: EventMouse): void;
|
|
1756
|
+
protected hitTest(loc: Vec2): void;
|
|
1757
|
+
protected onMouseDownHandler(e: EventMouse): void;
|
|
1758
|
+
protected onMouseUpHandler(e: EventMouse): void;
|
|
1759
|
+
protected onTouchStartHandler(e: EventTouch): void;
|
|
1760
|
+
protected onTouchEndHandler(e: EventTouch): void;
|
|
1761
|
+
protected setLastEventMouse(e: EventMouse): void;
|
|
1762
|
+
get lastEventMouse(): EventMouse;
|
|
1763
|
+
protected _lastEventMouse: EventMouse;
|
|
1764
|
+
protected setLastEventTouch(e: EventTouch): void;
|
|
1765
|
+
get lastEventTouch(): EventTouch;
|
|
1766
|
+
protected _lastEventTouch: EventTouch;
|
|
1767
|
+
get lastLocation(): Vec2;
|
|
1768
|
+
protected _lastLocation: Vec2;
|
|
1769
|
+
protected _downTarget: any;
|
|
1770
|
+
get lastTarget(): Node;
|
|
1771
|
+
protected _lastTarget: Node;
|
|
1772
|
+
get canvas(): Node;
|
|
1773
|
+
private _canvas;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* 事件触发器
|
|
1778
|
+
* 注意: 列表项中监听全局的事件容易导致所有项都进行了监听.
|
|
1779
|
+
*/
|
|
1780
|
+
|
|
1781
|
+
/**
|
|
1782
|
+
* 触发器-事件派发器
|
|
1783
|
+
*/
|
|
1784
|
+
declare class NodeEvent extends TriggerEvent {
|
|
1785
|
+
dispatcher: Node;
|
|
1786
|
+
event: string;
|
|
1787
|
+
static create(dispatcher: Node, event: string): NodeEvent;
|
|
1788
|
+
args: any[];
|
|
1789
|
+
constructor(dispatcher: Node, event: string);
|
|
1790
|
+
enable(): void;
|
|
1791
|
+
protected onHandler(...args: any): void;
|
|
1792
|
+
disable(): void;
|
|
1793
|
+
dispose(): void;
|
|
1794
|
+
protected onTargetDestroyedHandler(): void;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* 触发器-缓存中的数据属性
|
|
1799
|
+
*/
|
|
1800
|
+
declare class CacheObjectEvent extends TriggerEvent {
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* 触发器-缓存中的数据痛
|
|
1805
|
+
*/
|
|
1806
|
+
declare class ResponseEvent extends TriggerEvent {
|
|
1807
|
+
static create(msgName: string, sub?: ResponseSub): ResponseEvent;
|
|
1808
|
+
sub: ResponseSub;
|
|
1809
|
+
msgName: string;
|
|
1810
|
+
constructor(msgName: string, sub?: ResponseSub);
|
|
1811
|
+
protected get listener(): IEventManager;
|
|
1812
|
+
enable(): void;
|
|
1813
|
+
disable(): void;
|
|
1814
|
+
dispose(): void;
|
|
1815
|
+
protected onHandler(event: XEvent): void;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
/**
|
|
1819
|
+
* 触发器-等待直到符合条件
|
|
1820
|
+
*/
|
|
1821
|
+
declare class WaitEvent extends TriggerEvent {
|
|
1822
|
+
protected _updateAtStart: boolean;
|
|
1823
|
+
protected _count: number;
|
|
1824
|
+
protected _countLimit: number;
|
|
1825
|
+
protected _internal: number;
|
|
1826
|
+
protected _handler: Function;
|
|
1827
|
+
constructor(util: () => boolean, frequency?: number);
|
|
1828
|
+
dispose(): void;
|
|
1829
|
+
enable(): this;
|
|
1830
|
+
disable(): void;
|
|
1831
|
+
protected onTimerLoop(): void;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
declare class TreeIterator {
|
|
1835
|
+
break(): void;
|
|
1836
|
+
isBreak(): boolean;
|
|
1837
|
+
protected _isBreak: any;
|
|
1838
|
+
}
|
|
1839
|
+
interface ITreeListItem {
|
|
1840
|
+
/**
|
|
1841
|
+
* 路径
|
|
1842
|
+
*/
|
|
1843
|
+
path: string;
|
|
1844
|
+
/**
|
|
1845
|
+
* 自定义数据
|
|
1846
|
+
*/
|
|
1847
|
+
data?: any;
|
|
1848
|
+
/**
|
|
1849
|
+
* 功能性标签,用于开发组件时,记录组件的状态。例如title, icon, 显示树的组件,需要 expanded,selected标签
|
|
1850
|
+
*/
|
|
1851
|
+
tags?: {
|
|
1852
|
+
[key: string]: any;
|
|
1853
|
+
};
|
|
1854
|
+
/**
|
|
1855
|
+
* 是否树叶
|
|
1856
|
+
*/
|
|
1857
|
+
isLeaf: boolean;
|
|
1858
|
+
}
|
|
1859
|
+
declare class TreeNode<T = any> {
|
|
1860
|
+
get root(): TreeRoot;
|
|
1861
|
+
/**
|
|
1862
|
+
* 根节点
|
|
1863
|
+
*/
|
|
1864
|
+
protected _root: TreeRoot;
|
|
1865
|
+
/**
|
|
1866
|
+
* 编号
|
|
1867
|
+
*/
|
|
1868
|
+
uuid: string;
|
|
1869
|
+
/**
|
|
1870
|
+
* 编号
|
|
1871
|
+
*/
|
|
1872
|
+
id: string;
|
|
1873
|
+
/**
|
|
1874
|
+
* 自定义数据
|
|
1875
|
+
*/
|
|
1876
|
+
data: T;
|
|
1877
|
+
/**
|
|
1878
|
+
* 是否树叶
|
|
1879
|
+
*/
|
|
1880
|
+
isLeaf: boolean;
|
|
1881
|
+
/**
|
|
1882
|
+
* 功能性标签,用于开发组件时,记录组件的状态。例如title, icon, 显示树的组件,需要 expanded,selected标签
|
|
1883
|
+
*/
|
|
1884
|
+
tags: {
|
|
1885
|
+
[key: string]: any;
|
|
1886
|
+
};
|
|
1887
|
+
/**
|
|
1888
|
+
* 深度
|
|
1889
|
+
*/
|
|
1890
|
+
get depth(): number;
|
|
1891
|
+
private _depth;
|
|
1892
|
+
/**
|
|
1893
|
+
* 父节点
|
|
1894
|
+
*/
|
|
1895
|
+
parent: TreeNode;
|
|
1896
|
+
/**
|
|
1897
|
+
* 子节点
|
|
1898
|
+
*/
|
|
1899
|
+
children: TreeNode[];
|
|
1900
|
+
/**
|
|
1901
|
+
* 设置根
|
|
1902
|
+
* @param val
|
|
1903
|
+
*/
|
|
1904
|
+
setRoot(val: TreeRoot): void;
|
|
1905
|
+
getTags(): {
|
|
1906
|
+
[key: string]: any;
|
|
1907
|
+
};
|
|
1908
|
+
getTag(name: string): any;
|
|
1909
|
+
removeTag(name: string): void;
|
|
1910
|
+
setTag(name: string, value: any): void;
|
|
1911
|
+
constructor(id: string, isLeaf?: boolean);
|
|
1912
|
+
addChild(val: TreeNode): void;
|
|
1913
|
+
getChildIndex(val: TreeNode): number;
|
|
1914
|
+
insertChild(val: TreeNode, index: number): void;
|
|
1915
|
+
removeChild(val: TreeNode): void;
|
|
1916
|
+
removeChildren(): void;
|
|
1917
|
+
get name(): string;
|
|
1918
|
+
setDepth(val: number): void;
|
|
1919
|
+
containsById(id: string): boolean;
|
|
1920
|
+
/**
|
|
1921
|
+
* 通过编号获取子节点
|
|
1922
|
+
* @param id
|
|
1923
|
+
*/
|
|
1924
|
+
getChildById(id: string): TreeNode;
|
|
1925
|
+
/**
|
|
1926
|
+
* 返回相邻的上一个节点
|
|
1927
|
+
*/
|
|
1928
|
+
prevNode(): TreeNode;
|
|
1929
|
+
/**
|
|
1930
|
+
* 返回相邻的下一个节点
|
|
1931
|
+
*/
|
|
1932
|
+
nextNode(): TreeNode;
|
|
1933
|
+
/**
|
|
1934
|
+
* 如果返回true则删除节点,包含当前节点
|
|
1935
|
+
* @param f
|
|
1936
|
+
*/
|
|
1937
|
+
walkRemove(f: (node: TreeNode) => boolean): void;
|
|
1938
|
+
private _walkRemove;
|
|
1939
|
+
/**
|
|
1940
|
+
* 如果返回true则继续,包含当前节点
|
|
1941
|
+
* @param f
|
|
1942
|
+
* @param inChild
|
|
1943
|
+
*/
|
|
1944
|
+
walk(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): void;
|
|
1945
|
+
private _walk;
|
|
1946
|
+
/**
|
|
1947
|
+
* 从当前节点(包括)遍历父节点链,包含当前节点
|
|
1948
|
+
* @param f
|
|
1949
|
+
*/
|
|
1950
|
+
walkParent(f: (node: TreeNode) => boolean): boolean;
|
|
1951
|
+
/**
|
|
1952
|
+
* 从当前节点往前遍历(深度),包含当前节点
|
|
1953
|
+
* @param f
|
|
1954
|
+
* @param inChild
|
|
1955
|
+
*/
|
|
1956
|
+
walkPrev(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): any;
|
|
1957
|
+
private _walkPrev;
|
|
1958
|
+
dump(): void;
|
|
1959
|
+
/**
|
|
1960
|
+
* 遍历节点,查找指定编号的节点
|
|
1961
|
+
*/
|
|
1962
|
+
findById(id: string): TreeNode;
|
|
1963
|
+
/**
|
|
1964
|
+
* 如果返回true则继续
|
|
1965
|
+
* @param f
|
|
1966
|
+
*/
|
|
1967
|
+
findOne(f: (node: TreeNode) => boolean): TreeNode;
|
|
1968
|
+
private _findOne;
|
|
1969
|
+
/**
|
|
1970
|
+
* 通过路径获取节点
|
|
1971
|
+
* 格式为 /path1/path2/...
|
|
1972
|
+
* 如果 path == "/",则返回自身
|
|
1973
|
+
* @param path
|
|
1974
|
+
*/
|
|
1975
|
+
getNodeByPath(path: string): TreeNode;
|
|
1976
|
+
protected getNodeByPathArr(pathArr: string[]): TreeNode;
|
|
1977
|
+
getName(): string;
|
|
1978
|
+
getPath(): string;
|
|
1979
|
+
/**
|
|
1980
|
+
* 如果返回true则继续
|
|
1981
|
+
* @param f
|
|
1982
|
+
*/
|
|
1983
|
+
find(f: (node: TreeNode) => boolean): TreeNode[];
|
|
1984
|
+
private _find;
|
|
1985
|
+
toRoot(): TreeRoot;
|
|
1986
|
+
clone(): TreeNode;
|
|
1987
|
+
protected cloneChildrenTo(node: TreeNode): void;
|
|
1988
|
+
fixDepthAndRoot(depth: number, root: TreeRoot): void;
|
|
1989
|
+
toString(): string;
|
|
1990
|
+
}
|
|
1991
|
+
declare class TreeRoot<NODE = any> extends EventManager {
|
|
1992
|
+
/**
|
|
1993
|
+
* 添加数据节点
|
|
1994
|
+
* dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
|
|
1995
|
+
*/
|
|
1996
|
+
static EVENT_ADD: string;
|
|
1997
|
+
/**
|
|
1998
|
+
* 移除数据节点
|
|
1999
|
+
* dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
|
|
2000
|
+
*/
|
|
2001
|
+
static EVENT_REMOVE: string;
|
|
2002
|
+
/**
|
|
2003
|
+
* 插入数据节点
|
|
2004
|
+
* dispatchParams = {node:TreeNode, before:TreeNode}
|
|
2005
|
+
*/
|
|
2006
|
+
static EVENT_INSERT: string;
|
|
2007
|
+
/**
|
|
2008
|
+
* 刷新数据节点
|
|
2009
|
+
* dispatchParams = {node:TreeNode}
|
|
2010
|
+
*/
|
|
2011
|
+
static EVENT_REFRESH: string;
|
|
2012
|
+
/**
|
|
2013
|
+
* 设置数据时触发
|
|
2014
|
+
* dispatchParams = {node:TreeNode}
|
|
2015
|
+
*/
|
|
2016
|
+
static EVENT_DATA_SET: string;
|
|
2017
|
+
/**
|
|
2018
|
+
* 设置数据时触发
|
|
2019
|
+
* dispatchParams = {node:TreeNode, tag:string, value:any}
|
|
2020
|
+
*/
|
|
2021
|
+
static EVENT_TAGS_SET: string;
|
|
2022
|
+
static create(): TreeRoot<any>;
|
|
2023
|
+
/**
|
|
2024
|
+
* 通过列表生成一个树结构
|
|
2025
|
+
* @param items
|
|
2026
|
+
* @param existed 列表将添加的已经存在的树结构
|
|
2027
|
+
*/
|
|
2028
|
+
static createByList(items: ITreeListItem[], existed?: TreeRoot): TreeRoot;
|
|
2029
|
+
static sortChildrenByName(node: TreeNode, des?: boolean): void;
|
|
2030
|
+
constructor();
|
|
2031
|
+
setNodeData(node: TreeNode, data: any): void;
|
|
2032
|
+
setNodeTags(node: TreeNode, tag: string, value: any, force?: boolean): void;
|
|
2033
|
+
getNodeByPath(path: string): TreeNode;
|
|
2034
|
+
makeNodeByPath(path: string): TreeNode;
|
|
2035
|
+
/**
|
|
2036
|
+
* 添加节点,按照 node.path 添加到正确的位置
|
|
2037
|
+
* @param node
|
|
2038
|
+
* @param parentPath 如果父节点路径为 "", 则添加到起源节点
|
|
2039
|
+
* @param autoCreateParent 如果父节点不存在,自动创建
|
|
2040
|
+
*/
|
|
2041
|
+
addNode(node: TreeNode, parentPath?: string, autoCreateParent?: boolean): void;
|
|
2042
|
+
removeNode(node: TreeNode): void;
|
|
2043
|
+
removeChildren(node: TreeNode): void;
|
|
2044
|
+
insertNode(node: TreeNode, before: TreeNode, resetId?: boolean): void;
|
|
2045
|
+
walk(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): void;
|
|
2046
|
+
walkPrev(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): void;
|
|
2047
|
+
/**
|
|
2048
|
+
* 派发 refresh 消息
|
|
2049
|
+
* @param node
|
|
2050
|
+
*/
|
|
2051
|
+
refresh(node: TreeNode): void;
|
|
2052
|
+
/**
|
|
2053
|
+
* 克隆当前的树结
|
|
2054
|
+
* * 新的tags克隆旧的data
|
|
2055
|
+
* * 新的data指向旧的data
|
|
2056
|
+
*/
|
|
2057
|
+
clone(): TreeRoot;
|
|
2058
|
+
toString(): string;
|
|
2059
|
+
createNode(id: string, isLeaf?: boolean): TreeNode;
|
|
2060
|
+
/**
|
|
2061
|
+
* origin的第一个child
|
|
2062
|
+
*/
|
|
2063
|
+
get firstNode(): TreeNode;
|
|
2064
|
+
origin: TreeNode;
|
|
2065
|
+
}
|
|
2066
|
+
declare class TreeRootPlugin {
|
|
2067
|
+
root: TreeRoot;
|
|
2068
|
+
}
|
|
2069
|
+
declare class TreeNodePlugin {
|
|
2070
|
+
node: TreeNode;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
interface IListItem {
|
|
2074
|
+
/**
|
|
2075
|
+
* 编号
|
|
2076
|
+
*/
|
|
2077
|
+
id: string;
|
|
2078
|
+
/**
|
|
2079
|
+
* 自定义数据
|
|
2080
|
+
*/
|
|
2081
|
+
data?: any;
|
|
2082
|
+
/**
|
|
2083
|
+
* 功能性标签,用于开发组件时,记录组件的状态。例如title, icon, 显示树的组件,需要 expanded,selected标签
|
|
2084
|
+
*/
|
|
2085
|
+
tags?: {
|
|
2086
|
+
[key: string]: any;
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
declare class ListNode {
|
|
2090
|
+
static create(id: string, data?: any): ListNode;
|
|
2091
|
+
constructor();
|
|
2092
|
+
root: ListSource;
|
|
2093
|
+
uuid: string;
|
|
2094
|
+
id: string;
|
|
2095
|
+
data: any;
|
|
2096
|
+
tags: {};
|
|
2097
|
+
getTags(): {
|
|
2098
|
+
[key: string]: any;
|
|
2099
|
+
};
|
|
2100
|
+
setTags(tags: {
|
|
2101
|
+
[key: string]: any;
|
|
2102
|
+
}): void;
|
|
2103
|
+
getTag(name: string): any;
|
|
2104
|
+
setTag(name: string, value: any): void;
|
|
2105
|
+
}
|
|
2106
|
+
declare class ListSource extends EventManager {
|
|
2107
|
+
/**
|
|
2108
|
+
* 通过数组创建 ListSource。ListSource的id自动生成。如果需要指定编号,可设置 idCreator
|
|
2109
|
+
* @param arr
|
|
2110
|
+
* @param idCreator
|
|
2111
|
+
*/
|
|
2112
|
+
static createByArray(arr: any[], idCreator?: (item: any) => string): ListSource;
|
|
2113
|
+
static createByListItem(arr: IListItem[], target?: ListSource): any;
|
|
2114
|
+
/**
|
|
2115
|
+
* 设置数据时触发
|
|
2116
|
+
* dispatchParams = {node:ListNode}
|
|
2117
|
+
*/
|
|
2118
|
+
static EVENT_ADD: string;
|
|
2119
|
+
/**
|
|
2120
|
+
* 设置数据时触发
|
|
2121
|
+
* dispatchParams = {node:ListNode, index:number}
|
|
2122
|
+
*/
|
|
2123
|
+
static EVENT_REMOVE: string;
|
|
2124
|
+
/**
|
|
2125
|
+
* 设置数据时触发
|
|
2126
|
+
*/
|
|
2127
|
+
static EVENT_REMOVE_ALL: string;
|
|
2128
|
+
/**
|
|
2129
|
+
* 刷新数据节点
|
|
2130
|
+
* dispatchParams = {node:ListNode}
|
|
2131
|
+
*/
|
|
2132
|
+
static EVENT_REFRESH: string;
|
|
2133
|
+
/**
|
|
2134
|
+
* 设置数据时触发
|
|
2135
|
+
* dispatchParams = nodes: [ListNode], indexs: [number]
|
|
2136
|
+
*/
|
|
2137
|
+
static EVENT_SWAP: string;
|
|
2138
|
+
/**
|
|
2139
|
+
* 设置数据时触发
|
|
2140
|
+
* dispatchParams = {node:ListNode, data:any}
|
|
2141
|
+
*/
|
|
2142
|
+
static EVENT_DATA_SET: string;
|
|
2143
|
+
/**
|
|
2144
|
+
* 设置数据时触发
|
|
2145
|
+
* dispatchParams = {node:ListNode, tag:string, value:any}
|
|
2146
|
+
*/
|
|
2147
|
+
static EVENT_TAGS_SET: string;
|
|
2148
|
+
protected _identFunc: (node: ListNode) => boolean;
|
|
2149
|
+
at(index: number): ListNode;
|
|
2150
|
+
first(): ListNode;
|
|
2151
|
+
last(): ListNode;
|
|
2152
|
+
length(): number;
|
|
2153
|
+
/**
|
|
2154
|
+
* 添加项,无法添加相同的项
|
|
2155
|
+
* @param node
|
|
2156
|
+
* @param enableDispatch 默认为true
|
|
2157
|
+
*/
|
|
2158
|
+
add(node: ListNode, enableDispatch?: boolean): void;
|
|
2159
|
+
getById(id: string): ListNode;
|
|
2160
|
+
remove(node: ListNode): void;
|
|
2161
|
+
removeAll(): void;
|
|
2162
|
+
swap(a: ListNode, b: ListNode): void;
|
|
2163
|
+
contains(node: ListNode): boolean;
|
|
2164
|
+
containsById(id: string): boolean;
|
|
2165
|
+
indexOf(node: ListNode): number;
|
|
2166
|
+
indexOfById(id: string): number;
|
|
2167
|
+
setData(node: ListNode, data: any): void;
|
|
2168
|
+
setNodeTags(node: ListNode, tag: string, value: any): void;
|
|
2169
|
+
/**
|
|
2170
|
+
* 派发 refresh 消息
|
|
2171
|
+
* @param node
|
|
2172
|
+
*/
|
|
2173
|
+
refresh(node: ListNode): void;
|
|
2174
|
+
walk(f: (node: ListNode) => boolean): boolean;
|
|
2175
|
+
walkPrev(node: ListNode, f: (node: ListNode) => boolean): boolean;
|
|
2176
|
+
get data(): any[];
|
|
2177
|
+
private _data;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
declare class DictNode {
|
|
2181
|
+
static create(id: string, data?: any): DictNode;
|
|
2182
|
+
constructor();
|
|
2183
|
+
uuid: string;
|
|
2184
|
+
id: string;
|
|
2185
|
+
data: any;
|
|
2186
|
+
tags: {};
|
|
2187
|
+
getTags(): {
|
|
2188
|
+
[key: string]: any;
|
|
2189
|
+
};
|
|
2190
|
+
getTag(name: string): any;
|
|
2191
|
+
setTag(name: string, value: any): void;
|
|
2192
|
+
/**
|
|
2193
|
+
* 清理【data】和【tags】
|
|
2194
|
+
*/
|
|
2195
|
+
clean(): void;
|
|
2196
|
+
}
|
|
2197
|
+
declare class DictSource extends Dictionary<string, DictNode> {
|
|
2198
|
+
/**
|
|
2199
|
+
* 刷新数据节点
|
|
2200
|
+
* dispatchParams = {node:ListNode}
|
|
2201
|
+
*/
|
|
2202
|
+
static EVENT_REFRESH: string;
|
|
2203
|
+
/**
|
|
2204
|
+
* 设置数据时触发
|
|
2205
|
+
* dispatchParams = {node:ListNode, tag:string, value:any}
|
|
2206
|
+
*/
|
|
2207
|
+
static EVENT_TAGS_SET: string;
|
|
2208
|
+
setNodeTags(node: DictNode, tag: string, value: any): void;
|
|
2209
|
+
refreshNode(node: DictNode): void;
|
|
2210
|
+
get dispatcher(): EventManager;
|
|
2211
|
+
protected _dispatcher: EventManager;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
interface IDecl {
|
|
2215
|
+
Name: string;
|
|
2216
|
+
Namespace: string;
|
|
2217
|
+
Tags: any;
|
|
2218
|
+
Alias: string;
|
|
2219
|
+
}
|
|
2220
|
+
declare class EnumDecl implements IDecl {
|
|
2221
|
+
Name: string;
|
|
2222
|
+
Kind: Kind;
|
|
2223
|
+
Value: string;
|
|
2224
|
+
Fields: Field[];
|
|
2225
|
+
constructor(Name?: string, Kind?: Kind, Value?: string, Fields?: Field[]);
|
|
2226
|
+
firstValue(): number;
|
|
2227
|
+
NameToValue(name: string): any;
|
|
2228
|
+
ValueToName(value: any): string;
|
|
2229
|
+
GetAllField(): Field[];
|
|
2230
|
+
Alias: string;
|
|
2231
|
+
Namespace: string;
|
|
2232
|
+
Tags: any;
|
|
2233
|
+
Comments: string[];
|
|
2234
|
+
}
|
|
2235
|
+
declare class ClassDecl implements IDecl {
|
|
2236
|
+
Name: string;
|
|
2237
|
+
Parent: string;
|
|
2238
|
+
Fields: Field[];
|
|
2239
|
+
constructor(Name?: string, Parent?: string, Fields?: Field[], tags?: any);
|
|
2240
|
+
getIdent(): string;
|
|
2241
|
+
get Alias(): string;
|
|
2242
|
+
getParent(): ClassDecl;
|
|
2243
|
+
getField(name: string): Field;
|
|
2244
|
+
walkField(handler: (field: Field) => void): void;
|
|
2245
|
+
protected _lastObject: any;
|
|
2246
|
+
/**
|
|
2247
|
+
* @param f
|
|
2248
|
+
* @param sourceObject
|
|
2249
|
+
*/
|
|
2250
|
+
walkFieldType(f: (field: Field, type: IType, obj?: {} | undefined, value?: any) => void, sourceObject?: any): void;
|
|
2251
|
+
protected _walkFieldType(f: (field: Field, type: IType, obj?: {} | undefined, value?: any) => void, sourceObject: any): void;
|
|
2252
|
+
Namespace: string;
|
|
2253
|
+
Tags: any;
|
|
2254
|
+
Comments: string[];
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
declare class Field {
|
|
2258
|
+
Name: string;
|
|
2259
|
+
Type: IType;
|
|
2260
|
+
Value: string;
|
|
2261
|
+
Tags: any;
|
|
2262
|
+
/**
|
|
2263
|
+
* 如果Type=ClassType, 可通过设置{}建立新对象, 否则默认为nil
|
|
2264
|
+
* 如果Type=MapType, 可通过设置{}建立新对象, 否则默认为nil
|
|
2265
|
+
* 如果Type=BasicType/EnumType, Value为初始值
|
|
2266
|
+
* Value: string = "";
|
|
2267
|
+
* @param Name
|
|
2268
|
+
* @param Type
|
|
2269
|
+
* @param Value
|
|
2270
|
+
* @param Tags
|
|
2271
|
+
*/
|
|
2272
|
+
constructor(Name?: string, Type?: IType, Value?: string, Tags?: any);
|
|
2273
|
+
getTag(name: string): string;
|
|
2274
|
+
convertToJsonValue(dataValue: any): any;
|
|
2275
|
+
/**
|
|
2276
|
+
* 默认值
|
|
2277
|
+
* 获取转化后的Field.Value
|
|
2278
|
+
*/
|
|
2279
|
+
getValue(): any;
|
|
2280
|
+
/**
|
|
2281
|
+
*
|
|
2282
|
+
*/
|
|
2283
|
+
getValueBasicKind(): Kind;
|
|
2284
|
+
Comments: string[];
|
|
2285
|
+
decl: IDecl;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
interface IType {
|
|
2289
|
+
name: TypeName;
|
|
2290
|
+
}
|
|
2291
|
+
declare enum TypeName {
|
|
2292
|
+
/**
|
|
2293
|
+
* {_type:TypeName.Class, Decl:"类型声明的编号"}
|
|
2294
|
+
*/
|
|
2295
|
+
Class = "class",
|
|
2296
|
+
Func = "func",
|
|
2297
|
+
/**
|
|
2298
|
+
* {_type: TypeName.Map, Key: {_type:TypeName.Basic,Kind: Kind.String}, Value:{_type:TypeName.Basic,Kind: Kind.String}}
|
|
2299
|
+
*/
|
|
2300
|
+
Map = "map",
|
|
2301
|
+
/**
|
|
2302
|
+
* {_type:TypeName.Enum, Decl:"枚举声明的编号"}
|
|
2303
|
+
*/
|
|
2304
|
+
Enum = "enum",
|
|
2305
|
+
/**
|
|
2306
|
+
* {_type: TypeName.Array, Elem: {_type:TypeName.Basic,Kind: Kind.String}}
|
|
2307
|
+
*/
|
|
2308
|
+
Array = "array",
|
|
2309
|
+
/**
|
|
2310
|
+
* {_type:TypeName.Basic,Kind: Kind.String}
|
|
2311
|
+
*/
|
|
2312
|
+
Basic = "basic",
|
|
2313
|
+
Any = "any"
|
|
2314
|
+
}
|
|
2315
|
+
declare class MapType {
|
|
2316
|
+
Key: IType;
|
|
2317
|
+
Value: IType;
|
|
2318
|
+
name: TypeName;
|
|
2319
|
+
constructor(Key?: IType, Value?: IType);
|
|
2320
|
+
}
|
|
2321
|
+
declare class ClassType {
|
|
2322
|
+
Decl: string;
|
|
2323
|
+
name: TypeName;
|
|
2324
|
+
constructor(Decl?: string);
|
|
2325
|
+
}
|
|
2326
|
+
declare class EnumType {
|
|
2327
|
+
Decl: string;
|
|
2328
|
+
name: TypeName;
|
|
2329
|
+
constructor(Decl?: string);
|
|
2330
|
+
}
|
|
2331
|
+
declare class ArrayType {
|
|
2332
|
+
Elem: IType;
|
|
2333
|
+
name: TypeName;
|
|
2334
|
+
constructor(Elem?: IType);
|
|
2335
|
+
}
|
|
2336
|
+
declare class BasicType {
|
|
2337
|
+
Kind: Kind;
|
|
2338
|
+
name: TypeName;
|
|
2339
|
+
constructor(Kind?: Kind);
|
|
2340
|
+
}
|
|
2341
|
+
declare class AnyType {
|
|
2342
|
+
name: TypeName;
|
|
2343
|
+
constructor();
|
|
2344
|
+
}
|
|
2345
|
+
declare enum Kind {
|
|
2346
|
+
Invalid = 0,
|
|
2347
|
+
Bool = 1,
|
|
2348
|
+
Int8 = 2,
|
|
2349
|
+
Int16 = 3,
|
|
2350
|
+
Int32 = 4,
|
|
2351
|
+
Int64 = 5,
|
|
2352
|
+
Uint8 = 6,
|
|
2353
|
+
Uint16 = 7,
|
|
2354
|
+
Uint32 = 8,
|
|
2355
|
+
Uint64 = 9,
|
|
2356
|
+
Float32 = 10,
|
|
2357
|
+
Float64 = 11,
|
|
2358
|
+
String = 12,
|
|
2359
|
+
Bytes = 13
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
declare function setClassCreator(key: string, creator: (data: any) => ICacheObject): void;
|
|
2363
|
+
declare function getClassCreator(key: string): (data: any) => ICacheObject;
|
|
2364
|
+
declare function newCacheObject(data: any): ICacheObject;
|
|
2365
|
+
declare function newObjectByType(obj: CacheObject, objectType: IType, data: any): ICacheObject;
|
|
2366
|
+
declare enum CacheModifyMode {
|
|
2367
|
+
修正结构 = 0,
|
|
2368
|
+
修正字典 = 1
|
|
2369
|
+
}
|
|
2370
|
+
declare class ModifyField {
|
|
2371
|
+
modify: IModify;
|
|
2372
|
+
modifyFieldOrItemType: number;
|
|
2373
|
+
modifyFieldOrItemSchema: IType;
|
|
2374
|
+
}
|
|
2375
|
+
declare class CacheObject extends EventManager implements ICacheObject {
|
|
2376
|
+
static EVENT_CHANGED: string;
|
|
2377
|
+
private data;
|
|
2378
|
+
schema: IType;
|
|
2379
|
+
schemaDecl: ClassDecl;
|
|
2380
|
+
schemaField: Field;
|
|
2381
|
+
classId: string;
|
|
2382
|
+
protected className: string;
|
|
2383
|
+
private versions;
|
|
2384
|
+
protected modifyUsed: boolean;
|
|
2385
|
+
protected modifyMode: CacheModifyMode;
|
|
2386
|
+
protected modifyFieldDict: {
|
|
2387
|
+
[key: string]: ModifyField;
|
|
2388
|
+
};
|
|
2389
|
+
protected modifyMapOrArray: IModify;
|
|
2390
|
+
protected modifyFieldOrItemType: number;
|
|
2391
|
+
protected modifyFieldOrItemschema: IType;
|
|
2392
|
+
protected modifyContext: any;
|
|
2393
|
+
protected modifyItem0: any;
|
|
2394
|
+
refSetClassId(val: string): void;
|
|
2395
|
+
refSetClassName(val: string): void;
|
|
2396
|
+
refClassId(): string;
|
|
2397
|
+
refClassType(): string;
|
|
2398
|
+
refClassName(): string;
|
|
2399
|
+
/**
|
|
2400
|
+
* 打开修正功能后,需要设置上下文,提供给修正函数
|
|
2401
|
+
* @param modifyContext
|
|
2402
|
+
*/
|
|
2403
|
+
refSetContext(modifyContext: any): void;
|
|
2404
|
+
/**
|
|
2405
|
+
* 如果元素为对象,会自动创建一个空的ICacheObject
|
|
2406
|
+
* @param modify
|
|
2407
|
+
*/
|
|
2408
|
+
refModifyMap(modify: IModify): void;
|
|
2409
|
+
/**
|
|
2410
|
+
* 如果字段为对象,会自动创建一个空的ICacheObject
|
|
2411
|
+
* @param modify
|
|
2412
|
+
* @param field
|
|
2413
|
+
*/
|
|
2414
|
+
refModifyClass(modify: IModify, field: string): void;
|
|
2415
|
+
refAnyType(): string;
|
|
2416
|
+
_refGet(field: string): any;
|
|
2417
|
+
refIsChanged(field: string, time: number): boolean;
|
|
2418
|
+
refGetChangedFields(time: number): string[];
|
|
2419
|
+
refGet(field: string): any;
|
|
2420
|
+
refHas(field: string): boolean;
|
|
2421
|
+
refGetUint(field: string): number;
|
|
2422
|
+
refGetInt(field: string): number;
|
|
2423
|
+
refGetBool(field: string): boolean;
|
|
2424
|
+
refGetFloat64(field: string): number;
|
|
2425
|
+
refFloat64(field: string): number;
|
|
2426
|
+
refGetString(field: string): string;
|
|
2427
|
+
refIsObject(field: string): boolean;
|
|
2428
|
+
refGetObject(field: string): ICacheObject;
|
|
2429
|
+
refNew(): this;
|
|
2430
|
+
refNewIfNil(): this;
|
|
2431
|
+
refIsNil(): boolean;
|
|
2432
|
+
refGetArray(field: string): ICacheObject;
|
|
2433
|
+
refReplace(data: {
|
|
2434
|
+
[key: string]: any;
|
|
2435
|
+
}): void;
|
|
2436
|
+
refUpdate(data: {
|
|
2437
|
+
[key: string]: any;
|
|
2438
|
+
}): void;
|
|
2439
|
+
refSet(field: string, val: any): void;
|
|
2440
|
+
_refSet(sdata: {
|
|
2441
|
+
[key: string]: any;
|
|
2442
|
+
}, field: string, fieldVal: any): error;
|
|
2443
|
+
protected createSchemaClass(classTyp: ClassType, fieldVal: any): ICacheObject;
|
|
2444
|
+
protected createClassObject(typ: any, data: any): any;
|
|
2445
|
+
protected createSchemaAny(fieldVal: any): any;
|
|
2446
|
+
refRemove(field: string): void;
|
|
2447
|
+
refSetNil(): this;
|
|
2448
|
+
refLength(): number;
|
|
2449
|
+
refFields(): string[];
|
|
2450
|
+
refNewByMap(data: {
|
|
2451
|
+
[key: string]: any;
|
|
2452
|
+
}): void;
|
|
2453
|
+
refLinkData(target: ICacheObject): void;
|
|
2454
|
+
refGetData(): {
|
|
2455
|
+
[key: string]: any;
|
|
2456
|
+
};
|
|
2457
|
+
toMap(): {
|
|
2458
|
+
[key: string]: any;
|
|
2459
|
+
};
|
|
2460
|
+
toList(): any[];
|
|
2461
|
+
toMapByField(fieldMap: {
|
|
2462
|
+
[key: string]: any;
|
|
2463
|
+
}): {
|
|
2464
|
+
[key: string]: any;
|
|
2465
|
+
};
|
|
2466
|
+
_toMapByField(fieldMap: {
|
|
2467
|
+
[key: string]: any;
|
|
2468
|
+
}, toMap: {
|
|
2469
|
+
[key: string]: any;
|
|
2470
|
+
}): void;
|
|
2471
|
+
refSetObject(field: string, val: ICacheObject): void;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
declare namespace cachex {
|
|
2475
|
+
function getObjectByPath(object: ICacheObject, path: string): ICacheObject;
|
|
2476
|
+
function getObjectFieldByPath(object: ICacheObject, path: string): [ICacheObject, string];
|
|
2477
|
+
function getFieldByPath(object: ICacheObject, path: string): any;
|
|
2478
|
+
function contains(obj: ICacheObject, value: any): boolean;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
interface IModify {
|
|
2482
|
+
/**
|
|
2483
|
+
* 修正是否生效
|
|
2484
|
+
* @param ctx
|
|
2485
|
+
* @param field
|
|
2486
|
+
*/
|
|
2487
|
+
valid(ctx: any, field: string): boolean;
|
|
2488
|
+
/**
|
|
2489
|
+
* 返回修正后的值
|
|
2490
|
+
* @param ctx
|
|
2491
|
+
* @param field
|
|
2492
|
+
* @param origin
|
|
2493
|
+
* @param item0 用于数组,配置文件中,数组的第一个元素,通常作为修正的基础模版
|
|
2494
|
+
*/
|
|
2495
|
+
value(ctx: any, field: string, origin: any, item0?: any): any;
|
|
2496
|
+
/**
|
|
2497
|
+
* 返回修正后的长度
|
|
2498
|
+
* 用于数组类型
|
|
2499
|
+
* @param ctx
|
|
2500
|
+
* @param origin
|
|
2501
|
+
*/
|
|
2502
|
+
length(ctx: any, origin: number): number;
|
|
2503
|
+
}
|
|
2504
|
+
interface ICacheObject {
|
|
2505
|
+
refSetClassId(classId: string): any;
|
|
2506
|
+
refSetClassName(className: string): any;
|
|
2507
|
+
refClassId(): string;
|
|
2508
|
+
refClassType(): string;
|
|
2509
|
+
refClassName(): string;
|
|
2510
|
+
refSetContext(modifyContext: any): any;
|
|
2511
|
+
refModifyMap(modify: IModify): any;
|
|
2512
|
+
refModifyClass(modify: IModify, field: string): any;
|
|
2513
|
+
/**
|
|
2514
|
+
* 当类型为any时,获取【_type】的值
|
|
2515
|
+
*/
|
|
2516
|
+
refAnyType(): any;
|
|
2517
|
+
refGet(field: string): any;
|
|
2518
|
+
refGetUint(field: string): number;
|
|
2519
|
+
refGetInt(field: string): number;
|
|
2520
|
+
refGetFloat64(field: string): number;
|
|
2521
|
+
refGetString(field: string): string;
|
|
2522
|
+
refGetBool(field: string): boolean;
|
|
2523
|
+
refGetObject(field: string): ICacheObject;
|
|
2524
|
+
refGetArray(field: string): ICacheObject;
|
|
2525
|
+
refSet(field: string, val: any): any;
|
|
2526
|
+
refSetObject(field: string, val: ICacheObject): void;
|
|
2527
|
+
refIsObject(field: string): boolean;
|
|
2528
|
+
refHas(field: string): boolean;
|
|
2529
|
+
refIsNil(): boolean;
|
|
2530
|
+
refSetNil(): this;
|
|
2531
|
+
refNewIfNil(): this;
|
|
2532
|
+
refNew(): this;
|
|
2533
|
+
/**
|
|
2534
|
+
* 获取所有字段的名字列表
|
|
2535
|
+
*/
|
|
2536
|
+
refFields(): string[];
|
|
2537
|
+
refGetData(): any;
|
|
2538
|
+
refLinkData(target: ICacheObject): void;
|
|
2539
|
+
toMap(): any;
|
|
2540
|
+
/**
|
|
2541
|
+
* 如果当前对象是数组, 把数据转化成数组
|
|
2542
|
+
*/
|
|
2543
|
+
toList(): any[];
|
|
2544
|
+
toMapByField(fieldMap: any): any;
|
|
2545
|
+
_toMapByField(fieldMap: {
|
|
2546
|
+
[key: string]: any;
|
|
2547
|
+
}, toMap: {
|
|
2548
|
+
[key: string]: any;
|
|
2549
|
+
}): any;
|
|
2550
|
+
refLength(): number;
|
|
2551
|
+
refNewByMap(data: {
|
|
2552
|
+
[key: string]: any;
|
|
2553
|
+
}): void;
|
|
2554
|
+
refUpdate(data: {
|
|
2555
|
+
[key: string]: any;
|
|
2556
|
+
}): void;
|
|
2557
|
+
refReplace(data: {
|
|
2558
|
+
[key: string]: any;
|
|
2559
|
+
}): void;
|
|
2560
|
+
refRemove(field: string): void;
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
interface IDatabase {
|
|
2564
|
+
}
|
|
2565
|
+
interface IDBObject {
|
|
2566
|
+
/**
|
|
2567
|
+
* 返回模型的数据库对象
|
|
2568
|
+
* @constructor
|
|
2569
|
+
*/
|
|
2570
|
+
DBObject(): ICacheObject;
|
|
2571
|
+
DBPath(): string;
|
|
2572
|
+
}
|
|
2573
|
+
interface IDBOnCreate {
|
|
2574
|
+
/**
|
|
2575
|
+
* 当创建完成后
|
|
2576
|
+
*/
|
|
2577
|
+
DBOnCreate(): any;
|
|
2578
|
+
}
|
|
2579
|
+
interface IDBOnUpdate {
|
|
2580
|
+
/**
|
|
2581
|
+
* 当创建完成后
|
|
2582
|
+
*/
|
|
2583
|
+
DBOnUpdate(): any;
|
|
2584
|
+
}
|
|
2585
|
+
interface IDBOnRemove {
|
|
2586
|
+
/**
|
|
2587
|
+
* 当创建完成后
|
|
2588
|
+
*/
|
|
2589
|
+
DBOnRemove(): any;
|
|
2590
|
+
}
|
|
2591
|
+
interface IDBTable {
|
|
2592
|
+
DBCreate(ident: any, data: any): IDBObject;
|
|
2593
|
+
DBGet(key: string): IDBObject;
|
|
2594
|
+
DBSet(key: string, val: IDBObject): any;
|
|
2595
|
+
DBDelete(key: string): any;
|
|
2596
|
+
}
|
|
2597
|
+
/**
|
|
2598
|
+
* event.OnParams的类型
|
|
2599
|
+
*/
|
|
2600
|
+
interface IDBEventDispatchParams {
|
|
2601
|
+
action: DBAction;
|
|
2602
|
+
object: IDBObject;
|
|
2603
|
+
table: IDBTable;
|
|
2604
|
+
/**
|
|
2605
|
+
* 输入的数据
|
|
2606
|
+
*/
|
|
2607
|
+
data: any;
|
|
2608
|
+
}
|
|
2609
|
+
declare enum DBAction {
|
|
2610
|
+
Create = 0,
|
|
2611
|
+
Update = 1,
|
|
2612
|
+
Remove = 2,
|
|
2613
|
+
/**
|
|
2614
|
+
* 主动触发刷新的时间
|
|
2615
|
+
*/
|
|
2616
|
+
Refresh = 3
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
/**
|
|
2620
|
+
* 触发器-缓存中的数据集合
|
|
2621
|
+
*/
|
|
2622
|
+
declare class DBEvent extends TriggerEvent {
|
|
2623
|
+
static create(objectId: string): DBEvent;
|
|
2624
|
+
constructor(objectId: string);
|
|
2625
|
+
enable(): void;
|
|
2626
|
+
disable(): void;
|
|
2627
|
+
dispose(): void;
|
|
2628
|
+
protected onHandler(event: XEvent): void;
|
|
2629
|
+
event: string;
|
|
2630
|
+
eventParams: IDBEventDispatchParams;
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
declare class ControllerSet {
|
|
2634
|
+
constructor(mod: IModule);
|
|
2635
|
+
has(name: string): boolean;
|
|
2636
|
+
add(controller: IController): void;
|
|
2637
|
+
createAndEnable(name: string, ...args: any[]): void;
|
|
2638
|
+
create(name: string, ...args: any[]): void;
|
|
2639
|
+
remove(name: string): void;
|
|
2640
|
+
disable(name: string): void;
|
|
2641
|
+
enable(name: string): void;
|
|
2642
|
+
enableAll(): void;
|
|
2643
|
+
disableAll(): void;
|
|
2644
|
+
dispose(): void;
|
|
2645
|
+
registerCreator(name: string, creator: (...args: any[]) => IController): void;
|
|
2646
|
+
protected _creator: {};
|
|
2647
|
+
protected _mod: IModule;
|
|
2648
|
+
private data;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* 一个简单的功能/库模块
|
|
2653
|
+
*/
|
|
2654
|
+
interface IModuleSample {
|
|
2655
|
+
}
|
|
2656
|
+
interface IModule {
|
|
2657
|
+
controllers: ControllerSet;
|
|
2658
|
+
}
|
|
2659
|
+
declare class Module extends EventManager implements IModule {
|
|
2660
|
+
constructor();
|
|
2661
|
+
get controllers(): ControllerSet;
|
|
2662
|
+
private _controllers;
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
interface IController {
|
|
2666
|
+
get name(): string;
|
|
2667
|
+
get module(): IModule;
|
|
2668
|
+
init(core: IModule): any;
|
|
2669
|
+
enable(): any;
|
|
2670
|
+
disable(): any;
|
|
2671
|
+
dispose(): any;
|
|
2672
|
+
}
|
|
2673
|
+
declare class Controller {
|
|
2674
|
+
constructor(name: string);
|
|
2675
|
+
init(core: IModule): void;
|
|
2676
|
+
enable(): void;
|
|
2677
|
+
disable(): void;
|
|
2678
|
+
dispose(): void;
|
|
2679
|
+
get name(): string;
|
|
2680
|
+
get module(): IModule;
|
|
2681
|
+
get isEnable(): boolean;
|
|
2682
|
+
protected _module: IModule;
|
|
2683
|
+
protected _name: string;
|
|
2684
|
+
protected _enabled: boolean;
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
interface IModel {
|
|
2688
|
+
get module(): IModule;
|
|
2689
|
+
}
|
|
2690
|
+
declare class SimpleModel {
|
|
2691
|
+
constructor(mod: IModule);
|
|
2692
|
+
get core(): IModule;
|
|
2693
|
+
protected _mod: any;
|
|
2694
|
+
}
|
|
2695
|
+
declare class Model extends EventManager {
|
|
2696
|
+
constructor(core?: IModule);
|
|
2697
|
+
get module(): IModule;
|
|
2698
|
+
protected _module: any;
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
interface IExtend {
|
|
2702
|
+
get module(): IModule;
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
declare class Factory {
|
|
2706
|
+
_controllers: {
|
|
2707
|
+
[key: string]: (mod: IModule) => IController;
|
|
2708
|
+
};
|
|
2709
|
+
_extends: {
|
|
2710
|
+
[key: string]: (mod: IModule, ...args: any) => IExtend;
|
|
2711
|
+
};
|
|
2712
|
+
registerController(name: string, creator: (mod: IModule, ...args: any) => IController): void;
|
|
2713
|
+
registerExtend(name: string, creator: (mod: IModule, ...args: any) => IExtend): void;
|
|
2714
|
+
createController(name: string, mod: IModule): IController;
|
|
2715
|
+
createExtend(name: string, mod: IModule, ...args: any[]): IExtend;
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
/**
|
|
2719
|
+
* 视图的路由值, 保存视图的信息
|
|
2720
|
+
* 规则: path/search
|
|
2721
|
+
* path = /a/b/c
|
|
2722
|
+
* search = ?key=val&key=val
|
|
2723
|
+
*/
|
|
2724
|
+
declare class Route {
|
|
2725
|
+
constructor(route: string);
|
|
2726
|
+
recycle(): void;
|
|
2727
|
+
/**
|
|
2728
|
+
* 获取调用链
|
|
2729
|
+
* 例如 a/b/c,返回 a/b/c -> a/b -> a
|
|
2730
|
+
*/
|
|
2731
|
+
getLink(): Route[];
|
|
2732
|
+
protected static data: any;
|
|
2733
|
+
static getData(route: string): Route;
|
|
2734
|
+
toLoaction(): Location;
|
|
2735
|
+
/**
|
|
2736
|
+
* @constructor
|
|
2737
|
+
*/
|
|
2738
|
+
NewRoute(): Route;
|
|
2739
|
+
/**
|
|
2740
|
+
* @constructor
|
|
2741
|
+
*/
|
|
2742
|
+
NewRoutePath(): Route;
|
|
2743
|
+
/**
|
|
2744
|
+
* 新建一个带参数的路由
|
|
2745
|
+
* @param params
|
|
2746
|
+
*/
|
|
2747
|
+
NewRouteParam(params: any): Route;
|
|
2748
|
+
toString(): string;
|
|
2749
|
+
get path(): string;
|
|
2750
|
+
get parentPath(): string;
|
|
2751
|
+
get params(): any;
|
|
2752
|
+
get search(): string;
|
|
2753
|
+
set search(value: string);
|
|
2754
|
+
get name(): string;
|
|
2755
|
+
/**
|
|
2756
|
+
* path/search
|
|
2757
|
+
*/
|
|
2758
|
+
get key(): string;
|
|
2759
|
+
private _path;
|
|
2760
|
+
private _parentPath;
|
|
2761
|
+
private _search;
|
|
2762
|
+
private _name;
|
|
2763
|
+
private _params;
|
|
2764
|
+
protected _route: string;
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
declare class UIObjectDict extends Dictionary<string, any | List> {
|
|
2768
|
+
/**
|
|
2769
|
+
* 获取唯一的
|
|
2770
|
+
* @param prefab
|
|
2771
|
+
*/
|
|
2772
|
+
uniqueObject(prefab: Prefab): Node;
|
|
2773
|
+
removeObject(prefab: Prefab): void;
|
|
2774
|
+
popObject(prefab: Prefab): any;
|
|
2775
|
+
backObject(object: Node): void;
|
|
2776
|
+
protected getList(key: any): List;
|
|
2777
|
+
}
|
|
2778
|
+
declare var uidict: UIObjectDict;
|
|
2779
|
+
|
|
2780
|
+
declare class ViewController extends Component {
|
|
2781
|
+
constructor(name: string);
|
|
2782
|
+
open(...args: any[]): void;
|
|
2783
|
+
close(): void;
|
|
2784
|
+
get objectDict(): UIObjectDict;
|
|
2785
|
+
protected _objectDict: UIObjectDict;
|
|
2786
|
+
}
|
|
2787
|
+
declare class ControllerDict extends Dictionary<string, ViewController> {
|
|
2788
|
+
getByName(name: string): ViewController;
|
|
2789
|
+
register(controller: ViewController): void;
|
|
2790
|
+
}
|
|
2791
|
+
declare var ctrlrepo: ControllerDict;
|
|
2792
|
+
|
|
2793
|
+
declare class PageController extends ViewController {
|
|
2794
|
+
constructor(routeName: string, config?: {
|
|
2795
|
+
layer?: string;
|
|
2796
|
+
tags?: string[];
|
|
2797
|
+
enableHistory?: boolean;
|
|
2798
|
+
});
|
|
2799
|
+
protected onOpening(page: Page): void;
|
|
2800
|
+
protected onOpened(page: Page): void;
|
|
2801
|
+
protected onClosing(page: Page): void;
|
|
2802
|
+
protected onClosed(page: Page): void;
|
|
2803
|
+
protected onRefresh(page: Page): void;
|
|
2804
|
+
openByRoute(route: Route): Page;
|
|
2805
|
+
private openPage;
|
|
2806
|
+
openComplete(page: Page): void;
|
|
2807
|
+
closeByRoute(route?: Route): Page;
|
|
2808
|
+
private closePage;
|
|
2809
|
+
closeComplete(page: Page): void;
|
|
2810
|
+
refresh(): void;
|
|
2811
|
+
get layer(): string;
|
|
2812
|
+
hasTags(tags: string[]): boolean;
|
|
2813
|
+
setLayer(name: string): this;
|
|
2814
|
+
setTags(tags: string[]): this;
|
|
2815
|
+
get lastPage(): Page;
|
|
2816
|
+
get route(): Route;
|
|
2817
|
+
get enableHistory(): boolean;
|
|
2818
|
+
protected _enableHistory: boolean;
|
|
2819
|
+
protected _route: Route;
|
|
2820
|
+
protected _lastPage: Page;
|
|
2821
|
+
protected _tags: {};
|
|
2822
|
+
protected _layer: string;
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
declare enum PageState {
|
|
2826
|
+
/**
|
|
2827
|
+
* 关闭
|
|
2828
|
+
*/
|
|
2829
|
+
Closed = 0,
|
|
2830
|
+
/**
|
|
2831
|
+
* 正在打开
|
|
2832
|
+
*/
|
|
2833
|
+
Opening = 1,
|
|
2834
|
+
/**
|
|
2835
|
+
* 已打开
|
|
2836
|
+
*/
|
|
2837
|
+
Opened = 2,
|
|
2838
|
+
/**
|
|
2839
|
+
* 正在关闭
|
|
2840
|
+
*/
|
|
2841
|
+
Closeing = 3
|
|
2842
|
+
}
|
|
2843
|
+
declare enum PageEvent {
|
|
2844
|
+
Opening = "opening",
|
|
2845
|
+
Opened = "opened",
|
|
2846
|
+
Closeing = "closeing",
|
|
2847
|
+
Closed = "closed",
|
|
2848
|
+
Stop = "stop"
|
|
2849
|
+
}
|
|
2850
|
+
declare class Page extends EventManager {
|
|
2851
|
+
constructor(controller: PageController, route: Route);
|
|
2852
|
+
/**
|
|
2853
|
+
* 等待打开完成指令
|
|
2854
|
+
*/
|
|
2855
|
+
waitOpenComplete(): void;
|
|
2856
|
+
waitCloseComplete(): void;
|
|
2857
|
+
openComplete(): void;
|
|
2858
|
+
closeComplete(): void;
|
|
2859
|
+
stop(reason: LinkError): void;
|
|
2860
|
+
/**
|
|
2861
|
+
* 等待发送的结果
|
|
2862
|
+
* 如果返回 null,表示主动取消 [cancel]
|
|
2863
|
+
*/
|
|
2864
|
+
wait(): Promise<this>;
|
|
2865
|
+
toString(): string;
|
|
2866
|
+
get objectDict(): UIObjectDict;
|
|
2867
|
+
protected _objectDict: UIObjectDict;
|
|
2868
|
+
protected _waitOpenComplete: boolean;
|
|
2869
|
+
protected _waitCloseComplete: boolean;
|
|
2870
|
+
get controller(): PageController;
|
|
2871
|
+
get route(): Route;
|
|
2872
|
+
cache: {};
|
|
2873
|
+
tags: {};
|
|
2874
|
+
layer: string;
|
|
2875
|
+
state: PageState;
|
|
2876
|
+
protected _controller: PageController;
|
|
2877
|
+
protected _route: Route;
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
/**
|
|
2881
|
+
* 视图管理器
|
|
2882
|
+
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
2883
|
+
*/
|
|
2884
|
+
declare class PageLayer {
|
|
2885
|
+
name: string;
|
|
2886
|
+
constructor(name: string);
|
|
2887
|
+
close(): void;
|
|
2888
|
+
/**
|
|
2889
|
+
* 当前的页面
|
|
2890
|
+
*/
|
|
2891
|
+
currentPage: Page;
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
declare class PageList extends List<Page> {
|
|
2895
|
+
}
|
|
2896
|
+
declare class PageRepo extends PageList {
|
|
2897
|
+
constructor();
|
|
2898
|
+
openByString(route: string): Page;
|
|
2899
|
+
/**
|
|
2900
|
+
* 打开页面
|
|
2901
|
+
* 一个路由代表一个页面
|
|
2902
|
+
* @param route
|
|
2903
|
+
*/
|
|
2904
|
+
open(route: Route): Page;
|
|
2905
|
+
close(route: Route): void;
|
|
2906
|
+
/**
|
|
2907
|
+
* 如果页面存在,则刷新
|
|
2908
|
+
* @param route
|
|
2909
|
+
*/
|
|
2910
|
+
refresh(route: Route): void;
|
|
2911
|
+
/**
|
|
2912
|
+
* 历史记录
|
|
2913
|
+
*/
|
|
2914
|
+
getHistory(): Route[];
|
|
2915
|
+
back(): void;
|
|
2916
|
+
getByRoute(route: Route): Page;
|
|
2917
|
+
listByTags(tags: string[]): PageList;
|
|
2918
|
+
getLayerMain(): PageLayer;
|
|
2919
|
+
/**
|
|
2920
|
+
* @param name
|
|
2921
|
+
*/
|
|
2922
|
+
getLayer(name: string): PageLayer;
|
|
2923
|
+
protected getOrNewLayer(name: string): PageLayer;
|
|
2924
|
+
getController(route: Route): PageController;
|
|
2925
|
+
get objectDict(): UIObjectDict;
|
|
2926
|
+
protected _objectDict: UIObjectDict;
|
|
2927
|
+
protected _indexLayer: {};
|
|
2928
|
+
protected _indexRoute: {};
|
|
2929
|
+
protected _history: Route[];
|
|
2930
|
+
}
|
|
2931
|
+
declare const pagerepo: PageRepo;
|
|
2932
|
+
|
|
2933
|
+
interface ISchemaTreeNode extends TreeNode {
|
|
2934
|
+
tags: {
|
|
2935
|
+
/**
|
|
2936
|
+
* Field.Name
|
|
2937
|
+
*/
|
|
2938
|
+
title: string;
|
|
2939
|
+
/**
|
|
2940
|
+
* 可获取节点对应的 Field
|
|
2941
|
+
*/
|
|
2942
|
+
field: Field;
|
|
2943
|
+
/**
|
|
2944
|
+
* 可获取节点对应的 IType
|
|
2945
|
+
*/
|
|
2946
|
+
schema: IType;
|
|
2947
|
+
/**
|
|
2948
|
+
* 当类型为ClassType时,标识是否为null
|
|
2949
|
+
*/
|
|
2950
|
+
isNull: boolean;
|
|
2951
|
+
/**
|
|
2952
|
+
* 标识是否为默认值
|
|
2953
|
+
*/
|
|
2954
|
+
isDefault: boolean;
|
|
2955
|
+
};
|
|
2956
|
+
/**
|
|
2957
|
+
* 当 Field 的类型为 BasicType 时,设置成传入对象对应的值
|
|
2958
|
+
* 否则为 null
|
|
2959
|
+
*/
|
|
2960
|
+
data: any;
|
|
2961
|
+
}
|
|
2962
|
+
declare class SchemaTreeRootCreator {
|
|
2963
|
+
static default: SchemaTreeRootCreator;
|
|
2964
|
+
constructor();
|
|
2965
|
+
createByType(root: TreeRoot, type: IType, id: string, object: any, title?: string, defaultValue?: any): TreeNode;
|
|
2966
|
+
updateByType(node: TreeNode, value: any): void;
|
|
2967
|
+
/**
|
|
2968
|
+
* 通过类的约束和类的map值,生成用于对象编辑器的树对象
|
|
2969
|
+
* @param decl
|
|
2970
|
+
* @param object
|
|
2971
|
+
*
|
|
2972
|
+
* @see ISchemaTreeNode
|
|
2973
|
+
*/
|
|
2974
|
+
createByClassDecl(decl: ClassDecl, object: any): TreeRoot;
|
|
2975
|
+
/**
|
|
2976
|
+
* 通过类的约束和类的map值,生成用于对象编辑器的树对象
|
|
2977
|
+
* @param decl
|
|
2978
|
+
*
|
|
2979
|
+
* @see ISchemaTreeNode
|
|
2980
|
+
*/
|
|
2981
|
+
createByEnumDecl(decl: EnumDecl): TreeRoot;
|
|
2982
|
+
createNode(type: IType | ClassDecl | EnumDecl, id: string): TreeNode;
|
|
2983
|
+
createOriginByClassDecl(root: TreeRoot, decl: ClassDecl, object: any): TreeNode;
|
|
2984
|
+
createOriginByEnumDecl(root: TreeRoot, decl: EnumDecl, object: any): TreeNode;
|
|
2985
|
+
protected createChildrenByEnumDecl(node: TreeNode, decl: EnumDecl, object: any): void;
|
|
2986
|
+
protected createChildrenByClassDecl(node: TreeNode, decl: ClassDecl, object: any): void;
|
|
2987
|
+
protected createChildByField(node: TreeNode, field: Field, object: any): void;
|
|
2988
|
+
protected createChildByMapType(root: TreeRoot, type: MapType, id: string, object: {
|
|
2989
|
+
[key: string]: any;
|
|
2990
|
+
}, title: string): TreeNode;
|
|
2991
|
+
protected createChildByMapType_Child(node: TreeNode, root: TreeRoot, type: IType, id: string, object: any, title: string): TreeNode;
|
|
2992
|
+
protected createChildByArrayType(root: TreeRoot, type: ArrayType, id: string, object: any[], title: string): TreeNode;
|
|
2993
|
+
protected createChildByClassType(root: TreeRoot, type: ClassType, id: string, value: any, title: string): TreeNode;
|
|
2994
|
+
protected createChildByAnyType(root: TreeRoot, type: AnyType, id: string, value: any, title: string): TreeNode;
|
|
2995
|
+
protected updateAnyType(node: TreeNode, value: any): void;
|
|
2996
|
+
protected createByEnumType(root: TreeRoot, type: EnumType, id: string, value: any, title: string, defaultValue: any): TreeNode;
|
|
2997
|
+
/**
|
|
2998
|
+
* @param root
|
|
2999
|
+
* @param type
|
|
3000
|
+
* @param id
|
|
3001
|
+
* @param value
|
|
3002
|
+
* @param title
|
|
3003
|
+
* @param defaultValue
|
|
3004
|
+
* @param ident
|
|
3005
|
+
* @param keepOrigin 保持 value 的值
|
|
3006
|
+
* @protected
|
|
3007
|
+
*/
|
|
3008
|
+
protected createByBasicType(root: TreeRoot, type: BasicType, id: string, value: any, title: string, defaultValue: any, ident?: string, keepOrigin?: boolean): TreeNode;
|
|
3009
|
+
/**
|
|
3010
|
+
* 表示是否检查约束声明中的 [hide] 标签
|
|
3011
|
+
*/
|
|
3012
|
+
disableHide(): this;
|
|
3013
|
+
disableAutoValue(): this;
|
|
3014
|
+
replaceField(classDecl: string, fieldName: string, handler: (decl: ClassDecl, object: any, field: Field) => Field): this;
|
|
3015
|
+
protected _checkHide: boolean;
|
|
3016
|
+
protected _autoValue: boolean;
|
|
3017
|
+
protected _replaceField: {};
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
declare class SchemaValueToJson {
|
|
3021
|
+
field: Field;
|
|
3022
|
+
constructor(field: Field);
|
|
3023
|
+
toJson(treeValue: any): any;
|
|
3024
|
+
_toJson(type: IType, value: any, field?: Field): any;
|
|
3025
|
+
private toObject_ClassType;
|
|
3026
|
+
private toObject_MapType;
|
|
3027
|
+
private toObject_ArrayType;
|
|
3028
|
+
private toObject_BasicType;
|
|
3029
|
+
private toObject_ClassDecl;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
declare class SchemaNodeToValue {
|
|
3033
|
+
node: TreeNode;
|
|
3034
|
+
constructor(node: TreeNode);
|
|
3035
|
+
toValue(): any;
|
|
3036
|
+
_toValue(node: TreeNode): any;
|
|
3037
|
+
private toObject_ClassType;
|
|
3038
|
+
private toObject_MapType;
|
|
3039
|
+
private toObject_ArrayType;
|
|
3040
|
+
private toObject_AnyType;
|
|
3041
|
+
private toObject_BasicType;
|
|
3042
|
+
private toObject_ClassDecl;
|
|
3043
|
+
/**
|
|
3044
|
+
* 动态关联的对象转化成字符串
|
|
3045
|
+
*/
|
|
3046
|
+
setDlinkObjectToString(): this;
|
|
3047
|
+
/**
|
|
3048
|
+
* 设置移除默认的字段
|
|
3049
|
+
*/
|
|
3050
|
+
setRemoveFieldDefault(): this;
|
|
3051
|
+
protected _dlinkObjectToString: boolean;
|
|
3052
|
+
protected _removeFieldDefault: boolean;
|
|
3053
|
+
}
|
|
3054
|
+
|
|
3055
|
+
interface ISchemaType {
|
|
3056
|
+
name: string;
|
|
3057
|
+
matchType?: IType;
|
|
3058
|
+
/**
|
|
3059
|
+
* 值转换成字符串用于显示
|
|
3060
|
+
* @param configSet
|
|
3061
|
+
* @param data
|
|
3062
|
+
* @param typeValue
|
|
3063
|
+
*/
|
|
3064
|
+
valueToText: (dataNode: TreeNode, field: Field, typeValue: string) => string;
|
|
3065
|
+
/**
|
|
3066
|
+
* 转换成识别号
|
|
3067
|
+
*/
|
|
3068
|
+
valueToIdent: Function;
|
|
3069
|
+
/**
|
|
3070
|
+
* 编辑器中使用的预设体
|
|
3071
|
+
*/
|
|
3072
|
+
valueToPrefab?: (dataNode: TreeNode, field: Field, typeValue: string) => Prefab;
|
|
3073
|
+
}
|
|
3074
|
+
declare class SchemaManager extends EventManager {
|
|
3075
|
+
registerExtendType(typ: ISchemaType): void;
|
|
3076
|
+
getExtendTypeByField(field: Field): ISchemaType;
|
|
3077
|
+
/**
|
|
3078
|
+
* 通过约束树的节点获取该节点定义的扩展类型
|
|
3079
|
+
* 如果是 map/array 的子节点,则返回 map和array 中定义的扩展类型
|
|
3080
|
+
* @param node tags = {field:Field, schema:IType}
|
|
3081
|
+
*/
|
|
3082
|
+
getExtendTypeByNode(node: TreeNode): ISchemaType;
|
|
3083
|
+
getExtendType(typ: string): ISchemaType;
|
|
3084
|
+
protected _typeExtendMap: {
|
|
3085
|
+
[key: string]: ISchemaType;
|
|
3086
|
+
};
|
|
3087
|
+
/**
|
|
3088
|
+
* 通过约束树的节点获取该节点定义的字段信息
|
|
3089
|
+
* 如果是 map/array 的子节点,则返回 map和array 的字段信息
|
|
3090
|
+
* @param node
|
|
3091
|
+
*/
|
|
3092
|
+
getFieldByNode(node: TreeNode): Field;
|
|
3093
|
+
createByType(root: TreeRoot, type: IType, id: string, object: any, title?: string, defaultValue?: any): TreeNode;
|
|
3094
|
+
getDataNodeFieldTags(dataTyp: IType | Field, parentTyp: IType): any;
|
|
3095
|
+
/**
|
|
3096
|
+
* 获取节点schema中,所在Field的Tags。
|
|
3097
|
+
* @param dataNode
|
|
3098
|
+
*/
|
|
3099
|
+
getFieldTags(dataNode: TreeNode): {
|
|
3100
|
+
[key: string]: string;
|
|
3101
|
+
};
|
|
3102
|
+
}
|
|
3103
|
+
declare var schemamgr: SchemaManager;
|
|
3104
|
+
|
|
3105
|
+
/**
|
|
3106
|
+
* 解码反射值的接口
|
|
3107
|
+
*/
|
|
3108
|
+
interface IRefValue {
|
|
3109
|
+
refType(): string;
|
|
3110
|
+
}
|
|
3111
|
+
declare class MapDecoder {
|
|
3112
|
+
constructor();
|
|
3113
|
+
decodeSet(m: {
|
|
3114
|
+
[key: string]: any;
|
|
3115
|
+
}): any;
|
|
3116
|
+
decodeMap(m: {
|
|
3117
|
+
[key: string]: any;
|
|
3118
|
+
}): any;
|
|
3119
|
+
decodeObj(obj: IRefValue, m: any): void;
|
|
3120
|
+
protected parseObj(obj: any, m: any, desc: ClassDecl): void;
|
|
3121
|
+
protected parseMap(omap: any, mmap: any, typ: MapType): any;
|
|
3122
|
+
protected parseSlice(oarr: any, marr: any, typ: ArrayType): any;
|
|
3123
|
+
protected parseAny(oval: any, mval: any, typ: AnyType): any;
|
|
3124
|
+
protected parseClass(oval: any, mval: any, typ: ClassType): any;
|
|
3125
|
+
protected parseEnum(oval: any, mval: any, typ: EnumType): any;
|
|
3126
|
+
protected parseBasic(oval: any, mval: any, typ: BasicType): any;
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
declare class ByteDecoder {
|
|
3130
|
+
decodeObj(obj: any, reader: ByteArray, desc: ClassDecl): void;
|
|
3131
|
+
protected parseMap(omap: any, reader: ByteArray, typ: MapType, value: string): any;
|
|
3132
|
+
protected parseSlice(oarr: any, reader: ByteArray, typ: ArrayType): any;
|
|
3133
|
+
protected parseAny(oval: any, reader: ByteArray, typ: AnyType, value: string): any;
|
|
3134
|
+
protected parseClass(oval: any, reader: ByteArray, typ: ClassType, value: string): any;
|
|
3135
|
+
protected parseEnum(reader: ByteArray, typ: EnumType): any;
|
|
3136
|
+
protected parseBasic(reader: ByteArray, typ: BasicType): any;
|
|
3137
|
+
protected parseKind(reader: ByteArray, kind: Kind): any;
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
declare class SimpleModify {
|
|
3141
|
+
ctx: any;
|
|
3142
|
+
constructor(ctx: any);
|
|
3143
|
+
setValue(key: string, valueOrCreator: any | Function): void;
|
|
3144
|
+
protected _data: any[];
|
|
3145
|
+
getValue(key: string): any;
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
type CreatorFunction = (...args: any[]) => {};
|
|
3149
|
+
/**
|
|
3150
|
+
* 回收的方法
|
|
3151
|
+
* 使用回收方法的原因是,某些对象没有recycle函数,由不方便实现recycle函数
|
|
3152
|
+
*/
|
|
3153
|
+
type RecycleFunction = (item: any, ...args: any[]) => void;
|
|
3154
|
+
/**
|
|
3155
|
+
* 释放的方法
|
|
3156
|
+
*/
|
|
3157
|
+
type DisposeFunction = (item: any, ...args: any[]) => void;
|
|
3158
|
+
/**
|
|
3159
|
+
* 对象池
|
|
3160
|
+
*/
|
|
3161
|
+
declare class Pool {
|
|
3162
|
+
creatorFunction: CreatorFunction;
|
|
3163
|
+
recycleFunction: RecycleFunction;
|
|
3164
|
+
disposeFunction: DisposeFunction;
|
|
3165
|
+
name: string;
|
|
3166
|
+
list: any[];
|
|
3167
|
+
constructor();
|
|
3168
|
+
/**
|
|
3169
|
+
* 获取一个对象
|
|
3170
|
+
*/
|
|
3171
|
+
getObject(...args: any[]): any;
|
|
3172
|
+
/**
|
|
3173
|
+
* 回收一个对象
|
|
3174
|
+
* @param obj
|
|
3175
|
+
*/
|
|
3176
|
+
recycleObject(obj: any): void;
|
|
3177
|
+
/**
|
|
3178
|
+
* 释放一个对象
|
|
3179
|
+
* @param obj
|
|
3180
|
+
*/
|
|
3181
|
+
disposeObject(obj: any): void;
|
|
3182
|
+
/**
|
|
3183
|
+
* 释放对象池
|
|
3184
|
+
*/
|
|
3185
|
+
dispose(): void;
|
|
3186
|
+
}
|
|
3187
|
+
declare class PoolSet {
|
|
3188
|
+
pools: {
|
|
3189
|
+
[key: string]: Pool;
|
|
3190
|
+
};
|
|
3191
|
+
constructor();
|
|
3192
|
+
register(poolName: string, creator: CreatorFunction, recycle?: RecycleFunction, dispose?: DisposeFunction): Pool;
|
|
3193
|
+
getOrCreatePool(poolName: any): Pool;
|
|
3194
|
+
getPool(poolName: any): Pool;
|
|
3195
|
+
disposePool(poolName: string): void;
|
|
3196
|
+
dispose(): void;
|
|
3197
|
+
}
|
|
3198
|
+
/**
|
|
3199
|
+
* 对象池
|
|
3200
|
+
*/
|
|
3201
|
+
declare class SamplePool {
|
|
3202
|
+
list: any[];
|
|
3203
|
+
constructor();
|
|
3204
|
+
/**
|
|
3205
|
+
* 获取一个对象
|
|
3206
|
+
*/
|
|
3207
|
+
get(): any;
|
|
3208
|
+
/**
|
|
3209
|
+
* 回收一个对象
|
|
3210
|
+
* @param obj
|
|
3211
|
+
*/
|
|
3212
|
+
put(obj: any): void;
|
|
3213
|
+
}
|
|
3214
|
+
/**
|
|
3215
|
+
* 对象池
|
|
3216
|
+
*/
|
|
3217
|
+
declare class SamplePoolSet {
|
|
3218
|
+
get(name: string): any;
|
|
3219
|
+
put(name: string, item: any): void;
|
|
3220
|
+
protected pools: {};
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
declare class CallbackItem {
|
|
3224
|
+
listener: Function;
|
|
3225
|
+
caller: any;
|
|
3226
|
+
once: boolean;
|
|
3227
|
+
}
|
|
3228
|
+
declare class SampleCallbackList {
|
|
3229
|
+
constructor();
|
|
3230
|
+
dispose(): void;
|
|
3231
|
+
has(caller: any, listener: Function): boolean;
|
|
3232
|
+
protected getItem(caller: any, listener: Function): CallbackItem;
|
|
3233
|
+
/**
|
|
3234
|
+
* 监听事件,如果监听已经存在则返回
|
|
3235
|
+
* @param caller
|
|
3236
|
+
* @param listener 为了性能考虑, event使用了对象池处理。因此处理函数不应该保存event的引用。如有需要,可通过新建对象或Event.Clone()实现
|
|
3237
|
+
*/
|
|
3238
|
+
on(caller: any, listener: (ctx: this, params?: any) => void): CallbackItem;
|
|
3239
|
+
once(caller: any, listener: (ctx: this, params?: any) => void): CallbackItem;
|
|
3240
|
+
protected offItem(item: CallbackItem): void;
|
|
3241
|
+
off(caller: any, listener: Function): void;
|
|
3242
|
+
offAll(type?: string): void;
|
|
3243
|
+
offAllCaller(caller: any): void;
|
|
3244
|
+
/**
|
|
3245
|
+
* 派发事件
|
|
3246
|
+
* @param params 事件参数
|
|
3247
|
+
*/
|
|
3248
|
+
dispatch(params?: any): void;
|
|
3249
|
+
protected _callbackItems: CallbackItem[];
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3252
|
+
declare enum DataValueType {
|
|
3253
|
+
Class = 0,
|
|
3254
|
+
Array = 1,
|
|
3255
|
+
String = 2,
|
|
3256
|
+
Number = 3,
|
|
3257
|
+
Boolean = 4
|
|
3258
|
+
}
|
|
3259
|
+
declare class DataValue extends SampleCallbackList {
|
|
3260
|
+
constructor(path: string, type: DataValueType);
|
|
3261
|
+
enableLocalStorage(): this;
|
|
3262
|
+
get(): any;
|
|
3263
|
+
set(value: any): void;
|
|
3264
|
+
load(): void;
|
|
3265
|
+
save(value: any): void;
|
|
3266
|
+
refresh(): void;
|
|
3267
|
+
get path(): string;
|
|
3268
|
+
get type(): DataValueType;
|
|
3269
|
+
protected _enableLocalStorage: boolean;
|
|
3270
|
+
protected _path: string;
|
|
3271
|
+
protected _type: DataValueType;
|
|
3272
|
+
protected _data: any;
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
declare class DataDispatchParams {
|
|
3276
|
+
action: DBAction;
|
|
3277
|
+
object: {};
|
|
3278
|
+
table: IDBTable;
|
|
3279
|
+
/**
|
|
3280
|
+
* DBAction.Update时为变化的数据
|
|
3281
|
+
* DBAction.Create时为创建的数据
|
|
3282
|
+
*/
|
|
3283
|
+
data: any;
|
|
3284
|
+
}
|
|
3285
|
+
/**
|
|
3286
|
+
* tablePath 对象id@表id, 如果未设置表id,则默认为 "@alone"
|
|
3287
|
+
* propPath /prop1/prop2...
|
|
3288
|
+
*/
|
|
3289
|
+
declare class DataManager extends EventManager implements IDatabase {
|
|
3290
|
+
/**
|
|
3291
|
+
* 输入 [表id][对象id] 返回 [表id, 对象id]
|
|
3292
|
+
* @param tablePath
|
|
3293
|
+
* @private
|
|
3294
|
+
*/
|
|
3295
|
+
static $parseKey(tablePath: string): [string, string];
|
|
3296
|
+
constructor();
|
|
3297
|
+
init(): void;
|
|
3298
|
+
registerTable(name: string, table: IDBTable): IDBTable;
|
|
3299
|
+
/**
|
|
3300
|
+
* 可通过 Laya.ClassUtils.regClass("database.table.tableId") 替换默认的 DataBucket
|
|
3301
|
+
* @param name
|
|
3302
|
+
*/
|
|
3303
|
+
getTable(name: string): IDBTable;
|
|
3304
|
+
/**
|
|
3305
|
+
* 创建表对象
|
|
3306
|
+
* 需要设置表
|
|
3307
|
+
* @param tablePath
|
|
3308
|
+
* @param data
|
|
3309
|
+
*/
|
|
3310
|
+
createObject<T = IDBObject>(tablePath: string, data: any): T;
|
|
3311
|
+
updateObject(obj: IDBObject, data: {
|
|
3312
|
+
[key: string]: any;
|
|
3313
|
+
}): void;
|
|
3314
|
+
/**
|
|
3315
|
+
* 更新对象
|
|
3316
|
+
* @param tablePath
|
|
3317
|
+
* @param data 发生变化的数据
|
|
3318
|
+
*/
|
|
3319
|
+
updateByPath(tablePath: string, data: any): void;
|
|
3320
|
+
/**
|
|
3321
|
+
* 移除对象
|
|
3322
|
+
* @param tablePath
|
|
3323
|
+
*/
|
|
3324
|
+
removeObject(tablePath: string): void;
|
|
3325
|
+
/**
|
|
3326
|
+
* 获取对象
|
|
3327
|
+
* 如果设置了tableId,会保存包对应的表中
|
|
3328
|
+
* @param tablePath =“tableId/objectId” or objectId
|
|
3329
|
+
*/
|
|
3330
|
+
getObject(tablePath: string): IDBObject;
|
|
3331
|
+
getOrCreateObject(tablePath: string): IDBObject;
|
|
3332
|
+
/**
|
|
3333
|
+
* 获取属性的值
|
|
3334
|
+
* @param tablePath
|
|
3335
|
+
* @param propPath
|
|
3336
|
+
*/
|
|
3337
|
+
getObjectProp(tablePath: string, propPath?: string): any;
|
|
3338
|
+
setObjectProp(tablePath: string, propPath?: string, data?: any, enableDispatch?: boolean): void;
|
|
3339
|
+
LSKeys(): LSKeys;
|
|
3340
|
+
LSLoadOrSaveObject(tablePath: string, data: any): void;
|
|
3341
|
+
/**
|
|
3342
|
+
* 从localStorage中加载数据并初始化,如果是table,则添加到table中
|
|
3343
|
+
* @param objectPath
|
|
3344
|
+
* @return 路径指向的对象,如果不存在则创建。如果未注册,抛出异常
|
|
3345
|
+
* @return localStorage是否存在数目
|
|
3346
|
+
*/
|
|
3347
|
+
LSLoadObject<T = IDBObject>(objectPath: string): T;
|
|
3348
|
+
LSRemoveObject(tablePath: string): void;
|
|
3349
|
+
LSSaveObject(tablePath: string): void;
|
|
3350
|
+
LSLoadProp(tablePath: string, propPath: string, handler?: (data: any) => any): void;
|
|
3351
|
+
LSSaveProp(tablePath: string, propPath: string): void;
|
|
3352
|
+
getDataValue(path: string): DataValue;
|
|
3353
|
+
existDataValue(path: string, creator: (path: string) => DataValue): DataValue;
|
|
3354
|
+
setDataValue(dataObject: DataValue): void;
|
|
3355
|
+
saveObject(path: string, object: any): void;
|
|
3356
|
+
loadObject(path: string, target: any): any;
|
|
3357
|
+
saveAny(key: string, val: any): void;
|
|
3358
|
+
loadAny(key: string): any;
|
|
3359
|
+
protected object: {};
|
|
3360
|
+
private tables;
|
|
3361
|
+
}
|
|
3362
|
+
declare class LSKeys extends List<string> {
|
|
3363
|
+
add(key: string): void;
|
|
3364
|
+
dictByTable(tableName: string): List<string>;
|
|
3365
|
+
protected indexTable: {
|
|
3366
|
+
[key: string]: List<string>;
|
|
3367
|
+
};
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
declare var datamgr: DataManager;
|
|
3371
|
+
|
|
3372
|
+
declare class IDataTableConfig {
|
|
3373
|
+
/**
|
|
3374
|
+
* 名字
|
|
3375
|
+
*/
|
|
3376
|
+
name: string;
|
|
3377
|
+
}
|
|
3378
|
+
declare class DataTableConfig {
|
|
3379
|
+
/**
|
|
3380
|
+
* 名字
|
|
3381
|
+
*/
|
|
3382
|
+
name: string;
|
|
3383
|
+
/**
|
|
3384
|
+
* 数据对象的方法
|
|
3385
|
+
*/
|
|
3386
|
+
objectCreator?: (ident: any, data: any) => IDBObject;
|
|
3387
|
+
/**
|
|
3388
|
+
* 数据集的类
|
|
3389
|
+
*/
|
|
3390
|
+
mapCreator?: () => IDBTable;
|
|
3391
|
+
constructor({ name, objectCreator, mapCreator }: DataTableConfig);
|
|
3392
|
+
}
|
|
3393
|
+
/**
|
|
3394
|
+
* 独立类型的配置表
|
|
3395
|
+
*/
|
|
3396
|
+
declare class DataTableAloneConfig {
|
|
3397
|
+
/**
|
|
3398
|
+
* 名字
|
|
3399
|
+
*/
|
|
3400
|
+
name: string;
|
|
3401
|
+
/**
|
|
3402
|
+
* 指定项的配置,用于独立模式,通常名字为alone
|
|
3403
|
+
*/
|
|
3404
|
+
items: {
|
|
3405
|
+
[key: string]: DataTableItemConfig;
|
|
3406
|
+
};
|
|
3407
|
+
constructor({ name, items }: DataTableAloneConfig);
|
|
3408
|
+
}
|
|
3409
|
+
interface DataTableItemConfig {
|
|
3410
|
+
/**
|
|
3411
|
+
* 数据对象的方法
|
|
3412
|
+
*/
|
|
3413
|
+
objectCreator: (ident: any, data: any) => IDBObject;
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3416
|
+
declare class Config {
|
|
3417
|
+
static createByJSONMap(编号: string, conf: IConfigInfo): Config;
|
|
3418
|
+
static create(编号: string, 类型: string, 分类: string): Config;
|
|
3419
|
+
/**
|
|
3420
|
+
* 命名空间/类型
|
|
3421
|
+
*/
|
|
3422
|
+
get类型标识(): string;
|
|
3423
|
+
calculate最终数据(): {};
|
|
3424
|
+
/**
|
|
3425
|
+
* 配置保存的数据
|
|
3426
|
+
*/
|
|
3427
|
+
get 数据(): any;
|
|
3428
|
+
get 编辑器名称(): string;
|
|
3429
|
+
get 父对象(): Config;
|
|
3430
|
+
克隆(): Config;
|
|
3431
|
+
/**
|
|
3432
|
+
* 设置数据
|
|
3433
|
+
* @param path /p1/p2/key
|
|
3434
|
+
* @param value
|
|
3435
|
+
*/
|
|
3436
|
+
setData(path: string, value: any): void;
|
|
3437
|
+
removeData(path: string): void;
|
|
3438
|
+
getSchema(): ClassDecl;
|
|
3439
|
+
get类型(): string;
|
|
3440
|
+
/**
|
|
3441
|
+
* 转化成存储到文件的map对象的值
|
|
3442
|
+
*/
|
|
3443
|
+
toSaveObj(r: any): any;
|
|
3444
|
+
/**
|
|
3445
|
+
* 转化成存储到文件的map对象的值
|
|
3446
|
+
*/
|
|
3447
|
+
toSaveFileValue(): any;
|
|
3448
|
+
/**
|
|
3449
|
+
* 转化成存储到文件的map对象 {编号:toSaveFileValue()}
|
|
3450
|
+
*/
|
|
3451
|
+
toSaveFileObject(): any;
|
|
3452
|
+
已变化的属性路径: {
|
|
3453
|
+
[key: string]: boolean;
|
|
3454
|
+
};
|
|
3455
|
+
发生错误的属性路径: {
|
|
3456
|
+
[key: string]: boolean;
|
|
3457
|
+
};
|
|
3458
|
+
编辑器字体颜色(属性路径: string): Color;
|
|
3459
|
+
更新发生错误(path: string): void;
|
|
3460
|
+
protected 更新已更新(path: string): void;
|
|
3461
|
+
刷新已变化的属性路径(): void;
|
|
3462
|
+
刷新发生错误的属性路径(): void;
|
|
3463
|
+
protected 刷新发生错误的属性路径_class_decl(decl: ClassDecl, obj: any, path: string): void;
|
|
3464
|
+
井号to分类编号(val: string): string;
|
|
3465
|
+
分类编号to井号(val: string): string;
|
|
3466
|
+
/**
|
|
3467
|
+
* 由类型和类型编号组成
|
|
3468
|
+
* 格式为:分类编号@分类
|
|
3469
|
+
*/
|
|
3470
|
+
编号: string;
|
|
3471
|
+
/**
|
|
3472
|
+
* 父配置的编号
|
|
3473
|
+
*/
|
|
3474
|
+
父编号: string;
|
|
3475
|
+
原始数据: any;
|
|
3476
|
+
最终数据: any;
|
|
3477
|
+
/**
|
|
3478
|
+
* 私有的文件,只在文件内部可以发现
|
|
3479
|
+
* 0-文件内可见, 1-目录内可见, 2-全局可见
|
|
3480
|
+
*/
|
|
3481
|
+
导出的: number;
|
|
3482
|
+
/**
|
|
3483
|
+
* 配置所在的文件路径
|
|
3484
|
+
*/
|
|
3485
|
+
文件: string;
|
|
3486
|
+
/**
|
|
3487
|
+
* 配置的分类
|
|
3488
|
+
* 例如单位,技能,掉落
|
|
3489
|
+
*/
|
|
3490
|
+
分类: string;
|
|
3491
|
+
/**
|
|
3492
|
+
* 分类编号
|
|
3493
|
+
*/
|
|
3494
|
+
分类编号: string;
|
|
3495
|
+
/**
|
|
3496
|
+
* 配置的对象类型
|
|
3497
|
+
* 例如技能-攻击,技能-移动,技能-效果
|
|
3498
|
+
*/
|
|
3499
|
+
类型: string;
|
|
3500
|
+
命名空间: string;
|
|
3501
|
+
/**
|
|
3502
|
+
* 编辑器使用的名称
|
|
3503
|
+
*/
|
|
3504
|
+
名称: string;
|
|
3505
|
+
/**
|
|
3506
|
+
* 编辑器的数据
|
|
3507
|
+
*/
|
|
3508
|
+
编辑器数据: any;
|
|
3509
|
+
编辑器前缀: string;
|
|
3510
|
+
编辑器后缀: string;
|
|
3511
|
+
/**
|
|
3512
|
+
* 用于记录当前配置是由哪个模版创建而成
|
|
3513
|
+
*/
|
|
3514
|
+
编辑器模版: string;
|
|
3515
|
+
/**
|
|
3516
|
+
* 用于生成树结构
|
|
3517
|
+
*/
|
|
3518
|
+
编辑器路径: string;
|
|
3519
|
+
classDecl: ClassDecl;
|
|
3520
|
+
/**
|
|
3521
|
+
* 默认的配置
|
|
3522
|
+
*/
|
|
3523
|
+
默认的: boolean;
|
|
3524
|
+
/**
|
|
3525
|
+
* 在自己的分类的名称是唯一的
|
|
3526
|
+
*/
|
|
3527
|
+
唯一的: boolean;
|
|
3528
|
+
/**
|
|
3529
|
+
* 用于避免误操作
|
|
3530
|
+
*/
|
|
3531
|
+
禁止删除: boolean;
|
|
3532
|
+
/**
|
|
3533
|
+
* 用于避免误操作
|
|
3534
|
+
*/
|
|
3535
|
+
禁止编辑: boolean;
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3538
|
+
declare enum ConfigSetEventSub {
|
|
3539
|
+
Add = "add",
|
|
3540
|
+
DELETE = "delete",
|
|
3541
|
+
UPDATE = "item_update1"
|
|
3542
|
+
}
|
|
3543
|
+
interface IConfigInfo {
|
|
3544
|
+
_type: string;
|
|
3545
|
+
_catalog: string;
|
|
3546
|
+
_parent: string;
|
|
3547
|
+
_export: string;
|
|
3548
|
+
_default: string;
|
|
3549
|
+
_prefix: string;
|
|
3550
|
+
_suffix: string;
|
|
3551
|
+
_name: string;
|
|
3552
|
+
_file: string;
|
|
3553
|
+
}
|
|
3554
|
+
declare class ConfigSetEvent {
|
|
3555
|
+
sub: ConfigSetEventSub;
|
|
3556
|
+
config: Config;
|
|
3557
|
+
constructor(sub: ConfigSetEventSub, config: Config);
|
|
3558
|
+
}
|
|
3559
|
+
declare class ConfigSet extends EventManager {
|
|
3560
|
+
/**
|
|
3561
|
+
* dispatchParams = {config:Config}
|
|
3562
|
+
*/
|
|
3563
|
+
static EVENT_ADD: string;
|
|
3564
|
+
/**
|
|
3565
|
+
* dispatchParams = {config:Config}
|
|
3566
|
+
*/
|
|
3567
|
+
static EVENT_DELETE: string;
|
|
3568
|
+
/**
|
|
3569
|
+
* dispatchParams = {config:Config}
|
|
3570
|
+
*/
|
|
3571
|
+
static EVENT_UPDATE: string;
|
|
3572
|
+
protected _data: Config[];
|
|
3573
|
+
protected _indexTree: TreeRoot;
|
|
3574
|
+
get data(): Config[];
|
|
3575
|
+
constructor();
|
|
3576
|
+
/**
|
|
3577
|
+
* 加载发布后的文件
|
|
3578
|
+
* @param contentObject
|
|
3579
|
+
*/
|
|
3580
|
+
loadPublish(configMap: {
|
|
3581
|
+
[key: string]: any;
|
|
3582
|
+
}): void;
|
|
3583
|
+
get indexTree(): TreeRoot;
|
|
3584
|
+
loadByFile(file: string, contentObject: any): void;
|
|
3585
|
+
loadByFileMap(files: any): void;
|
|
3586
|
+
removeAll(): void;
|
|
3587
|
+
/**
|
|
3588
|
+
* 把源对象的数据复制到目标对象
|
|
3589
|
+
* @param source
|
|
3590
|
+
* @param target
|
|
3591
|
+
* @param decl
|
|
3592
|
+
*/
|
|
3593
|
+
copyObj(source: any, target: any, decl: ClassDecl): void;
|
|
3594
|
+
查找_通过编号(编号: string): Config;
|
|
3595
|
+
查找_通过文件(文件: string): ConfigSet;
|
|
3596
|
+
查找_通过类型(类型: string): ConfigSet;
|
|
3597
|
+
查找_通过分类(分类: string): ConfigSet;
|
|
3598
|
+
获取所有分类(指定文件?: string): string[];
|
|
3599
|
+
获取所有类型(指定文件?: string): string[];
|
|
3600
|
+
获取所有文件(): string[];
|
|
3601
|
+
生成类树(): TreeRoot;
|
|
3602
|
+
protected getItemParentLink(item: Config): string;
|
|
3603
|
+
/**
|
|
3604
|
+
*
|
|
3605
|
+
* @param 当前文件 优先显示当前文件的内容
|
|
3606
|
+
*/
|
|
3607
|
+
生成类型树(当前文件?: string, 默认优先?: boolean): TreeRoot;
|
|
3608
|
+
/**
|
|
3609
|
+
* 由于树结构使用 "/" 来分隔,为避免冲突,把文件的 "/" 全替换成 $
|
|
3610
|
+
*/
|
|
3611
|
+
生成分类树(使用分类?: boolean, 使用文件?: boolean): TreeRoot;
|
|
3612
|
+
/**
|
|
3613
|
+
* 按指定属性进行分类
|
|
3614
|
+
* @param 指定属性
|
|
3615
|
+
*/
|
|
3616
|
+
生成属性树(指定属性: string): TreeRoot;
|
|
3617
|
+
/**
|
|
3618
|
+
*
|
|
3619
|
+
* @param value
|
|
3620
|
+
* @param existed
|
|
3621
|
+
*/
|
|
3622
|
+
合并(value: ConfigSet, existed?: ConfigSet): ConfigSet;
|
|
3623
|
+
创建配置_通过父配置(父配置编号: string, 编号: string, 选项: {
|
|
3624
|
+
数据?: any;
|
|
3625
|
+
信息?: IConfigInfo;
|
|
3626
|
+
继承复制的对象?: boolean;
|
|
3627
|
+
}): Config;
|
|
3628
|
+
/**
|
|
3629
|
+
* @param 配置
|
|
3630
|
+
* @param enableDispatch
|
|
3631
|
+
* @see ConfigSet.EVENT_ADD
|
|
3632
|
+
*/
|
|
3633
|
+
添加配置(配置: Config, enableDispatch?: boolean): error;
|
|
3634
|
+
删除配置集(set: ConfigSet, enableDispatch?: boolean): error;
|
|
3635
|
+
/**
|
|
3636
|
+
*
|
|
3637
|
+
* @param 编号
|
|
3638
|
+
* @param enableDispatch
|
|
3639
|
+
* @see ConfigSet.EVENT_DELETE
|
|
3640
|
+
*/
|
|
3641
|
+
删除配置(编号: string, enableDispatch?: boolean): error;
|
|
3642
|
+
/**
|
|
3643
|
+
* 用于复制文件时使用,不触发事件,不修改缓存
|
|
3644
|
+
* @param 配置
|
|
3645
|
+
* @param 新编号
|
|
3646
|
+
*/
|
|
3647
|
+
重置编号(配置: Config, 新编号: string): error;
|
|
3648
|
+
删除_通过文件路径(路径: string): void;
|
|
3649
|
+
重置文件路径(fromPath: any, toPath: any): void;
|
|
3650
|
+
/**
|
|
3651
|
+
*
|
|
3652
|
+
* 与setData一样, 但会派发 ConfigSet.EVENT_UPDATE
|
|
3653
|
+
* @param 配置
|
|
3654
|
+
* @param path
|
|
3655
|
+
* @param value
|
|
3656
|
+
*/
|
|
3657
|
+
设置配置值(配置: Config, path: string, value: any): void;
|
|
3658
|
+
addItem(配置: Config): void;
|
|
3659
|
+
removeItem(编号: string): any;
|
|
3660
|
+
dispatchUpdateByIdent(ident: string): void;
|
|
3661
|
+
dispatchUpdate(config: Config): void;
|
|
3662
|
+
/**
|
|
3663
|
+
* 转换成保存到文件的对象
|
|
3664
|
+
*/
|
|
3665
|
+
toSaveFileObject(): {
|
|
3666
|
+
[key: string]: any;
|
|
3667
|
+
};
|
|
3668
|
+
toKeys(): string[];
|
|
3669
|
+
}
|
|
3670
|
+
|
|
3671
|
+
declare class ConfigManager {
|
|
3672
|
+
_default: ConfigSet;
|
|
3673
|
+
get default(): ConfigSet;
|
|
3674
|
+
registerCascader(key: string, root: TreeRoot): void;
|
|
3675
|
+
getCascader(path: string): TreeRoot;
|
|
3676
|
+
_cascader: {
|
|
3677
|
+
[key: string]: TreeRoot;
|
|
3678
|
+
};
|
|
3679
|
+
}
|
|
3680
|
+
declare const configmgr: ConfigManager;
|
|
3681
|
+
|
|
3682
|
+
declare class ConfigDict extends Dictionary<string, Config> {
|
|
3683
|
+
getBy编号(编号: string): Config;
|
|
3684
|
+
findByCondition(cond: (key: string, val: Config, iterator: DictIterator) => boolean): this;
|
|
3685
|
+
getBy模版(编号: string): Config;
|
|
3686
|
+
listBy文件(指定文件?: string): ConfigDict;
|
|
3687
|
+
listBy目录(指定目录?: string): ConfigDict;
|
|
3688
|
+
listBy分类(指定分类?: string): ConfigDict;
|
|
3689
|
+
listBy类型(指定类型?: string): ConfigDict;
|
|
3690
|
+
list所有分类(): string[];
|
|
3691
|
+
list所有类型(): string[];
|
|
3692
|
+
list所有文件(): string[];
|
|
3693
|
+
/**
|
|
3694
|
+
* @param 当前文件 优先显示当前文件的内容
|
|
3695
|
+
* @param 默认优先
|
|
3696
|
+
* @param 路径名和标题处理器 默认使用[item.编号, item.名称]
|
|
3697
|
+
*/
|
|
3698
|
+
create目录树(当前文件?: string, 默认优先?: boolean, 路径名和标题处理器?: (item: Config) => [string, string] | null): TreeRoot;
|
|
3699
|
+
/**
|
|
3700
|
+
* @param 当前文件 优先显示当前文件的内容
|
|
3701
|
+
* @param 默认优先
|
|
3702
|
+
* @param 路径名和标题处理器 默认使用[item.编号, item.名称]
|
|
3703
|
+
*/
|
|
3704
|
+
create类型树(当前文件?: string, 默认优先?: boolean, 路径名和标题处理器?: (item: Config) => [string, string] | null): TreeRoot;
|
|
3705
|
+
/**
|
|
3706
|
+
* 由于树结构使用 "/" 来分隔,为避免冲突,把文件的 "/" 全替换成 $
|
|
3707
|
+
*/
|
|
3708
|
+
create分类树(使用分类?: boolean, 使用文件?: boolean, 使用名称路径?: boolean): TreeRoot;
|
|
3709
|
+
/**
|
|
3710
|
+
* 按指定属性进行分类
|
|
3711
|
+
* @param 指定属性
|
|
3712
|
+
*/
|
|
3713
|
+
create属性树(指定属性: string): TreeRoot;
|
|
3714
|
+
/**
|
|
3715
|
+
* 用于复制文件时使用,不触发事件,不修改缓存
|
|
3716
|
+
* @param 配置
|
|
3717
|
+
* @param 新编号
|
|
3718
|
+
*/
|
|
3719
|
+
reset编号(配置: Config, 新编号: string): error;
|
|
3720
|
+
/**
|
|
3721
|
+
* 转换成保存到文件的对象
|
|
3722
|
+
*/
|
|
3723
|
+
to保存对象(): {
|
|
3724
|
+
[key: string]: any;
|
|
3725
|
+
};
|
|
3726
|
+
/**
|
|
3727
|
+
* 重置索引树
|
|
3728
|
+
*
|
|
3729
|
+
*/
|
|
3730
|
+
resetIndexTree(): TreeRoot;
|
|
3731
|
+
getParentLink(item: Config): string;
|
|
3732
|
+
/**
|
|
3733
|
+
* 重置索引树
|
|
3734
|
+
*
|
|
3735
|
+
*/
|
|
3736
|
+
static createIndexTree(dict: ConfigDict): TreeRoot;
|
|
3737
|
+
}
|
|
3738
|
+
declare class ClassConfigDict extends ConfigDict {
|
|
3739
|
+
constructor();
|
|
3740
|
+
getBy字符串(val: string): Config;
|
|
3741
|
+
getBy标识(val: string): Config;
|
|
3742
|
+
protected index标识: {};
|
|
3743
|
+
}
|
|
3744
|
+
|
|
3745
|
+
declare class ConfigRepo extends ConfigDict {
|
|
3746
|
+
constructor();
|
|
3747
|
+
dictBy文件(文件: string): ConfigDict;
|
|
3748
|
+
dictBy分类(分类: string): ClassConfigDict;
|
|
3749
|
+
dictBy类型(类型: string): ConfigDict;
|
|
3750
|
+
dictBy功能(功能: string): ConfigDict;
|
|
3751
|
+
get编号By字符串(val: string): string;
|
|
3752
|
+
/**
|
|
3753
|
+
* 格式: @分类#标识
|
|
3754
|
+
* @param val
|
|
3755
|
+
*/
|
|
3756
|
+
getBy字符串(val: string): Config;
|
|
3757
|
+
/**
|
|
3758
|
+
* 加载发布后的文件
|
|
3759
|
+
*/
|
|
3760
|
+
loadPublish(configMap: {
|
|
3761
|
+
[key: string]: any;
|
|
3762
|
+
}): void;
|
|
3763
|
+
loadByFile(file: string, contentObject: any): void;
|
|
3764
|
+
protected _loadByFile(file: string, contentObject: any): void;
|
|
3765
|
+
loadByFileMap(files: any): void;
|
|
3766
|
+
createBy父配置(父配置编号: string, 编号: string, 选项: {
|
|
3767
|
+
数据?: any;
|
|
3768
|
+
信息?: IConfigInfo;
|
|
3769
|
+
继承复制的对象?: boolean;
|
|
3770
|
+
}): Config;
|
|
3771
|
+
/**
|
|
3772
|
+
* @param 配置
|
|
3773
|
+
* @param enableDispatch
|
|
3774
|
+
* @see ConfigSet.EVENT_ADD
|
|
3775
|
+
*/
|
|
3776
|
+
add(配置: Config, enableDispatch?: boolean): error;
|
|
3777
|
+
removeDict(dict: ConfigDict, enableDispatch?: boolean): error;
|
|
3778
|
+
/**
|
|
3779
|
+
*
|
|
3780
|
+
* @param 编号
|
|
3781
|
+
* @param enableDispatch
|
|
3782
|
+
* @see ConfigSet.EVENT_DELETE
|
|
3783
|
+
*/
|
|
3784
|
+
remove(编号: string, enableDispatch?: boolean): error;
|
|
3785
|
+
removeBy文件(路径: string): void;
|
|
3786
|
+
reset文件(fromPath: any, toPath: string): void;
|
|
3787
|
+
/**
|
|
3788
|
+
*
|
|
3789
|
+
* 与setData一样, 但会派发 ConfigSet.EVENT_UPDATE
|
|
3790
|
+
* @param 配置
|
|
3791
|
+
* @param path
|
|
3792
|
+
* @param value
|
|
3793
|
+
*/
|
|
3794
|
+
set配置值(配置: Config, path: string, value: any): void;
|
|
3795
|
+
/**
|
|
3796
|
+
* 派发更新的消息
|
|
3797
|
+
* @param config
|
|
3798
|
+
*/
|
|
3799
|
+
dispatchUpdateByIdent(ident: string): void;
|
|
3800
|
+
/**
|
|
3801
|
+
* 派发更新的消息
|
|
3802
|
+
* @param config
|
|
3803
|
+
*/
|
|
3804
|
+
dispatchUpdate(config: Config): void;
|
|
3805
|
+
registerCascader(key: string, root: TreeRoot): void;
|
|
3806
|
+
getCascader(path: string): TreeRoot;
|
|
3807
|
+
get dispatcher(): EventManager;
|
|
3808
|
+
_cascader: {
|
|
3809
|
+
[key: string]: TreeRoot;
|
|
3810
|
+
};
|
|
3811
|
+
_dispatcher: EventManager;
|
|
3812
|
+
index_文件: Dictionary<string, ConfigDict>;
|
|
3813
|
+
index_分类: Dictionary<string, ClassConfigDict>;
|
|
3814
|
+
index_类型: Dictionary<string, ConfigDict>;
|
|
3815
|
+
index_功能: Dictionary<string, ConfigDict>;
|
|
3816
|
+
index_tree: TreeRoot;
|
|
3817
|
+
}
|
|
3818
|
+
declare const configRepo: ConfigRepo;
|
|
3819
|
+
|
|
3820
|
+
declare class ConfigEvent {
|
|
3821
|
+
/**
|
|
3822
|
+
* dispatchParams = {config:Config}
|
|
3823
|
+
*/
|
|
3824
|
+
static EVENT_ADD: string;
|
|
3825
|
+
/**
|
|
3826
|
+
* dispatchParams = {config:Config}
|
|
3827
|
+
*/
|
|
3828
|
+
static EVENT_DELETE: string;
|
|
3829
|
+
/**
|
|
3830
|
+
* dispatchParams = {config:Config}
|
|
3831
|
+
*/
|
|
3832
|
+
static EVENT_UPDATE: string;
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
declare class ConvertUtil {
|
|
3836
|
+
anyToBoolean(val: any, defaultValue?: boolean): boolean;
|
|
3837
|
+
anyToInt(val: any, defaultValue?: number): number;
|
|
3838
|
+
anyToFloat(val: any, defaultValue?: number): number;
|
|
3839
|
+
anyToString(val: any, defaultValue?: string): string;
|
|
3840
|
+
/**
|
|
3841
|
+
* 未定义的值转化成零值,否则返回原值
|
|
3842
|
+
* @param val
|
|
3843
|
+
* @param type
|
|
3844
|
+
*/
|
|
3845
|
+
undefinedToZero(val: any, type: string): any;
|
|
3846
|
+
}
|
|
3847
|
+
declare const convertutil: ConvertUtil;
|
|
3848
|
+
|
|
3849
|
+
declare class MapUtil {
|
|
3850
|
+
/**
|
|
3851
|
+
* 获取所欲的值
|
|
3852
|
+
*/
|
|
3853
|
+
values<T = any>(m: {
|
|
3854
|
+
[key: string]: T;
|
|
3855
|
+
}): T[];
|
|
3856
|
+
/**
|
|
3857
|
+
* 获取所有的键
|
|
3858
|
+
*/
|
|
3859
|
+
keys(m: {
|
|
3860
|
+
[key: string]: any;
|
|
3861
|
+
}): string[];
|
|
3862
|
+
/**
|
|
3863
|
+
* 以字符串数字作为键值的map,转化成数组
|
|
3864
|
+
*/
|
|
3865
|
+
toList<T = any>(m: {
|
|
3866
|
+
[key: string]: T;
|
|
3867
|
+
}): T[];
|
|
3868
|
+
/**
|
|
3869
|
+
* 以字符串数字作为键值的map,转化成数组
|
|
3870
|
+
*/
|
|
3871
|
+
listToMap(list: any[]): any;
|
|
3872
|
+
/**
|
|
3873
|
+
* 转换成数字, 如果原值无效, 返回0
|
|
3874
|
+
* @constructor
|
|
3875
|
+
*/
|
|
3876
|
+
has(m: any, key: string): boolean;
|
|
3877
|
+
/**
|
|
3878
|
+
* 转换成数字, 如果原值无效, 返回0
|
|
3879
|
+
* @constructor
|
|
3880
|
+
*/
|
|
3881
|
+
number(m: any, key: string, dflt?: number): number;
|
|
3882
|
+
/**
|
|
3883
|
+
* 转换成字符串, 如果原值无效, 返回""
|
|
3884
|
+
* @constructor
|
|
3885
|
+
*/
|
|
3886
|
+
string(m: any, key: string, dflt?: string): string;
|
|
3887
|
+
/**
|
|
3888
|
+
* 转换成布尔值, 如果原值无效, 返回false
|
|
3889
|
+
* @constructor
|
|
3890
|
+
*/
|
|
3891
|
+
boolean(m: any, key: string, dflt?: boolean): boolean;
|
|
3892
|
+
/**
|
|
3893
|
+
* 转换成{}, 如果原值无效, 返回{}
|
|
3894
|
+
* @constructor
|
|
3895
|
+
*/
|
|
3896
|
+
map(m: any, key: string, dflt?: boolean | Object): any;
|
|
3897
|
+
/**
|
|
3898
|
+
* 转换成[], 如果原值无效, 返回[]
|
|
3899
|
+
* @constructor
|
|
3900
|
+
*/
|
|
3901
|
+
array(m: any, key: string, dflt?: boolean | Array<any>): any[];
|
|
3902
|
+
/**
|
|
3903
|
+
* 返回第一个符合条件的key
|
|
3904
|
+
* @param m
|
|
3905
|
+
* @param conf
|
|
3906
|
+
*/
|
|
3907
|
+
keyOfConf(m: any, conf: (key: string, item: any) => boolean): string;
|
|
3908
|
+
/**
|
|
3909
|
+
* 比较对象,并返回包含差异的对象
|
|
3910
|
+
* 如果返回 undefined 表示没有差异
|
|
3911
|
+
* @param obj
|
|
3912
|
+
* @param parent
|
|
3913
|
+
* @param removeDefault
|
|
3914
|
+
*/
|
|
3915
|
+
diff(obj: any, parent: any, removeDefault?: boolean): any;
|
|
3916
|
+
/**
|
|
3917
|
+
* 克隆对象
|
|
3918
|
+
* @param obj
|
|
3919
|
+
*/
|
|
3920
|
+
clone(obj: any): any;
|
|
3921
|
+
/**
|
|
3922
|
+
* 通过path设置属性,创建不存在的路径对象
|
|
3923
|
+
* @param obj
|
|
3924
|
+
* @param path "/key1/key2"
|
|
3925
|
+
* @param data
|
|
3926
|
+
*/
|
|
3927
|
+
setByPath(obj: any, path: string, data: any): void;
|
|
3928
|
+
/**
|
|
3929
|
+
* 通过path删除
|
|
3930
|
+
* @param obj
|
|
3931
|
+
* @param path "/key1/key2"
|
|
3932
|
+
*/
|
|
3933
|
+
removeByPath(obj: any, path: string): void;
|
|
3934
|
+
/**
|
|
3935
|
+
* 通过path获取属性
|
|
3936
|
+
* @param obj
|
|
3937
|
+
* @param path
|
|
3938
|
+
*/
|
|
3939
|
+
getByPath(obj: any, path: string): any;
|
|
3940
|
+
flat(obj: any, split?: string): any;
|
|
3941
|
+
_flat(obj: any, result: any, path: string, split?: string): any;
|
|
3942
|
+
/**
|
|
3943
|
+
* 比较两个对象,包括基础类型
|
|
3944
|
+
* @param a
|
|
3945
|
+
* @param b
|
|
3946
|
+
*/
|
|
3947
|
+
compare(a: any, b: any): boolean;
|
|
3948
|
+
/**
|
|
3949
|
+
* 从[from]对象复制到 [to]对象
|
|
3950
|
+
* 如果from字段为object并且等于null,则设置to字段为null
|
|
3951
|
+
* 如果from字段为undefined, 则不覆盖
|
|
3952
|
+
* @param from
|
|
3953
|
+
* @param to
|
|
3954
|
+
* @param tokey 如果[to]存在key才进行拷贝
|
|
3955
|
+
*/
|
|
3956
|
+
copy(from: any, to: any, tokey?: boolean): void;
|
|
3957
|
+
/**
|
|
3958
|
+
* 去掉兼职
|
|
3959
|
+
*/
|
|
3960
|
+
flatString(target: any): string;
|
|
3961
|
+
}
|
|
3962
|
+
declare const maputil: MapUtil;
|
|
3963
|
+
|
|
3964
|
+
declare class UIUtil {
|
|
3965
|
+
/**
|
|
3966
|
+
* 格式化节点的uuid,用于树结构
|
|
3967
|
+
* 树结构的路径的反斜杠与uuid有冲突
|
|
3968
|
+
* @param uuid
|
|
3969
|
+
*/
|
|
3970
|
+
formatUUIDForTree(uuid: string): string;
|
|
3971
|
+
/**
|
|
3972
|
+
* x, y 使用 鼠标点击事件产生的 event.getLocation()坐标
|
|
3973
|
+
* @param target
|
|
3974
|
+
* @param x
|
|
3975
|
+
* @param y
|
|
3976
|
+
*/
|
|
3977
|
+
hitTest(target: Node, x: number, y: number): boolean;
|
|
3978
|
+
findNode(node: Node, name: string): Node;
|
|
3979
|
+
walk(node: Node, f: (target: Node) => boolean): void;
|
|
3980
|
+
_walk(node: Node, f: (target: Node) => boolean): boolean;
|
|
3981
|
+
}
|
|
3982
|
+
declare const uiutil: UIUtil;
|
|
3983
|
+
|
|
3984
|
+
declare class EventUtil {
|
|
3985
|
+
}
|
|
3986
|
+
/**
|
|
3987
|
+
* 框架的事件
|
|
3988
|
+
*/
|
|
3989
|
+
declare const eventutil: EventUtil;
|
|
3990
|
+
|
|
3991
|
+
declare class NetUtil {
|
|
3992
|
+
decodeLocationSearch(search: string): any;
|
|
3993
|
+
encodeLocationSearch(params: any, firstChat?: "" | "?" | "&"): string;
|
|
3994
|
+
getLocation(): Location;
|
|
3995
|
+
/**
|
|
3996
|
+
* 获取Loation的参数
|
|
3997
|
+
*/
|
|
3998
|
+
getLocationParams(): any;
|
|
3999
|
+
}
|
|
4000
|
+
declare const netutil: NetUtil;
|
|
4001
|
+
|
|
4002
|
+
declare class ArrayUtil {
|
|
4003
|
+
lastItem(array: any[]): any;
|
|
4004
|
+
unique(array: any[]): any[];
|
|
4005
|
+
removeSelf(arr: any[], item: any): void;
|
|
4006
|
+
/**
|
|
4007
|
+
*
|
|
4008
|
+
* @param arr
|
|
4009
|
+
* @param desc 降序
|
|
4010
|
+
*/
|
|
4011
|
+
sortNumber(arr: any[], desc?: boolean): any[];
|
|
4012
|
+
sortString(arr: any[], desc?: boolean): any[];
|
|
4013
|
+
getByPath(target: any, key: string): any;
|
|
4014
|
+
sortObject(arr: any[], desc: boolean, ...paths: string[]): any[];
|
|
4015
|
+
sortBySeq(arr: any[], desc: boolean, seq: {
|
|
4016
|
+
[key: string]: number;
|
|
4017
|
+
}, key?: string): any[];
|
|
4018
|
+
indexOfConf(arr: any[], caller: any, f: (item: any) => boolean): number;
|
|
4019
|
+
}
|
|
4020
|
+
declare const arrayutil: ArrayUtil;
|
|
4021
|
+
|
|
4022
|
+
declare class ScaleUtil {
|
|
4023
|
+
tenToAny: string[];
|
|
4024
|
+
allstr: string;
|
|
4025
|
+
randString(size: number, n: number): string;
|
|
4026
|
+
decimalTo(num: number, n: number): string;
|
|
4027
|
+
findkey(instr: string): number;
|
|
4028
|
+
toDecimal(num: string, n: number): number;
|
|
4029
|
+
}
|
|
4030
|
+
declare const scaleutil: ScaleUtil;
|
|
4031
|
+
|
|
4032
|
+
declare class BitUtil {
|
|
4033
|
+
getState(state: number, key: number): boolean;
|
|
4034
|
+
setState(state: number, key: number, value: boolean): number;
|
|
4035
|
+
/**
|
|
4036
|
+
* @param state
|
|
4037
|
+
* @param key
|
|
4038
|
+
*/
|
|
4039
|
+
getStateBig(state: bigint, key: bigint): boolean;
|
|
4040
|
+
setStateBig(state: bigint, key: bigint, value: boolean): bigint;
|
|
4041
|
+
/**
|
|
4042
|
+
* key从0开始
|
|
4043
|
+
* @param val
|
|
4044
|
+
*/
|
|
4045
|
+
convertToState(val: {
|
|
4046
|
+
[key: string]: boolean;
|
|
4047
|
+
}): number;
|
|
4048
|
+
/**
|
|
4049
|
+
* 判断是否匹配
|
|
4050
|
+
* @param target
|
|
4051
|
+
* @param match 0-返回true
|
|
4052
|
+
*/
|
|
4053
|
+
match(target: number, match: number): boolean;
|
|
4054
|
+
}
|
|
4055
|
+
declare const bitutil: BitUtil;
|
|
4056
|
+
|
|
4057
|
+
declare class StringUtil {
|
|
4058
|
+
lowerFirst(key: string): string;
|
|
4059
|
+
upperFirst(key: string): string;
|
|
4060
|
+
cjkEncode(text: any): string;
|
|
4061
|
+
replaceFormat(format: string, source: any): string;
|
|
4062
|
+
/**
|
|
4063
|
+
*
|
|
4064
|
+
* @param format
|
|
4065
|
+
* @param source
|
|
4066
|
+
*/
|
|
4067
|
+
evalFormat(format: string, source: any): string;
|
|
4068
|
+
splitLast(val: string, separator: string): string;
|
|
4069
|
+
/**
|
|
4070
|
+
* 从最后一个分隔符截断字符串,返回截断的左右字符串
|
|
4071
|
+
* @param val
|
|
4072
|
+
* @param separator
|
|
4073
|
+
*/
|
|
4074
|
+
splitLastArray(val: string, separator: string): [string, string];
|
|
4075
|
+
/**
|
|
4076
|
+
* 截断字符串
|
|
4077
|
+
* @param val
|
|
4078
|
+
* @param separator
|
|
4079
|
+
* @return [最终的字符串, 被截断的字符串]
|
|
4080
|
+
*/
|
|
4081
|
+
truncateLast(val: string, separator: string): [string, string];
|
|
4082
|
+
fill(str: string, char: string, length: number): string;
|
|
4083
|
+
}
|
|
4084
|
+
declare const stringutil: StringUtil;
|
|
4085
|
+
|
|
4086
|
+
declare class IdentUtil {
|
|
4087
|
+
/**
|
|
4088
|
+
* 设置时间的基线,通过减去已经过去的时间,可缩短id长度
|
|
4089
|
+
* 注:同一个项目必须拥有同样的基线,否则有几率出现相同的id!
|
|
4090
|
+
* 注2:基线必须与精度符合
|
|
4091
|
+
* @param time
|
|
4092
|
+
*/
|
|
4093
|
+
setTimeBaseline(time: number): void;
|
|
4094
|
+
protected _baseline: number;
|
|
4095
|
+
/**
|
|
4096
|
+
* 设置时间的精度
|
|
4097
|
+
* @param precision
|
|
4098
|
+
*/
|
|
4099
|
+
setTimePrecision(precision: "ms" | "s"): void;
|
|
4100
|
+
protected _precision: string;
|
|
4101
|
+
/**
|
|
4102
|
+
* 设置随机数的长度
|
|
4103
|
+
* @param value
|
|
4104
|
+
*/
|
|
4105
|
+
setRandLength(value?: number): void;
|
|
4106
|
+
protected _randLength: number;
|
|
4107
|
+
genOne(): string;
|
|
4108
|
+
protected _count: number;
|
|
4109
|
+
protected _lastTime: number;
|
|
4110
|
+
}
|
|
4111
|
+
declare const identutil: IdentUtil;
|
|
4112
|
+
|
|
4113
|
+
declare class RandUtil {
|
|
4114
|
+
/**
|
|
4115
|
+
* 根据权重随机并返回其中的一个键值
|
|
4116
|
+
* // key = 键, val=权重
|
|
4117
|
+
* @param source
|
|
4118
|
+
* @return source的其中一个key
|
|
4119
|
+
*/
|
|
4120
|
+
weight(source: {
|
|
4121
|
+
[key: string]: number;
|
|
4122
|
+
}): string;
|
|
4123
|
+
/**
|
|
4124
|
+
* [0, val]
|
|
4125
|
+
* @param val
|
|
4126
|
+
*/
|
|
4127
|
+
intn(val: number): number;
|
|
4128
|
+
/**
|
|
4129
|
+
* [min, max)
|
|
4130
|
+
* @param min
|
|
4131
|
+
* @param max
|
|
4132
|
+
*/
|
|
4133
|
+
range(min: number, max: number): number;
|
|
4134
|
+
/**
|
|
4135
|
+
* 在arr中随机返回【count】个元素
|
|
4136
|
+
* @param arr
|
|
4137
|
+
* @param count
|
|
4138
|
+
*/
|
|
4139
|
+
countOfArray(arr: any[], count: number): any[];
|
|
4140
|
+
}
|
|
4141
|
+
declare const randutil: RandUtil;
|
|
4142
|
+
|
|
4143
|
+
declare class MathUtil {
|
|
4144
|
+
version: number;
|
|
4145
|
+
TempVec2: Vec2;
|
|
4146
|
+
TempVec3: Vec3;
|
|
4147
|
+
TempVec4: Vec4;
|
|
4148
|
+
convertVec2to3(vec2: Vec2, useTemp?: boolean): Vec3;
|
|
4149
|
+
convertVec3to2(vec3: Vec3, useTemp?: boolean): Vec2;
|
|
4150
|
+
isOdd(value: number): boolean;
|
|
4151
|
+
}
|
|
4152
|
+
declare const mathutil: MathUtil;
|
|
4153
|
+
|
|
4154
|
+
declare class ResUtil {
|
|
4155
|
+
loadResource(path: string): Promise<[any, error]>;
|
|
4156
|
+
preloadResource(path: string): Promise<[any, error]>;
|
|
4157
|
+
loadBubble(bundle: string): Promise<[AssetManager.Bundle, error]>;
|
|
4158
|
+
loadBubbleItem(bubble: AssetManager.Bundle, path: string, type: any): Promise<[any, error]>;
|
|
4159
|
+
loadAtlas(path: string): Promise<[SpriteAtlas, error]>;
|
|
4160
|
+
getByPath(path: string, type: any): any;
|
|
4161
|
+
loadByPath(path: string, type: any): Promise<[any, error]>;
|
|
4162
|
+
loadByPathCallback(path: string, type: any, callback: (any: any, error: any) => void): void;
|
|
4163
|
+
}
|
|
4164
|
+
declare var resutil: ResUtil;
|
|
4165
|
+
|
|
4166
|
+
declare class TimeUtil {
|
|
4167
|
+
sleep(time: number): Promise<void>;
|
|
4168
|
+
/**
|
|
4169
|
+
* @param {Number} timeStamp eg:1551323702241
|
|
4170
|
+
* @param {String} formatter eg:yyyy-MM-dd yyyy/MM/dd yyyy-M-d yyyy/M/d yyyy-MM-dd hh:mm:ss
|
|
4171
|
+
* */
|
|
4172
|
+
format(timeStamp: number, formatter: string): string;
|
|
4173
|
+
/**
|
|
4174
|
+
* @param {Number,String} para
|
|
4175
|
+
* @return {String,Number}
|
|
4176
|
+
* */
|
|
4177
|
+
protected handleDouble(para: any): string;
|
|
4178
|
+
formatLeave(time: number, formatter: string): string;
|
|
4179
|
+
}
|
|
4180
|
+
declare const timeutil: TimeUtil;
|
|
4181
|
+
|
|
4182
|
+
declare enum GeometryDirection {
|
|
4183
|
+
East = 0,
|
|
4184
|
+
SouthEast = 1,
|
|
4185
|
+
South = 2,
|
|
4186
|
+
SouthWest = 3,
|
|
4187
|
+
West = 4,
|
|
4188
|
+
NorthWest = 5,
|
|
4189
|
+
North = 6,
|
|
4190
|
+
NorthEast = 7
|
|
4191
|
+
}
|
|
4192
|
+
declare class GeometryUtil {
|
|
4193
|
+
/**
|
|
4194
|
+
* mode,8表示八方向,2表示二方向(左右),4表示4方向
|
|
4195
|
+
* @param dot
|
|
4196
|
+
* @param mode
|
|
4197
|
+
*/
|
|
4198
|
+
angleToDirection(dot: number, mode?: number): GeometryDirection;
|
|
4199
|
+
}
|
|
4200
|
+
declare let geoutil: GeometryUtil;
|
|
4201
|
+
|
|
4202
|
+
declare namespace formatutil {
|
|
4203
|
+
/**
|
|
4204
|
+
* 格式化数字
|
|
4205
|
+
* @param format 第nn天
|
|
4206
|
+
* @param val
|
|
4207
|
+
*/
|
|
4208
|
+
function toChinese(formatter: string, val: number): string;
|
|
4209
|
+
/**
|
|
4210
|
+
* 转换为 x亿x万
|
|
4211
|
+
* @param val
|
|
4212
|
+
*/
|
|
4213
|
+
function format数字使用万亿(val: number | string): string;
|
|
4214
|
+
/**
|
|
4215
|
+
* 格式化货币,每N位增加一个逗号识别
|
|
4216
|
+
* @param val
|
|
4217
|
+
* @param N
|
|
4218
|
+
*/
|
|
4219
|
+
function format数字使用逗号(val: number | string, N?: number): string;
|
|
4220
|
+
}
|
|
4221
|
+
|
|
4222
|
+
declare class FloatUtil {
|
|
4223
|
+
epsilon: number;
|
|
4224
|
+
neq(a: number, b: number, threshold?: number): boolean;
|
|
4225
|
+
eq(a: number, b: number, threshold?: number): boolean;
|
|
4226
|
+
gt(a: number, b: number, threshold?: number): boolean;
|
|
4227
|
+
lt(a: number, b: number, threshold?: number): boolean;
|
|
4228
|
+
geq(a: number, b: number, threshold?: number): boolean;
|
|
4229
|
+
leq(a: number, b: number, threshold?: number): boolean;
|
|
4230
|
+
}
|
|
4231
|
+
declare let floatutil: FloatUtil;
|
|
4232
|
+
|
|
4233
|
+
declare class PathUtil {
|
|
4234
|
+
getDir(path: string): string;
|
|
4235
|
+
getRelativePath(fromPath: string, toPath: string): string;
|
|
4236
|
+
getSamePath(fromPath: string, toPath: string): string;
|
|
4237
|
+
protected validatePath(path: string): void;
|
|
4238
|
+
protected splitPath(path: string): string[];
|
|
4239
|
+
}
|
|
4240
|
+
declare const pathutil: PathUtil;
|
|
4241
|
+
|
|
4242
|
+
declare function parsePlist(plist: any, texture: any): SpriteAtlas;
|
|
4243
|
+
declare function loadAtlas(url: any, callback: any): void;
|
|
4244
|
+
|
|
4245
|
+
declare class DebugManager {
|
|
4246
|
+
constructor();
|
|
4247
|
+
}
|
|
4248
|
+
declare const debugmgr: DebugManager;
|
|
4249
|
+
|
|
4250
|
+
declare enum LogLevel {
|
|
4251
|
+
DEBUG = 0,
|
|
4252
|
+
INFO = 1,
|
|
4253
|
+
WARNING = 2,
|
|
4254
|
+
ERROR = 3
|
|
4255
|
+
}
|
|
4256
|
+
declare class Logger {
|
|
4257
|
+
name: string;
|
|
4258
|
+
level: LogLevel;
|
|
4259
|
+
ignoreRegexp: any[];
|
|
4260
|
+
ignoreString: any[];
|
|
4261
|
+
protected _enable: boolean;
|
|
4262
|
+
disable(): void;
|
|
4263
|
+
canLogByLevel(level: LogLevel): boolean;
|
|
4264
|
+
canLog(msg: string, level: LogLevel): boolean;
|
|
4265
|
+
debug(msg: string, ...data: any[]): void;
|
|
4266
|
+
info(msg: string, ...data: any[]): void;
|
|
4267
|
+
infof(msgCreator: () => string): void;
|
|
4268
|
+
warning(msg: string, ...data: any[]): void;
|
|
4269
|
+
error(msg: string, ...data: any[]): void;
|
|
4270
|
+
}
|
|
4271
|
+
|
|
4272
|
+
declare const LOGGER_EVENT = "Event";
|
|
4273
|
+
declare class LogManager {
|
|
4274
|
+
/**
|
|
4275
|
+
* 获取事件的日志管理
|
|
4276
|
+
* 日志的group为事件类型
|
|
4277
|
+
*/
|
|
4278
|
+
getEventLogger(): Logger;
|
|
4279
|
+
/**
|
|
4280
|
+
* 获取日志管理
|
|
4281
|
+
*/
|
|
4282
|
+
getLogger(name: string): Logger;
|
|
4283
|
+
protected _loggers: {};
|
|
4284
|
+
/**
|
|
4285
|
+
* 是否开启日志
|
|
4286
|
+
*/
|
|
4287
|
+
enable: boolean;
|
|
4288
|
+
protected ignores: any[];
|
|
4289
|
+
/**
|
|
4290
|
+
* 忽视包含指定字符串的日志
|
|
4291
|
+
* @param val
|
|
4292
|
+
*/
|
|
4293
|
+
ignoreString(val: string): void;
|
|
4294
|
+
/**
|
|
4295
|
+
* 取消指定的日志
|
|
4296
|
+
* @param val
|
|
4297
|
+
*/
|
|
4298
|
+
ignoreStringCancel(val: string): void;
|
|
4299
|
+
/**
|
|
4300
|
+
* 是否可以输出日志
|
|
4301
|
+
* @param type
|
|
4302
|
+
* @private
|
|
4303
|
+
*/
|
|
4304
|
+
canLog(type: string): boolean;
|
|
4305
|
+
disableSystemConsole(): void;
|
|
4306
|
+
}
|
|
4307
|
+
declare const logmgr: LogManager;
|
|
4308
|
+
|
|
4309
|
+
interface CommandInfo {
|
|
4310
|
+
/**
|
|
4311
|
+
* 默认的
|
|
4312
|
+
*/
|
|
4313
|
+
caller?: any;
|
|
4314
|
+
name: string;
|
|
4315
|
+
handler: Function;
|
|
4316
|
+
group?: string;
|
|
4317
|
+
global: boolean;
|
|
4318
|
+
}
|
|
4319
|
+
declare class CommandManager extends EventManager {
|
|
4320
|
+
protected _infos: any[];
|
|
4321
|
+
register(info: CommandInfo): void;
|
|
4322
|
+
execute(name: string, ...args: any): any;
|
|
4323
|
+
removeGroup(group: string): void;
|
|
4324
|
+
}
|
|
4325
|
+
declare const cmdmgr: CommandManager;
|
|
4326
|
+
|
|
4327
|
+
declare class XDate extends Date {
|
|
4328
|
+
static parseString(val: string): XDate;
|
|
4329
|
+
add(year?: number, month?: number, date?: number, hour?: number, minute?: number, second?: number): XDate;
|
|
4330
|
+
/**
|
|
4331
|
+
* 获取当月总共天数函数
|
|
4332
|
+
*/
|
|
4333
|
+
getMonthDay(): number;
|
|
4334
|
+
getQuarter(): number;
|
|
4335
|
+
startOfYear(): XDate;
|
|
4336
|
+
endOfYear(): XDate;
|
|
4337
|
+
startOfQuarter(): XDate;
|
|
4338
|
+
endOfQuarter(): XDate;
|
|
4339
|
+
startOfMonth(): XDate;
|
|
4340
|
+
endOfMonth(): XDate;
|
|
4341
|
+
startOfWeek(): XDate;
|
|
4342
|
+
endOfWeek(): XDate;
|
|
4343
|
+
startOfDay(): XDate;
|
|
4344
|
+
endOfDay(): XDate;
|
|
4345
|
+
startOfHour(): XDate;
|
|
4346
|
+
endOfHour(): XDate;
|
|
4347
|
+
startOfMinute(): XDate;
|
|
4348
|
+
endOfMinute(): XDate;
|
|
4349
|
+
startOfSecond(): XDate;
|
|
4350
|
+
endOfSecond(): XDate;
|
|
4351
|
+
clone(): XDate;
|
|
4352
|
+
}
|
|
4353
|
+
|
|
4354
|
+
export { ArrayUtil, BitUtil, ByteArray, ByteDecoder, CacheModifyMode, CacheObject, CacheObjectEvent, CallbackList, Caller, ClassConfigDict, ClickEvent, CommandManager, CommandProtocol, Config, ConfigDict, ConfigEvent, ConfigManager, ConfigRepo, ConfigSet, ConfigSetEvent, ConfigSetEventSub, ConnectState, Controller, ControllerDict, ControllerSet, ConvertUtil, CreateProtocol, DBAction, DBEvent, DataDispatchParams, DataManager, DataTableAloneConfig, DataTableConfig, DebugManager, DeleteProtocol, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, Endian, EndianConst, ErrorUtil, EventItem, EventManager, EventProtocol, EventUtil, Factory, FloatUtil, FrameEvent, FrameWebSocket, GeometryUtil, HttpMethod, HttpRequest, HttpResponseType, IDataTableConfig, IdentUtil, LOGGER_EVENT, LSKeys, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapDecoder, MapUtil, MathUtil, Model, Module, NetHttp, NetIdent, NetManager, NetSocket, NetSub, NetUtil, NodeEvent, Page, PageController, PageEvent, PageLayer, PageList, PageRepo, PageState, PathUtil, Pool, PoolSet, PushProtocol, PushTag, RandUtil, RequestProtocol, ResponseEvent, ResponseProtocol, ResponseSub, Route, SamplePool, SamplePoolSet, ScaleUtil, SchemaManager, SchemaNodeToValue, SchemaTreeRootCreator, SchemaValueToJson, SerializeMode, SimpleModel, SimpleModify, StringUtil, SyncHandler, TimeUtil, TimerEvent, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, Trigger, TriggerEvent, TriggerManager, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, UpdateProtocol, ValidState, ViewController, WaitEvent, WebSocketType, XDate, XEvent, arrayutil, bitutil, cachex, cmdmgr, configRepo, configmgr, convertutil, ctrlrepo, datamgr, debugmgr, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, getClassCreator, identutil, loadAtlas, logmgr, maputil, mathutil, netmgr, netutil, newCacheObject, newObjectByType, pagerepo, parseData, parsePlist, pathutil, randutil, receiveData, resutil, scaleutil, schemamgr, setClassCreator, stringutil, timer, timeutil, triggermgr, uidict, uimgr, uiutil };
|
|
4355
|
+
export type { CommandInfo, CreatorFunction, DataTableItemConfig, DisposeFunction, ICacheObject, IConfigInfo, IController, IDBEventDispatchParams, IDBObject, IDBOnCreate, IDBOnRemove, IDBOnUpdate, IDBTable, IDatabase, IEventManager, IExtend, IListItem, IModel, IModify, IModule, IModuleSample, IRefValue, ISchemaTreeNode, ISchemaType, ITreeListItem, ITriggerEvent, RecycleFunction, error };
|