@zhongguo168a/yxeditor-common 0.0.131 → 0.0.133
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/dist/index.esm.js +377 -246
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -55,6 +55,9 @@ const netutil = new NetUtil();
|
|
|
55
55
|
* err1 <argA=val&argB=val>
|
|
56
56
|
*/
|
|
57
57
|
class LinkError {
|
|
58
|
+
next;
|
|
59
|
+
ident;
|
|
60
|
+
args;
|
|
58
61
|
/**
|
|
59
62
|
* 判断当前错误是否 cancel 错误
|
|
60
63
|
*/
|
|
@@ -145,6 +148,15 @@ const errorutil = new ErrorUtil();
|
|
|
145
148
|
* 单例的UI对象
|
|
146
149
|
*/
|
|
147
150
|
class UISingleConfig {
|
|
151
|
+
/**
|
|
152
|
+
* 创建函数
|
|
153
|
+
*/
|
|
154
|
+
creator;
|
|
155
|
+
/**
|
|
156
|
+
* 指定键值
|
|
157
|
+
* 可通过键值获得 ui对象
|
|
158
|
+
*/
|
|
159
|
+
name;
|
|
148
160
|
constructor({ name, creator, }) {
|
|
149
161
|
this.name = name;
|
|
150
162
|
this.creator = creator;
|
|
@@ -154,11 +166,21 @@ class UISingleConfig {
|
|
|
154
166
|
* 单例的UI对象
|
|
155
167
|
*/
|
|
156
168
|
class UIPoolConfig {
|
|
169
|
+
/**
|
|
170
|
+
* 创建函数
|
|
171
|
+
* 对象需要实现recycle方法
|
|
172
|
+
*/
|
|
173
|
+
creator;
|
|
174
|
+
/**
|
|
175
|
+
* 指定键值
|
|
176
|
+
* 可通过键值获得 ui对象
|
|
177
|
+
*/
|
|
178
|
+
name;
|
|
179
|
+
/**
|
|
180
|
+
* 过期帧数,默认为永不过期(0)
|
|
181
|
+
*/
|
|
182
|
+
expired = 0;
|
|
157
183
|
constructor({ name, creator, expired = 0, }) {
|
|
158
|
-
/**
|
|
159
|
-
* 过期帧数,默认为永不过期(0)
|
|
160
|
-
*/
|
|
161
|
-
this.expired = 0;
|
|
162
184
|
this.name = name;
|
|
163
185
|
this.creator = creator;
|
|
164
186
|
this.expired = expired;
|
|
@@ -174,17 +196,17 @@ class UIPoolConfig {
|
|
|
174
196
|
* 需要注册
|
|
175
197
|
*/
|
|
176
198
|
class UIManager {
|
|
199
|
+
/**
|
|
200
|
+
* ui单例对象缓存数量的最大值
|
|
201
|
+
*/
|
|
202
|
+
singleObjectMax = 0;
|
|
203
|
+
singleObjs = {};
|
|
204
|
+
singleList = [];
|
|
205
|
+
singleCounts = {};
|
|
206
|
+
singleConfigs = {};
|
|
207
|
+
pools = {};
|
|
208
|
+
poolConfig = {};
|
|
177
209
|
constructor() {
|
|
178
|
-
/**
|
|
179
|
-
* ui单例对象缓存数量的最大值
|
|
180
|
-
*/
|
|
181
|
-
this.singleObjectMax = 0;
|
|
182
|
-
this.singleObjs = {};
|
|
183
|
-
this.singleList = [];
|
|
184
|
-
this.singleCounts = {};
|
|
185
|
-
this.singleConfigs = {};
|
|
186
|
-
this.pools = {};
|
|
187
|
-
this.poolConfig = {};
|
|
188
210
|
}
|
|
189
211
|
/**
|
|
190
212
|
* 注册一个ui对象配置
|
|
@@ -359,6 +381,7 @@ class Timer {
|
|
|
359
381
|
get scheduler() {
|
|
360
382
|
return this._scheduler;
|
|
361
383
|
}
|
|
384
|
+
_scheduler;
|
|
362
385
|
constructor() {
|
|
363
386
|
this._scheduler = director.getScheduler();
|
|
364
387
|
}
|
|
@@ -430,22 +453,6 @@ class Timer {
|
|
|
430
453
|
const timer = new Timer();
|
|
431
454
|
|
|
432
455
|
class EventItem {
|
|
433
|
-
constructor() {
|
|
434
|
-
/**
|
|
435
|
-
* 事件类型
|
|
436
|
-
*/
|
|
437
|
-
this.type = "";
|
|
438
|
-
/**
|
|
439
|
-
* 子事件
|
|
440
|
-
* 如果sub == "" 或者 sub == "*", 则不需要检查sub值
|
|
441
|
-
*/
|
|
442
|
-
this.sub = "";
|
|
443
|
-
/**
|
|
444
|
-
* 子事件2
|
|
445
|
-
* 如果sub == "" 或者 sub == "*", 则不需要检查sub值
|
|
446
|
-
*/
|
|
447
|
-
this.sub2 = "";
|
|
448
|
-
}
|
|
449
456
|
recycle() {
|
|
450
457
|
this.listener = null;
|
|
451
458
|
this.type = "";
|
|
@@ -460,12 +467,54 @@ class EventItem {
|
|
|
460
467
|
dispatch(event) {
|
|
461
468
|
this.listener.call(this.caller, event, event.dispatchParams);
|
|
462
469
|
}
|
|
470
|
+
listener;
|
|
471
|
+
caller;
|
|
472
|
+
/**
|
|
473
|
+
* 事件类型
|
|
474
|
+
*/
|
|
475
|
+
type = "";
|
|
476
|
+
/**
|
|
477
|
+
* 子事件
|
|
478
|
+
* 如果sub == "" 或者 sub == "*", 则不需要检查sub值
|
|
479
|
+
*/
|
|
480
|
+
sub = "";
|
|
481
|
+
/**
|
|
482
|
+
* 子事件2
|
|
483
|
+
* 如果sub == "" 或者 sub == "*", 则不需要检查sub值
|
|
484
|
+
*/
|
|
485
|
+
sub2 = "";
|
|
486
|
+
args;
|
|
487
|
+
once;
|
|
463
488
|
}
|
|
464
489
|
|
|
465
490
|
/**
|
|
466
491
|
* 事件
|
|
467
492
|
*/
|
|
468
493
|
class XEvent {
|
|
494
|
+
/**
|
|
495
|
+
*
|
|
496
|
+
*/
|
|
497
|
+
dispatcher;
|
|
498
|
+
/**
|
|
499
|
+
* 子事件
|
|
500
|
+
*/
|
|
501
|
+
sub;
|
|
502
|
+
/**
|
|
503
|
+
* 子事件
|
|
504
|
+
*/
|
|
505
|
+
sub2;
|
|
506
|
+
/**
|
|
507
|
+
* 事件
|
|
508
|
+
*/
|
|
509
|
+
type;
|
|
510
|
+
/**
|
|
511
|
+
* 监听时传递的参数
|
|
512
|
+
*/
|
|
513
|
+
onParams;
|
|
514
|
+
/**
|
|
515
|
+
* 触发时传递的参数
|
|
516
|
+
*/
|
|
517
|
+
dispatchParams;
|
|
469
518
|
toString() {
|
|
470
519
|
return `Event[${this.type} + "." + ${this.sub}]`;
|
|
471
520
|
}
|
|
@@ -500,11 +549,11 @@ var LogLevel;
|
|
|
500
549
|
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
501
550
|
})(LogLevel || (LogLevel = {}));
|
|
502
551
|
class Logger {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
552
|
+
name;
|
|
553
|
+
level;
|
|
554
|
+
ignoreRegexp = [];
|
|
555
|
+
ignoreString = [];
|
|
556
|
+
_enable = true;
|
|
508
557
|
disable() {
|
|
509
558
|
this._enable = false;
|
|
510
559
|
}
|
|
@@ -579,15 +628,6 @@ class Logger {
|
|
|
579
628
|
|
|
580
629
|
const LOGGER_EVENT = "Event";
|
|
581
630
|
class LogManager {
|
|
582
|
-
constructor() {
|
|
583
|
-
this._loggers = {};
|
|
584
|
-
/**
|
|
585
|
-
* 是否开启日志
|
|
586
|
-
*/
|
|
587
|
-
this.enable = true;
|
|
588
|
-
// 忽视输出的日志
|
|
589
|
-
this.ignores = [];
|
|
590
|
-
}
|
|
591
631
|
/**
|
|
592
632
|
* 获取事件的日志管理
|
|
593
633
|
* 日志的group为事件类型
|
|
@@ -608,6 +648,13 @@ class LogManager {
|
|
|
608
648
|
}
|
|
609
649
|
return l;
|
|
610
650
|
}
|
|
651
|
+
_loggers = {};
|
|
652
|
+
/**
|
|
653
|
+
* 是否开启日志
|
|
654
|
+
*/
|
|
655
|
+
enable = true;
|
|
656
|
+
// 忽视输出的日志
|
|
657
|
+
ignores = [];
|
|
611
658
|
/**
|
|
612
659
|
* 忽视包含指定字符串的日志
|
|
613
660
|
* @param val
|
|
@@ -660,8 +707,12 @@ const logmgr = new LogManager();
|
|
|
660
707
|
* 对象池
|
|
661
708
|
*/
|
|
662
709
|
class Pool {
|
|
710
|
+
creatorFunction;
|
|
711
|
+
recycleFunction;
|
|
712
|
+
disposeFunction;
|
|
713
|
+
name = "";
|
|
714
|
+
list;
|
|
663
715
|
constructor(config) {
|
|
664
|
-
this.name = "";
|
|
665
716
|
if (!config) {
|
|
666
717
|
throw new Error("需要设置config");
|
|
667
718
|
}
|
|
@@ -720,6 +771,7 @@ class Pool {
|
|
|
720
771
|
* 对象池
|
|
721
772
|
*/
|
|
722
773
|
class SamplePool {
|
|
774
|
+
list;
|
|
723
775
|
constructor() {
|
|
724
776
|
this.list = [];
|
|
725
777
|
}
|
|
@@ -747,9 +799,6 @@ class SamplePool {
|
|
|
747
799
|
* 对象池
|
|
748
800
|
*/
|
|
749
801
|
class SamplePoolSet {
|
|
750
|
-
constructor() {
|
|
751
|
-
this.pools = {};
|
|
752
|
-
}
|
|
753
802
|
get(name) {
|
|
754
803
|
let pool = this.pools[name];
|
|
755
804
|
if (!pool) {
|
|
@@ -766,6 +815,7 @@ class SamplePoolSet {
|
|
|
766
815
|
}
|
|
767
816
|
pool.put(item);
|
|
768
817
|
}
|
|
818
|
+
pools = {};
|
|
769
819
|
}
|
|
770
820
|
|
|
771
821
|
const log = logmgr.getEventLogger();
|
|
@@ -774,9 +824,6 @@ const log = logmgr.getEventLogger();
|
|
|
774
824
|
*/
|
|
775
825
|
class EventDispatcher {
|
|
776
826
|
constructor() {
|
|
777
|
-
this._isPause = false;
|
|
778
|
-
this._onEventItems = {};
|
|
779
|
-
this.isDispose = false;
|
|
780
827
|
Scheduler.enableForTarget(this);
|
|
781
828
|
}
|
|
782
829
|
dispose() {
|
|
@@ -792,6 +839,7 @@ class EventDispatcher {
|
|
|
792
839
|
resume() {
|
|
793
840
|
this._isPause = false;
|
|
794
841
|
}
|
|
842
|
+
_isPause = false;
|
|
795
843
|
has(type, caller, listener) {
|
|
796
844
|
return !!this.getItem(type, caller, listener);
|
|
797
845
|
}
|
|
@@ -1001,6 +1049,11 @@ class EventDispatcher {
|
|
|
1001
1049
|
}
|
|
1002
1050
|
return items;
|
|
1003
1051
|
}
|
|
1052
|
+
id;
|
|
1053
|
+
uuid;
|
|
1054
|
+
name;
|
|
1055
|
+
_onEventItems = {};
|
|
1056
|
+
isDispose = false;
|
|
1004
1057
|
}
|
|
1005
1058
|
/**
|
|
1006
1059
|
* 全局的事件派发器
|
|
@@ -1681,26 +1734,24 @@ class MapUtil {
|
|
|
1681
1734
|
const maputil = new MapUtil();
|
|
1682
1735
|
|
|
1683
1736
|
class ScaleUtil {
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
"^_{|}";
|
|
1703
|
-
}
|
|
1737
|
+
tenToAny = [
|
|
1738
|
+
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", // 1-10
|
|
1739
|
+
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", // 11-20
|
|
1740
|
+
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", // 21-30
|
|
1741
|
+
"U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", // 31-40
|
|
1742
|
+
"e", "f", "g", "h", "i", "j", "k", "l", "m", "n", // 41-50
|
|
1743
|
+
"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", // 51-60
|
|
1744
|
+
"y", "z", ":", ";", "<", "=", ">", "?", "@", "{", // 61-80
|
|
1745
|
+
"]", "^", "_", "{", "|", "}", // 71-75
|
|
1746
|
+
];
|
|
1747
|
+
allstr = "0123456789" +
|
|
1748
|
+
"ABCDEFGHIJ" +
|
|
1749
|
+
"KLMNOPQRST" +
|
|
1750
|
+
"UVWXYZabcd" +
|
|
1751
|
+
"efghijklmn" +
|
|
1752
|
+
"opqrstuvwx" +
|
|
1753
|
+
"yz:;<=>?@[]" +
|
|
1754
|
+
"^_{|}";
|
|
1704
1755
|
// RandString 生成随机字符串
|
|
1705
1756
|
randString(size, n) {
|
|
1706
1757
|
var s = "";
|
|
@@ -1767,13 +1818,6 @@ class ScaleUtil {
|
|
|
1767
1818
|
const scaleutil = new ScaleUtil();
|
|
1768
1819
|
|
|
1769
1820
|
class IdentUtil {
|
|
1770
|
-
constructor() {
|
|
1771
|
-
this._baseline = 0;
|
|
1772
|
-
this._precision = "s";
|
|
1773
|
-
this._randLength = 3;
|
|
1774
|
-
this._count = 0;
|
|
1775
|
-
this._lastTime = 0;
|
|
1776
|
-
}
|
|
1777
1821
|
/**
|
|
1778
1822
|
* 设置时间的基线,通过减去已经过去的时间,可缩短id长度
|
|
1779
1823
|
* 注:同一个项目必须拥有同样的基线,否则有几率出现相同的id!
|
|
@@ -1783,6 +1827,7 @@ class IdentUtil {
|
|
|
1783
1827
|
setTimeBaseline(time) {
|
|
1784
1828
|
this._baseline = time;
|
|
1785
1829
|
}
|
|
1830
|
+
_baseline = 0;
|
|
1786
1831
|
/**
|
|
1787
1832
|
* 设置时间的精度
|
|
1788
1833
|
* @param precision
|
|
@@ -1790,6 +1835,7 @@ class IdentUtil {
|
|
|
1790
1835
|
setTimePrecision(precision) {
|
|
1791
1836
|
this._precision = precision;
|
|
1792
1837
|
}
|
|
1838
|
+
_precision = "s";
|
|
1793
1839
|
/**
|
|
1794
1840
|
* 设置随机数的长度
|
|
1795
1841
|
* @param value
|
|
@@ -1797,6 +1843,7 @@ class IdentUtil {
|
|
|
1797
1843
|
setRandLength(value = 3) {
|
|
1798
1844
|
this._randLength = value;
|
|
1799
1845
|
}
|
|
1846
|
+
_randLength = 3;
|
|
1800
1847
|
genOne() {
|
|
1801
1848
|
let time = Date.now();
|
|
1802
1849
|
switch (this._precision) {
|
|
@@ -1816,6 +1863,8 @@ class IdentUtil {
|
|
|
1816
1863
|
let countstr = scaleutil.decimalTo(this._count, 62);
|
|
1817
1864
|
return timestr + scaleutil.decimalTo(countstr.length, 62) + countstr;
|
|
1818
1865
|
}
|
|
1866
|
+
_count = 0;
|
|
1867
|
+
_lastTime = 0;
|
|
1819
1868
|
}
|
|
1820
1869
|
const identutil = new IdentUtil();
|
|
1821
1870
|
|
|
@@ -1826,6 +1875,7 @@ class TreeIterator {
|
|
|
1826
1875
|
isBreak() {
|
|
1827
1876
|
return this._isBreak;
|
|
1828
1877
|
}
|
|
1878
|
+
_isBreak;
|
|
1829
1879
|
}
|
|
1830
1880
|
function fixPath(path) {
|
|
1831
1881
|
if (path == 0) {
|
|
@@ -1845,12 +1895,45 @@ class TreeNode {
|
|
|
1845
1895
|
get root() {
|
|
1846
1896
|
return this._root;
|
|
1847
1897
|
}
|
|
1898
|
+
/**
|
|
1899
|
+
* 根节点
|
|
1900
|
+
*/
|
|
1901
|
+
_root;
|
|
1902
|
+
/**
|
|
1903
|
+
* 编号
|
|
1904
|
+
*/
|
|
1905
|
+
uuid;
|
|
1906
|
+
/**
|
|
1907
|
+
* 编号
|
|
1908
|
+
*/
|
|
1909
|
+
id;
|
|
1910
|
+
/**
|
|
1911
|
+
* 自定义数据
|
|
1912
|
+
*/
|
|
1913
|
+
data;
|
|
1914
|
+
/**
|
|
1915
|
+
* 是否树叶
|
|
1916
|
+
*/
|
|
1917
|
+
isLeaf = true;
|
|
1918
|
+
/**
|
|
1919
|
+
* 功能性标签,用于开发组件时,记录组件的状态。例如title, icon, 显示树的组件,需要 expanded,selected标签
|
|
1920
|
+
*/
|
|
1921
|
+
tags;
|
|
1848
1922
|
/**
|
|
1849
1923
|
* 深度
|
|
1850
1924
|
*/
|
|
1851
1925
|
get depth() {
|
|
1852
1926
|
return this._depth;
|
|
1853
1927
|
}
|
|
1928
|
+
_depth = 0;
|
|
1929
|
+
/**
|
|
1930
|
+
* 父节点
|
|
1931
|
+
*/
|
|
1932
|
+
parent;
|
|
1933
|
+
/**
|
|
1934
|
+
* 子节点
|
|
1935
|
+
*/
|
|
1936
|
+
children;
|
|
1854
1937
|
/**
|
|
1855
1938
|
* 设置根
|
|
1856
1939
|
* @param val
|
|
@@ -1876,11 +1959,6 @@ class TreeNode {
|
|
|
1876
1959
|
this.getTags()[name] = value;
|
|
1877
1960
|
}
|
|
1878
1961
|
constructor(id, isLeaf) {
|
|
1879
|
-
/**
|
|
1880
|
-
* 是否树叶
|
|
1881
|
-
*/
|
|
1882
|
-
this.isLeaf = true;
|
|
1883
|
-
this._depth = 0;
|
|
1884
1962
|
this.uuid = identutil.genOne();
|
|
1885
1963
|
this.id = id;
|
|
1886
1964
|
if (isLeaf == undefined) {
|
|
@@ -2050,7 +2128,6 @@ class TreeNode {
|
|
|
2050
2128
|
* @param inChild - 决定是否将子节点加入队列:若提供,调用 inChild(node),返回 true 才加入其子节点
|
|
2051
2129
|
*/
|
|
2052
2130
|
walkBFS(f, inChild) {
|
|
2053
|
-
var _a;
|
|
2054
2131
|
const queue = [this]; // 初始化队列
|
|
2055
2132
|
while (queue.length > 0) {
|
|
2056
2133
|
const node = queue.shift(); // 取出队首节点
|
|
@@ -2070,7 +2147,7 @@ class TreeNode {
|
|
|
2070
2147
|
continue;
|
|
2071
2148
|
}
|
|
2072
2149
|
// 3. 将子节点加入队列(从左到右)
|
|
2073
|
-
if (
|
|
2150
|
+
if (node.children?.length) {
|
|
2074
2151
|
for (const child of node.children) {
|
|
2075
2152
|
queue.push(child);
|
|
2076
2153
|
}
|
|
@@ -2349,6 +2426,36 @@ class TreeNode {
|
|
|
2349
2426
|
}
|
|
2350
2427
|
}
|
|
2351
2428
|
class TreeRoot extends EventDispatcher {
|
|
2429
|
+
/**
|
|
2430
|
+
* 添加数据节点
|
|
2431
|
+
* dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
|
|
2432
|
+
*/
|
|
2433
|
+
static EVENT_ADD = "add";
|
|
2434
|
+
/**
|
|
2435
|
+
* 移除数据节点
|
|
2436
|
+
* dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
|
|
2437
|
+
*/
|
|
2438
|
+
static EVENT_REMOVE = "remove";
|
|
2439
|
+
/**
|
|
2440
|
+
* 插入数据节点
|
|
2441
|
+
* dispatchParams = {node:TreeNode, before:TreeNode}
|
|
2442
|
+
*/
|
|
2443
|
+
static EVENT_INSERT = "insert";
|
|
2444
|
+
/**
|
|
2445
|
+
* 刷新数据节点
|
|
2446
|
+
* dispatchParams = {node:TreeNode}
|
|
2447
|
+
*/
|
|
2448
|
+
static EVENT_REFRESH = "refresh";
|
|
2449
|
+
/**
|
|
2450
|
+
* 设置数据时触发
|
|
2451
|
+
* dispatchParams = {node:TreeNode}
|
|
2452
|
+
*/
|
|
2453
|
+
static EVENT_DATA_SET = "data_set";
|
|
2454
|
+
/**
|
|
2455
|
+
* 设置数据时触发
|
|
2456
|
+
* dispatchParams = {node:TreeNode, tag:string, value:any}
|
|
2457
|
+
*/
|
|
2458
|
+
static EVENT_TAGS_SET = "tags_set";
|
|
2352
2459
|
static create() {
|
|
2353
2460
|
return new TreeRoot();
|
|
2354
2461
|
}
|
|
@@ -2552,41 +2659,14 @@ class TreeRoot extends EventDispatcher {
|
|
|
2552
2659
|
}
|
|
2553
2660
|
return this.origin.children[0];
|
|
2554
2661
|
}
|
|
2662
|
+
origin;
|
|
2555
2663
|
}
|
|
2556
|
-
/**
|
|
2557
|
-
* 添加数据节点
|
|
2558
|
-
* dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
|
|
2559
|
-
*/
|
|
2560
|
-
TreeRoot.EVENT_ADD = "add";
|
|
2561
|
-
/**
|
|
2562
|
-
* 移除数据节点
|
|
2563
|
-
* dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
|
|
2564
|
-
*/
|
|
2565
|
-
TreeRoot.EVENT_REMOVE = "remove";
|
|
2566
|
-
/**
|
|
2567
|
-
* 插入数据节点
|
|
2568
|
-
* dispatchParams = {node:TreeNode, before:TreeNode}
|
|
2569
|
-
*/
|
|
2570
|
-
TreeRoot.EVENT_INSERT = "insert";
|
|
2571
|
-
/**
|
|
2572
|
-
* 刷新数据节点
|
|
2573
|
-
* dispatchParams = {node:TreeNode}
|
|
2574
|
-
*/
|
|
2575
|
-
TreeRoot.EVENT_REFRESH = "refresh";
|
|
2576
|
-
/**
|
|
2577
|
-
* 设置数据时触发
|
|
2578
|
-
* dispatchParams = {node:TreeNode}
|
|
2579
|
-
*/
|
|
2580
|
-
TreeRoot.EVENT_DATA_SET = "data_set";
|
|
2581
|
-
/**
|
|
2582
|
-
* 设置数据时触发
|
|
2583
|
-
* dispatchParams = {node:TreeNode, tag:string, value:any}
|
|
2584
|
-
*/
|
|
2585
|
-
TreeRoot.EVENT_TAGS_SET = "tags_set";
|
|
2586
2664
|
///////////////////////////
|
|
2587
2665
|
class TreeRootPlugin {
|
|
2666
|
+
root;
|
|
2588
2667
|
}
|
|
2589
2668
|
class TreeNodePlugin {
|
|
2669
|
+
node;
|
|
2590
2670
|
}
|
|
2591
2671
|
|
|
2592
2672
|
class ListNode {
|
|
@@ -2597,9 +2677,13 @@ class ListNode {
|
|
|
2597
2677
|
return node;
|
|
2598
2678
|
}
|
|
2599
2679
|
constructor() {
|
|
2600
|
-
this.tags = {};
|
|
2601
2680
|
this.uuid = identutil.genOne();
|
|
2602
2681
|
}
|
|
2682
|
+
root;
|
|
2683
|
+
uuid;
|
|
2684
|
+
id;
|
|
2685
|
+
data;
|
|
2686
|
+
tags = {};
|
|
2603
2687
|
getTags() {
|
|
2604
2688
|
if (!this.tags) {
|
|
2605
2689
|
this.tags = {};
|
|
@@ -2620,10 +2704,6 @@ class ListNode {
|
|
|
2620
2704
|
}
|
|
2621
2705
|
}
|
|
2622
2706
|
class ListSource extends EventDispatcher {
|
|
2623
|
-
constructor() {
|
|
2624
|
-
super(...arguments);
|
|
2625
|
-
this._data = [];
|
|
2626
|
-
}
|
|
2627
2707
|
/**
|
|
2628
2708
|
* 通过数组创建 ListSource。ListSource的id自动生成。如果需要指定编号,可设置 idCreator
|
|
2629
2709
|
* @param arr
|
|
@@ -2660,6 +2740,41 @@ class ListSource extends EventDispatcher {
|
|
|
2660
2740
|
}
|
|
2661
2741
|
return target;
|
|
2662
2742
|
}
|
|
2743
|
+
/**
|
|
2744
|
+
* 设置数据时触发
|
|
2745
|
+
* dispatchParams = {node:ListNode}
|
|
2746
|
+
*/
|
|
2747
|
+
static EVENT_ADD = "add";
|
|
2748
|
+
/**
|
|
2749
|
+
* 设置数据时触发
|
|
2750
|
+
* dispatchParams = {node:ListNode, index:number}
|
|
2751
|
+
*/
|
|
2752
|
+
static EVENT_REMOVE = "remove";
|
|
2753
|
+
/**
|
|
2754
|
+
* 设置数据时触发
|
|
2755
|
+
*/
|
|
2756
|
+
static EVENT_REMOVE_ALL = "remove_all";
|
|
2757
|
+
/**
|
|
2758
|
+
* 刷新数据节点
|
|
2759
|
+
* dispatchParams = {node:ListNode}
|
|
2760
|
+
*/
|
|
2761
|
+
static EVENT_REFRESH = "refresh";
|
|
2762
|
+
/**
|
|
2763
|
+
* 设置数据时触发
|
|
2764
|
+
* dispatchParams = nodes: [ListNode], indexs: [number]
|
|
2765
|
+
*/
|
|
2766
|
+
static EVENT_SWAP = "swap";
|
|
2767
|
+
/**
|
|
2768
|
+
* 设置数据时触发
|
|
2769
|
+
* dispatchParams = {node:ListNode, data:any}
|
|
2770
|
+
*/
|
|
2771
|
+
static EVENT_DATA_SET = "data_set";
|
|
2772
|
+
/**
|
|
2773
|
+
* 设置数据时触发
|
|
2774
|
+
* dispatchParams = {node:ListNode, tag:string, value:any}
|
|
2775
|
+
*/
|
|
2776
|
+
static EVENT_TAGS_SET = "tags_set";
|
|
2777
|
+
_identFunc;
|
|
2663
2778
|
at(index) {
|
|
2664
2779
|
return this._data[index];
|
|
2665
2780
|
}
|
|
@@ -2788,41 +2903,8 @@ class ListSource extends EventDispatcher {
|
|
|
2788
2903
|
get data() {
|
|
2789
2904
|
return this._data;
|
|
2790
2905
|
}
|
|
2906
|
+
_data = [];
|
|
2791
2907
|
}
|
|
2792
|
-
/**
|
|
2793
|
-
* 设置数据时触发
|
|
2794
|
-
* dispatchParams = {node:ListNode}
|
|
2795
|
-
*/
|
|
2796
|
-
ListSource.EVENT_ADD = "add";
|
|
2797
|
-
/**
|
|
2798
|
-
* 设置数据时触发
|
|
2799
|
-
* dispatchParams = {node:ListNode, index:number}
|
|
2800
|
-
*/
|
|
2801
|
-
ListSource.EVENT_REMOVE = "remove";
|
|
2802
|
-
/**
|
|
2803
|
-
* 设置数据时触发
|
|
2804
|
-
*/
|
|
2805
|
-
ListSource.EVENT_REMOVE_ALL = "remove_all";
|
|
2806
|
-
/**
|
|
2807
|
-
* 刷新数据节点
|
|
2808
|
-
* dispatchParams = {node:ListNode}
|
|
2809
|
-
*/
|
|
2810
|
-
ListSource.EVENT_REFRESH = "refresh";
|
|
2811
|
-
/**
|
|
2812
|
-
* 设置数据时触发
|
|
2813
|
-
* dispatchParams = nodes: [ListNode], indexs: [number]
|
|
2814
|
-
*/
|
|
2815
|
-
ListSource.EVENT_SWAP = "swap";
|
|
2816
|
-
/**
|
|
2817
|
-
* 设置数据时触发
|
|
2818
|
-
* dispatchParams = {node:ListNode, data:any}
|
|
2819
|
-
*/
|
|
2820
|
-
ListSource.EVENT_DATA_SET = "data_set";
|
|
2821
|
-
/**
|
|
2822
|
-
* 设置数据时触发
|
|
2823
|
-
* dispatchParams = {node:ListNode, tag:string, value:any}
|
|
2824
|
-
*/
|
|
2825
|
-
ListSource.EVENT_TAGS_SET = "tags_set";
|
|
2826
2908
|
|
|
2827
2909
|
class DictIterator {
|
|
2828
2910
|
break() {
|
|
@@ -2831,10 +2913,10 @@ class DictIterator {
|
|
|
2831
2913
|
isBreak() {
|
|
2832
2914
|
return this._isBreak;
|
|
2833
2915
|
}
|
|
2916
|
+
_isBreak;
|
|
2834
2917
|
}
|
|
2835
2918
|
class Dictionary {
|
|
2836
2919
|
constructor(data) {
|
|
2837
|
-
this.size = 0;
|
|
2838
2920
|
if (data) {
|
|
2839
2921
|
this._data = data;
|
|
2840
2922
|
}
|
|
@@ -3143,6 +3225,12 @@ class Dictionary {
|
|
|
3143
3225
|
}
|
|
3144
3226
|
return newdata;
|
|
3145
3227
|
}
|
|
3228
|
+
size = 0;
|
|
3229
|
+
_data;
|
|
3230
|
+
_onSet;
|
|
3231
|
+
_onDelete;
|
|
3232
|
+
_onSetCaller;
|
|
3233
|
+
_onDeleteCaller;
|
|
3146
3234
|
}
|
|
3147
3235
|
|
|
3148
3236
|
class DictNode {
|
|
@@ -3153,9 +3241,12 @@ class DictNode {
|
|
|
3153
3241
|
return node;
|
|
3154
3242
|
}
|
|
3155
3243
|
constructor() {
|
|
3156
|
-
this.tags = {};
|
|
3157
3244
|
this.uuid = identutil.genOne();
|
|
3158
3245
|
}
|
|
3246
|
+
uuid;
|
|
3247
|
+
id;
|
|
3248
|
+
data;
|
|
3249
|
+
tags = {};
|
|
3159
3250
|
getTags() {
|
|
3160
3251
|
if (!this.tags) {
|
|
3161
3252
|
this.tags = {};
|
|
@@ -3177,10 +3268,16 @@ class DictNode {
|
|
|
3177
3268
|
}
|
|
3178
3269
|
}
|
|
3179
3270
|
class DictSource extends Dictionary {
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3271
|
+
/**
|
|
3272
|
+
* 刷新数据节点
|
|
3273
|
+
* dispatchParams = {node:ListNode}
|
|
3274
|
+
*/
|
|
3275
|
+
static EVENT_REFRESH = "refresh";
|
|
3276
|
+
/**
|
|
3277
|
+
* 设置数据时触发
|
|
3278
|
+
* dispatchParams = {node:ListNode, tag:string, value:any}
|
|
3279
|
+
*/
|
|
3280
|
+
static EVENT_TAGS_SET = "tags_set";
|
|
3184
3281
|
setNodeTags(node, tag, value) {
|
|
3185
3282
|
let tags = node.getTags();
|
|
3186
3283
|
if (tags[tag] === value) {
|
|
@@ -3195,17 +3292,8 @@ class DictSource extends Dictionary {
|
|
|
3195
3292
|
get dispatcher() {
|
|
3196
3293
|
return this._dispatcher;
|
|
3197
3294
|
}
|
|
3295
|
+
_dispatcher = new EventDispatcher();
|
|
3198
3296
|
}
|
|
3199
|
-
/**
|
|
3200
|
-
* 刷新数据节点
|
|
3201
|
-
* dispatchParams = {node:ListNode}
|
|
3202
|
-
*/
|
|
3203
|
-
DictSource.EVENT_REFRESH = "refresh";
|
|
3204
|
-
/**
|
|
3205
|
-
* 设置数据时触发
|
|
3206
|
-
* dispatchParams = {node:ListNode, tag:string, value:any}
|
|
3207
|
-
*/
|
|
3208
|
-
DictSource.EVENT_TAGS_SET = "tags_set";
|
|
3209
3297
|
|
|
3210
3298
|
class ListIterator {
|
|
3211
3299
|
break(reason) {
|
|
@@ -3218,10 +3306,11 @@ class ListIterator {
|
|
|
3218
3306
|
getReason() {
|
|
3219
3307
|
return this._reason;
|
|
3220
3308
|
}
|
|
3309
|
+
_reason;
|
|
3310
|
+
_isBreak;
|
|
3221
3311
|
}
|
|
3222
3312
|
class List {
|
|
3223
3313
|
constructor() {
|
|
3224
|
-
this._data = [];
|
|
3225
3314
|
this._onSet = null;
|
|
3226
3315
|
this._onDelete = null;
|
|
3227
3316
|
}
|
|
@@ -3511,11 +3600,15 @@ class List {
|
|
|
3511
3600
|
this._onDelete.call(this._onDeleteCaller, value);
|
|
3512
3601
|
}
|
|
3513
3602
|
}
|
|
3603
|
+
_data = [];
|
|
3604
|
+
_onSet;
|
|
3605
|
+
_onDelete;
|
|
3606
|
+
_onSetCaller;
|
|
3607
|
+
_onDeleteCaller;
|
|
3514
3608
|
}
|
|
3515
3609
|
|
|
3516
3610
|
class Controller {
|
|
3517
3611
|
constructor(name) {
|
|
3518
|
-
this._enabled = false;
|
|
3519
3612
|
this._name = name;
|
|
3520
3613
|
}
|
|
3521
3614
|
enable() {
|
|
@@ -3540,6 +3633,8 @@ class Controller {
|
|
|
3540
3633
|
get isEnable() {
|
|
3541
3634
|
return this._enabled;
|
|
3542
3635
|
}
|
|
3636
|
+
_name;
|
|
3637
|
+
_enabled = false;
|
|
3543
3638
|
}
|
|
3544
3639
|
class ControllerDict extends Dictionary {
|
|
3545
3640
|
constructor() {
|
|
@@ -3602,6 +3697,7 @@ class SimpleModel {
|
|
|
3602
3697
|
get core() {
|
|
3603
3698
|
return this._mod;
|
|
3604
3699
|
}
|
|
3700
|
+
_mod;
|
|
3605
3701
|
}
|
|
3606
3702
|
class Model extends EventDispatcher {
|
|
3607
3703
|
constructor(core) {
|
|
@@ -3611,13 +3707,12 @@ class Model extends EventDispatcher {
|
|
|
3611
3707
|
get module() {
|
|
3612
3708
|
return this._module;
|
|
3613
3709
|
}
|
|
3710
|
+
_module;
|
|
3614
3711
|
}
|
|
3615
3712
|
|
|
3616
3713
|
class Factory {
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
this._extends = {};
|
|
3620
|
-
}
|
|
3714
|
+
_controllers = {};
|
|
3715
|
+
_extends = {};
|
|
3621
3716
|
registerController(name, creator) {
|
|
3622
3717
|
this._controllers[name] = creator;
|
|
3623
3718
|
}
|
|
@@ -3648,11 +3743,6 @@ class Factory {
|
|
|
3648
3743
|
*/
|
|
3649
3744
|
class Route {
|
|
3650
3745
|
constructor(route) {
|
|
3651
|
-
this._path = "";
|
|
3652
|
-
this._parentPath = undefined;
|
|
3653
|
-
this._search = "";
|
|
3654
|
-
this._name = "";
|
|
3655
|
-
this._route = "";
|
|
3656
3746
|
this._route = route;
|
|
3657
3747
|
route = route.replace("#/", "");
|
|
3658
3748
|
let arr = route.split("?");
|
|
@@ -3682,6 +3772,8 @@ class Route {
|
|
|
3682
3772
|
}
|
|
3683
3773
|
return link;
|
|
3684
3774
|
}
|
|
3775
|
+
// 打开界面缓存的route对象
|
|
3776
|
+
static data = {};
|
|
3685
3777
|
static getData(route) {
|
|
3686
3778
|
let r = Route.data[route];
|
|
3687
3779
|
if (!r) {
|
|
@@ -3763,16 +3855,19 @@ class Route {
|
|
|
3763
3855
|
get key() {
|
|
3764
3856
|
return this.path + this.search;
|
|
3765
3857
|
}
|
|
3858
|
+
_path = "";
|
|
3859
|
+
_parentPath = undefined;
|
|
3860
|
+
_search = "";
|
|
3861
|
+
_name = "";
|
|
3862
|
+
_params;
|
|
3863
|
+
_route = "";
|
|
3766
3864
|
}
|
|
3767
|
-
// 打开界面缓存的route对象
|
|
3768
|
-
Route.data = {};
|
|
3769
3865
|
class RouteList extends List {
|
|
3770
3866
|
}
|
|
3771
3867
|
|
|
3772
3868
|
class RouteController extends Controller {
|
|
3773
3869
|
constructor(routePath) {
|
|
3774
3870
|
super(routePath);
|
|
3775
|
-
this._tags = {};
|
|
3776
3871
|
this._route = new Route(routePath);
|
|
3777
3872
|
}
|
|
3778
3873
|
open(...args) {
|
|
@@ -3828,6 +3923,9 @@ class RouteController extends Controller {
|
|
|
3828
3923
|
get route() {
|
|
3829
3924
|
return this._route;
|
|
3830
3925
|
}
|
|
3926
|
+
_route;
|
|
3927
|
+
_lastView;
|
|
3928
|
+
_tags = {};
|
|
3831
3929
|
}
|
|
3832
3930
|
|
|
3833
3931
|
class UIObjectRepo extends Dictionary {
|
|
@@ -3922,15 +4020,6 @@ var ViewEvent;
|
|
|
3922
4020
|
class RouteView extends EventDispatcher {
|
|
3923
4021
|
constructor(controller, route) {
|
|
3924
4022
|
super();
|
|
3925
|
-
this._waitOpenComplete = false;
|
|
3926
|
-
this._waitCloseComplete = false;
|
|
3927
|
-
this.datas = new MapObject({});
|
|
3928
|
-
this.tags = new MapObject({});
|
|
3929
|
-
this.enableHistory = false;
|
|
3930
|
-
this.state = 0;
|
|
3931
|
-
this._onStop = (ctx) => {
|
|
3932
|
-
ctx.close();
|
|
3933
|
-
};
|
|
3934
4023
|
this._controller = controller;
|
|
3935
4024
|
this._route = route;
|
|
3936
4025
|
}
|
|
@@ -4091,6 +4180,8 @@ class RouteView extends EventDispatcher {
|
|
|
4091
4180
|
// let com = node.addComponent(RouteComponent);
|
|
4092
4181
|
// com.viewModel = this;
|
|
4093
4182
|
}
|
|
4183
|
+
_waitOpenComplete = false;
|
|
4184
|
+
_waitCloseComplete = false;
|
|
4094
4185
|
get controller() {
|
|
4095
4186
|
return this._controller;
|
|
4096
4187
|
}
|
|
@@ -4129,6 +4220,23 @@ class RouteView extends EventDispatcher {
|
|
|
4129
4220
|
get reason() {
|
|
4130
4221
|
return this._reason;
|
|
4131
4222
|
}
|
|
4223
|
+
node;
|
|
4224
|
+
datas = new MapObject({});
|
|
4225
|
+
tags = new MapObject({});
|
|
4226
|
+
enableHistory = false;
|
|
4227
|
+
layer;
|
|
4228
|
+
state = 0;
|
|
4229
|
+
_controller;
|
|
4230
|
+
_route;
|
|
4231
|
+
_reason;
|
|
4232
|
+
_onOpen;
|
|
4233
|
+
_onOpened;
|
|
4234
|
+
_onClose;
|
|
4235
|
+
_onClosed;
|
|
4236
|
+
_onRefresh;
|
|
4237
|
+
_onStop = (ctx) => {
|
|
4238
|
+
ctx.close();
|
|
4239
|
+
};
|
|
4132
4240
|
}
|
|
4133
4241
|
|
|
4134
4242
|
class ViewList extends List {
|
|
@@ -4262,16 +4370,6 @@ function __decorate(decorators, target, key, desc) {
|
|
|
4262
4370
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4263
4371
|
}
|
|
4264
4372
|
|
|
4265
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
4266
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4267
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4268
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
4269
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
4270
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
4271
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
4272
|
-
});
|
|
4273
|
-
}
|
|
4274
|
-
|
|
4275
4373
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
4276
4374
|
var e = new Error(message);
|
|
4277
4375
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -4313,6 +4411,9 @@ let ViewModelComponent = ViewModelComponent_1 = class ViewModelComponent extends
|
|
|
4313
4411
|
this._onDisable = value;
|
|
4314
4412
|
return this;
|
|
4315
4413
|
}
|
|
4414
|
+
viewModel;
|
|
4415
|
+
_onEnable;
|
|
4416
|
+
_onDisable;
|
|
4316
4417
|
};
|
|
4317
4418
|
ViewModelComponent = ViewModelComponent_1 = __decorate([
|
|
4318
4419
|
ccclass('ViewModelComponent')
|
|
@@ -4325,12 +4426,6 @@ class ViewModel extends EventDispatcher {
|
|
|
4325
4426
|
*/
|
|
4326
4427
|
constructor(name) {
|
|
4327
4428
|
super();
|
|
4328
|
-
this._waitOpenComplete = false;
|
|
4329
|
-
this._waitCloseComplete = false;
|
|
4330
|
-
this.datas = new MapObject({});
|
|
4331
|
-
this.tags = new MapObject({});
|
|
4332
|
-
this.enableHistory = false;
|
|
4333
|
-
this.state = 0;
|
|
4334
4429
|
this.name = name;
|
|
4335
4430
|
}
|
|
4336
4431
|
/**
|
|
@@ -4481,17 +4576,17 @@ class ViewModel extends EventDispatcher {
|
|
|
4481
4576
|
/**
|
|
4482
4577
|
* 等待打开完成指令
|
|
4483
4578
|
*/
|
|
4484
|
-
waitOpenComplete(...params) {
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
return;
|
|
4491
|
-
}
|
|
4579
|
+
async waitOpenComplete(...params) {
|
|
4580
|
+
this._waitOpenComplete = true;
|
|
4581
|
+
for (const element of params) {
|
|
4582
|
+
await element();
|
|
4583
|
+
if (this.state == ViewState.Closed || this.state == ViewState.Closeing) {
|
|
4584
|
+
return;
|
|
4492
4585
|
}
|
|
4586
|
+
}
|
|
4587
|
+
if (params.length > 0) {
|
|
4493
4588
|
this.openComplete();
|
|
4494
|
-
}
|
|
4589
|
+
}
|
|
4495
4590
|
}
|
|
4496
4591
|
openComplete() {
|
|
4497
4592
|
if (this.state == ViewState.Opened) {
|
|
@@ -4517,6 +4612,8 @@ class ViewModel extends EventDispatcher {
|
|
|
4517
4612
|
this.dispatch(ViewEvent.Closed);
|
|
4518
4613
|
this.onClosed();
|
|
4519
4614
|
}
|
|
4615
|
+
_waitOpenComplete = false;
|
|
4616
|
+
_waitCloseComplete = false;
|
|
4520
4617
|
get controller() {
|
|
4521
4618
|
return this._controller;
|
|
4522
4619
|
}
|
|
@@ -4526,6 +4623,16 @@ class ViewModel extends EventDispatcher {
|
|
|
4526
4623
|
get reason() {
|
|
4527
4624
|
return this._reason;
|
|
4528
4625
|
}
|
|
4626
|
+
node;
|
|
4627
|
+
datas = new MapObject({});
|
|
4628
|
+
tags = new MapObject({});
|
|
4629
|
+
enableHistory = false;
|
|
4630
|
+
layer;
|
|
4631
|
+
state = 0;
|
|
4632
|
+
_controller;
|
|
4633
|
+
_route;
|
|
4634
|
+
_reason;
|
|
4635
|
+
_viewModelComponent;
|
|
4529
4636
|
onOpen() {
|
|
4530
4637
|
}
|
|
4531
4638
|
onOpened() {
|
|
@@ -4550,7 +4657,6 @@ class Listener {
|
|
|
4550
4657
|
return new Listener(ident);
|
|
4551
4658
|
}
|
|
4552
4659
|
constructor(ident) {
|
|
4553
|
-
this._isOn = true;
|
|
4554
4660
|
this.ident = ident;
|
|
4555
4661
|
}
|
|
4556
4662
|
getCaller() {
|
|
@@ -4618,6 +4724,15 @@ class Listener {
|
|
|
4618
4724
|
getParams() {
|
|
4619
4725
|
return this.params;
|
|
4620
4726
|
}
|
|
4727
|
+
onParams;
|
|
4728
|
+
params;
|
|
4729
|
+
ident;
|
|
4730
|
+
_subIdent;
|
|
4731
|
+
source;
|
|
4732
|
+
_handler;
|
|
4733
|
+
_condition;
|
|
4734
|
+
caller;
|
|
4735
|
+
_isOn = true;
|
|
4621
4736
|
}
|
|
4622
4737
|
|
|
4623
4738
|
/**
|
|
@@ -4628,8 +4743,6 @@ class Listener {
|
|
|
4628
4743
|
*/
|
|
4629
4744
|
class CallbackList {
|
|
4630
4745
|
constructor() {
|
|
4631
|
-
this._data = new List();
|
|
4632
|
-
this._indexIdent = {};
|
|
4633
4746
|
}
|
|
4634
4747
|
addListener(listener) {
|
|
4635
4748
|
let ident = listener.getIdent();
|
|
@@ -4705,6 +4818,8 @@ class CallbackList {
|
|
|
4705
4818
|
}
|
|
4706
4819
|
}
|
|
4707
4820
|
}
|
|
4821
|
+
_data = new List();
|
|
4822
|
+
_indexIdent = {};
|
|
4708
4823
|
}
|
|
4709
4824
|
|
|
4710
4825
|
/**
|
|
@@ -4715,8 +4830,6 @@ class CallbackList {
|
|
|
4715
4830
|
*/
|
|
4716
4831
|
class Dispatcher {
|
|
4717
4832
|
constructor(name) {
|
|
4718
|
-
this.isDispose = false;
|
|
4719
|
-
this.typeToList = new Dictionary();
|
|
4720
4833
|
Scheduler.enableForTarget(this);
|
|
4721
4834
|
this.name = name;
|
|
4722
4835
|
}
|
|
@@ -4756,13 +4869,20 @@ class Dispatcher {
|
|
|
4756
4869
|
}
|
|
4757
4870
|
return list;
|
|
4758
4871
|
}
|
|
4872
|
+
id;
|
|
4873
|
+
uuid;
|
|
4874
|
+
name;
|
|
4875
|
+
isDispose = false;
|
|
4876
|
+
typeToList = new Dictionary();
|
|
4759
4877
|
}
|
|
4760
4878
|
|
|
4761
4879
|
class CallbackItem {
|
|
4880
|
+
listener;
|
|
4881
|
+
caller;
|
|
4882
|
+
once;
|
|
4762
4883
|
}
|
|
4763
4884
|
class SampleCallbackList {
|
|
4764
4885
|
constructor() {
|
|
4765
|
-
this._callbackItems = [];
|
|
4766
4886
|
}
|
|
4767
4887
|
dispose() {
|
|
4768
4888
|
this._callbackItems = null;
|
|
@@ -4860,6 +4980,7 @@ class SampleCallbackList {
|
|
|
4860
4980
|
on.listener.call(on.caller, this, params);
|
|
4861
4981
|
}
|
|
4862
4982
|
}
|
|
4983
|
+
_callbackItems = [];
|
|
4863
4984
|
}
|
|
4864
4985
|
|
|
4865
4986
|
/**
|
|
@@ -4875,7 +4996,7 @@ class SampleCallbackList {
|
|
|
4875
4996
|
function create等距图集(atlasSize, gridSize, keyFormat = "%d.png", maxCount) {
|
|
4876
4997
|
const cols = Math.floor(atlasSize.x / gridSize.x);
|
|
4877
4998
|
const rows = Math.floor(atlasSize.y / gridSize.y);
|
|
4878
|
-
const total = maxCount
|
|
4999
|
+
const total = maxCount ?? cols * rows;
|
|
4879
5000
|
const frames = {};
|
|
4880
5001
|
let index = 0;
|
|
4881
5002
|
for (let y = 0; y < rows; y++) {
|
|
@@ -4963,13 +5084,12 @@ function parseAtlas(plist, texture) {
|
|
|
4963
5084
|
}
|
|
4964
5085
|
|
|
4965
5086
|
class AssetURI {
|
|
5087
|
+
name;
|
|
4966
5088
|
/**
|
|
4967
5089
|
*
|
|
4968
5090
|
*/
|
|
4969
5091
|
constructor(name) {
|
|
4970
5092
|
this.name = name;
|
|
4971
|
-
// 0-bundle+path 1-uuid 2-remote
|
|
4972
|
-
this.loadType = 0;
|
|
4973
5093
|
let arr = name.split("://");
|
|
4974
5094
|
if (arr.length == 2) {
|
|
4975
5095
|
let head = arr[0];
|
|
@@ -4990,6 +5110,11 @@ class AssetURI {
|
|
|
4990
5110
|
this.path = name;
|
|
4991
5111
|
}
|
|
4992
5112
|
}
|
|
5113
|
+
// 0-bundle+path 1-uuid 2-remote
|
|
5114
|
+
loadType = 0;
|
|
5115
|
+
uuid;
|
|
5116
|
+
path;
|
|
5117
|
+
bundle;
|
|
4993
5118
|
}
|
|
4994
5119
|
class XAssetManager {
|
|
4995
5120
|
getAsset(uri) {
|
|
@@ -5032,9 +5157,7 @@ class XAssetManager {
|
|
|
5032
5157
|
let assetx = new XAssetManager();
|
|
5033
5158
|
|
|
5034
5159
|
class LoaderItem {
|
|
5035
|
-
|
|
5036
|
-
this.preload = false;
|
|
5037
|
-
}
|
|
5160
|
+
onComplete;
|
|
5038
5161
|
callHandler(err, asset) {
|
|
5039
5162
|
if (this.onComplete) {
|
|
5040
5163
|
this.onComplete(err, asset);
|
|
@@ -5048,18 +5171,17 @@ class LoaderItem {
|
|
|
5048
5171
|
}
|
|
5049
5172
|
return bundle;
|
|
5050
5173
|
}
|
|
5174
|
+
type;
|
|
5175
|
+
bundle;
|
|
5176
|
+
uri;
|
|
5177
|
+
preload = false;
|
|
5178
|
+
// 记录错误
|
|
5179
|
+
error;
|
|
5051
5180
|
}
|
|
5052
5181
|
/**
|
|
5053
5182
|
* uri格式:path, uuid://uuid, https://url
|
|
5054
5183
|
*/
|
|
5055
5184
|
class AssetLoader extends Dispatcher {
|
|
5056
|
-
constructor() {
|
|
5057
|
-
super(...arguments);
|
|
5058
|
-
this._stop = false;
|
|
5059
|
-
this._loaded = 0;
|
|
5060
|
-
this._loaderList = new List();
|
|
5061
|
-
this._failList = new List();
|
|
5062
|
-
}
|
|
5063
5185
|
/**
|
|
5064
5186
|
*
|
|
5065
5187
|
* @param bundleName
|
|
@@ -5505,6 +5627,12 @@ class AssetLoader extends Dispatcher {
|
|
|
5505
5627
|
stop() {
|
|
5506
5628
|
this._stop = true;
|
|
5507
5629
|
}
|
|
5630
|
+
_stop = false;
|
|
5631
|
+
_onCompleteHandler;
|
|
5632
|
+
_onProgressHandler;
|
|
5633
|
+
_loaded = 0;
|
|
5634
|
+
_loaderList = new List();
|
|
5635
|
+
_failList = new List();
|
|
5508
5636
|
}
|
|
5509
5637
|
|
|
5510
5638
|
class ArrayUtil {
|
|
@@ -5720,6 +5848,7 @@ class CanvasUtil {
|
|
|
5720
5848
|
director.getScene().off(Node.EventType.NODE_DESTROYED, this.onSceneDestroyed);
|
|
5721
5849
|
this._canvas = undefined;
|
|
5722
5850
|
}
|
|
5851
|
+
_canvas;
|
|
5723
5852
|
}
|
|
5724
5853
|
let canvasutil = new CanvasUtil();
|
|
5725
5854
|
|
|
@@ -5785,9 +5914,7 @@ class EventUtil {
|
|
|
5785
5914
|
const eventutil = new EventUtil();
|
|
5786
5915
|
|
|
5787
5916
|
class FloatUtil {
|
|
5788
|
-
|
|
5789
|
-
this.epsilon = 0.00001;
|
|
5790
|
-
}
|
|
5917
|
+
epsilon = 0.00001;
|
|
5791
5918
|
neq(a, b, threshold = this.epsilon) {
|
|
5792
5919
|
return !this.eq(a, b, threshold);
|
|
5793
5920
|
}
|
|
@@ -6057,12 +6184,10 @@ class GeometryUtil {
|
|
|
6057
6184
|
let geoutil = new GeometryUtil();
|
|
6058
6185
|
|
|
6059
6186
|
class MathUtil {
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
this.TempVec4 = new Vec4();
|
|
6065
|
-
}
|
|
6187
|
+
version = 0;
|
|
6188
|
+
TempVec2 = new Vec2();
|
|
6189
|
+
TempVec3 = new Vec3();
|
|
6190
|
+
TempVec4 = new Vec4();
|
|
6066
6191
|
convertVec2to3(vec2, useTemp = false) {
|
|
6067
6192
|
let vec3;
|
|
6068
6193
|
if (useTemp) {
|
|
@@ -6863,6 +6988,12 @@ const hitTestVec3 = new Vec3();
|
|
|
6863
6988
|
const uiutil = new UIUtil();
|
|
6864
6989
|
|
|
6865
6990
|
class WidgetAlign {
|
|
6991
|
+
node;
|
|
6992
|
+
targetNode;
|
|
6993
|
+
nodeWidget;
|
|
6994
|
+
parentTransform;
|
|
6995
|
+
targetTransform;
|
|
6996
|
+
uipos;
|
|
6866
6997
|
constructor(node, targetNode) {
|
|
6867
6998
|
this.node = node;
|
|
6868
6999
|
this.targetNode = targetNode;
|