@ives_xxz/framework 1.6.6 → 2.0.0
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/Framework.ts +9 -13
- package/FrameworkAutoInitialize.ts +58 -0
- package/{CC.d.ts.meta → FrameworkAutoInitialize.ts.meta} +1 -1
- package/FrameworkBase.ts +24 -23
- package/animation/FWSkeleton.ts +5 -6
- package/component/FWVirtualViewComponent.ts +42 -45
- package/config/FWAssetConfig.ts +2 -2
- package/controller/FWLayerController.ts +3 -7
- package/data/FWData.ts +2 -3
- package/define/FWEventDefine.ts +24 -21
- package/define/FWSystemDefine.ts +127 -132
- package/define/FWSystemDefine.ts.meta +1 -1
- package/entry/FWEntry.ts +2 -3
- package/expand/FWDecorator.ts +56 -114
- package/expand/FWRollingViewNesting.ts +3 -5
- package/item/FWVirtualListItem.ts +1 -1
- package/language/FWLanguage.ts +15 -19
- package/layer/FWLayer.ts +1 -1
- package/log/FWLog.ts +30 -35
- package/logic/FWLogic.ts +2 -4
- package/machine/FWStateMachine.ts +1 -2
- package/manager/FWAnimationManager.ts +6 -8
- package/manager/FWAssetManager.ts +22 -23
- package/manager/FWAudioManager.ts +30 -52
- package/manager/FWBundleManager.ts +2 -4
- package/manager/FWComponentManager.ts +0 -1
- package/manager/FWEngineManager.ts +9 -12
- package/manager/FWEventManager.ts +4 -7
- package/manager/FWHotUpdateManager.ts +32 -33
- package/manager/FWLanguageManager.ts +1 -2
- package/manager/FWLayerManager.ts +88 -138
- package/manager/FWManager.ts +1 -3
- package/manager/FWObjectManager.ts +7 -9
- package/manager/FWPerformanceManager.ts +2 -3
- package/manager/FWPromiseManager.ts +29 -28
- package/manager/FWResManager.ts +1 -3
- package/manager/FWSocketManager.ts +2 -5
- package/manager/FWStateManager.ts +2 -4
- package/manager/FWTimeManager.ts +14 -15
- package/manager/FWUiManager.ts +3 -4
- package/package.json +1 -1
- package/{register → registry}/FWRegistry.ts +8 -8
- package/service/http/FWHttp.ts +5 -7
- package/service/socket/FWSocket.ts +28 -43
- package/service/socket/FWSocketHandle.ts +3 -6
- package/service/socket/FWSocketSender.ts +5 -9
- package/types/Creator.d.ts.meta +6 -0
- package/{FW.d.ts → types/FW.d.ts} +407 -153
- package/types/Global.d.ts +21 -0
- package/{render/FWAssembler.ts.meta → types/Global.d.ts.meta} +1 -1
- package/types.meta +13 -0
- package/utils/FWObjectPool.ts +5 -7
- package/utils/FWTask.ts +18 -22
- package/render/FWAssembler.ts +0 -11
- /package/{register → registry}/FWRegistry.ts.meta +0 -0
- /package/{register.meta → registry.meta} +0 -0
- /package/{CC.d.ts → types/Creator.d.ts} +0 -0
- /package/{FW.d.ts.meta → types/FW.d.ts.meta} +0 -0
package/define/FWSystemDefine.ts
CHANGED
|
@@ -1,152 +1,147 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export class FWBindTag {
|
|
2
|
+
LOGIC = 0;
|
|
3
|
+
DATA = 1;
|
|
4
|
+
CONFIG = 2;
|
|
5
|
+
SENDER = 3;
|
|
6
|
+
HANDLE = 4;
|
|
7
|
+
SUB_LOGIC = 5;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class FWObjectType {
|
|
11
|
+
ACTIVE = 0;
|
|
12
|
+
OPACITY = 1;
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
/** Layer渲染顺序 */
|
|
16
|
+
export class FWLayerRenderOrder {
|
|
17
|
+
SCENE = 0;
|
|
18
|
+
PERMANENT = 10;
|
|
19
|
+
UI = 100;
|
|
20
|
+
POPUP = 1000;
|
|
21
|
+
MAX = 10000;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* layer类型
|
|
26
|
+
*/
|
|
27
|
+
export class FWLayerType {
|
|
23
28
|
/**
|
|
24
|
-
*
|
|
29
|
+
* 常驻
|
|
25
30
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* 弹出式(一次性,无需加入队列)
|
|
41
|
-
*/
|
|
42
|
-
POPUP_DISPOSABLE,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export enum FWTaskStatus {
|
|
46
|
-
IDLE = 'IDLE',
|
|
47
|
-
RUNNING = 'RUNNING',
|
|
48
|
-
PAUSED = 'PAUSED',
|
|
49
|
-
COMPLETED = 'COMPLETED',
|
|
50
|
-
}
|
|
31
|
+
PERMANENT = 0;
|
|
32
|
+
/**
|
|
33
|
+
* 可重复打开
|
|
34
|
+
*/
|
|
35
|
+
REPEAT = 1;
|
|
36
|
+
/**
|
|
37
|
+
* 弹出式(需要加入队列)
|
|
38
|
+
*/
|
|
39
|
+
POPUP_QUEUE = 2;
|
|
40
|
+
/**
|
|
41
|
+
* 弹出式(一次性,无需加入队列)
|
|
42
|
+
*/
|
|
43
|
+
POPUP_DISPOSABLE = 3;
|
|
44
|
+
}
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* 优先级普通
|
|
59
|
-
*/
|
|
60
|
-
NORMAL,
|
|
61
|
-
/**
|
|
62
|
-
* 优先级低
|
|
63
|
-
*/
|
|
64
|
-
LOW,
|
|
65
|
-
}
|
|
46
|
+
export class FWTaskStatus {
|
|
47
|
+
IDLE = 'IDLE';
|
|
48
|
+
RUNNING = 'RUNNING';
|
|
49
|
+
PAUSED = 'PAUSED';
|
|
50
|
+
COMPLETED = 'COMPLETED';
|
|
51
|
+
}
|
|
66
52
|
|
|
53
|
+
export class FWPriorityOrder {
|
|
67
54
|
/**
|
|
68
|
-
*
|
|
55
|
+
* 优先级高
|
|
69
56
|
*/
|
|
70
|
-
|
|
71
|
-
/** 调试信息 */
|
|
72
|
-
DEBUG,
|
|
73
|
-
/** socket请求 */
|
|
74
|
-
SOCKET_SEND,
|
|
75
|
-
/** socket接收 */
|
|
76
|
-
SOCKET_RECEIVE,
|
|
77
|
-
/**请求信息 */
|
|
78
|
-
REQUEST,
|
|
79
|
-
/** 响应信息 */
|
|
80
|
-
RESPONSE,
|
|
81
|
-
/** 警告信息 */
|
|
82
|
-
WARN,
|
|
83
|
-
/** 错误信息 */
|
|
84
|
-
ERROR,
|
|
85
|
-
/** 系统信息 */
|
|
86
|
-
SYSTEM,
|
|
87
|
-
}
|
|
88
|
-
|
|
57
|
+
HIGHT = 0;
|
|
89
58
|
/**
|
|
90
|
-
*
|
|
59
|
+
* 优先级普通
|
|
91
60
|
*/
|
|
92
|
-
|
|
93
|
-
GET = 'GET',
|
|
94
|
-
POST = 'POST',
|
|
95
|
-
}
|
|
96
|
-
|
|
61
|
+
NORMAL = 1;
|
|
97
62
|
/**
|
|
98
|
-
*
|
|
63
|
+
* 优先级低
|
|
99
64
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
65
|
+
LOW = 2;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 日志类型
|
|
70
|
+
*/
|
|
71
|
+
export class FWLogType {
|
|
72
|
+
/** 调试信息 */
|
|
73
|
+
DEBUG = 0;
|
|
74
|
+
/** socket请求 */
|
|
75
|
+
SOCKET_SEND = 1;
|
|
76
|
+
/** socket接收 */
|
|
77
|
+
SOCKET_RECEIVE = 2;
|
|
78
|
+
/** 请求信息 */
|
|
79
|
+
REQUEST = 3;
|
|
80
|
+
/** 响应信息 */
|
|
81
|
+
RESPONSE = 4;
|
|
82
|
+
/** 警告信息 */
|
|
83
|
+
WARN = 5;
|
|
84
|
+
/** 错误信息 */
|
|
85
|
+
ERROR = 6;
|
|
86
|
+
/** 系统信息 */
|
|
87
|
+
SYSTEM = 7;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* HTTP请求类型
|
|
92
|
+
*/
|
|
93
|
+
export class FWHttpRequestType {
|
|
94
|
+
GET = 'GET';
|
|
95
|
+
POST = 'POST';
|
|
96
|
+
}
|
|
105
97
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
98
|
+
/**
|
|
99
|
+
* 动画机类型
|
|
100
|
+
*/
|
|
101
|
+
export class FWAnimationMachineType {
|
|
102
|
+
TWEEN = 'TWEEN';
|
|
103
|
+
SKELETON = 'SKELETON';
|
|
104
|
+
ANIMATION = 'ANIMATION';
|
|
105
|
+
}
|
|
110
106
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
export class FWScrollViewTemplateType {
|
|
108
|
+
NODE = 0;
|
|
109
|
+
PREFAB = 1;
|
|
110
|
+
}
|
|
115
111
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
export class FWScrollViewSlideType {
|
|
113
|
+
NORMAL = 0;
|
|
114
|
+
ADHERING = 1;
|
|
115
|
+
PAGE = 2;
|
|
116
|
+
}
|
|
121
117
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
export class FWScrollViewSelectedType {
|
|
119
|
+
NONE = 0;
|
|
120
|
+
SINGLE = 1;
|
|
121
|
+
MULTIPLE = 2;
|
|
122
|
+
}
|
|
127
123
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
export class FWLanguageAssetType {
|
|
125
|
+
LABEL = 'label';
|
|
126
|
+
SPRITE = 'sprite';
|
|
127
|
+
SKELETON = 'skeleton';
|
|
128
|
+
}
|
|
133
129
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
export class FWPromiseStatus {
|
|
131
|
+
PENDING = 'pending';
|
|
132
|
+
FULFILLED = 'fulfilled';
|
|
133
|
+
REJECTED = 'rejected';
|
|
134
|
+
CANCELLED = 'cancelled';
|
|
135
|
+
}
|
|
140
136
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
137
|
+
export class FWLayerState {
|
|
138
|
+
CLOSED = 'closed';
|
|
139
|
+
OPENING = 'opening';
|
|
140
|
+
OPENED = 'opened';
|
|
141
|
+
CLOSING = 'closing';
|
|
142
|
+
}
|
|
147
143
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
144
|
+
export class FWAudioType {
|
|
145
|
+
MUSIC = 0;
|
|
146
|
+
SOUND = 1;
|
|
152
147
|
}
|
package/entry/FWEntry.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import FWUiManager from '../manager/FWUiManager';
|
|
2
|
-
import FWLog from '../log/FWLog';
|
|
3
2
|
import FWAnimationManager from '../manager/FWAnimationManager';
|
|
4
3
|
import FWAudioManager from '../manager/FWAudioManager';
|
|
5
4
|
import FWComponentManager from '../manager/FWComponentManager';
|
|
@@ -22,7 +21,7 @@ import { FWPerformanceManager } from '../manager/FWPerformanceManager';
|
|
|
22
21
|
/**
|
|
23
22
|
* 入口脚本
|
|
24
23
|
*/
|
|
25
|
-
export
|
|
24
|
+
export class FWEntry implements FW.Entry {
|
|
26
25
|
map: Map<string, FW.RegisterBundle>;
|
|
27
26
|
/**
|
|
28
27
|
* 事件管理器
|
|
@@ -144,7 +143,7 @@ export default class FWEntry implements FW.Entry {
|
|
|
144
143
|
this.bundleName = '';
|
|
145
144
|
return;
|
|
146
145
|
} catch (e) {
|
|
147
|
-
|
|
146
|
+
FW.Log.error('launchScene failed:', name);
|
|
148
147
|
}
|
|
149
148
|
}
|
|
150
149
|
|
package/expand/FWDecorator.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import FWLog from "../log/FWLog";
|
|
1
|
+
import 'reflect-metadata';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
$class: Record<string, any>,
|
|
6
|
-
$propertyKey: string | symbol,
|
|
7
|
-
$descriptorOrInitializer?: any
|
|
8
|
-
) => void;
|
|
9
|
-
|
|
10
|
-
export const searchChild = function (node: cc.Node, name: string) {
|
|
3
|
+
export function searchChild(node: cc.Node, name: string) {
|
|
11
4
|
let ret = node.getChildByName(name);
|
|
12
5
|
if (ret) return ret;
|
|
13
6
|
for (let i = 0; i < node.children.length; i++) {
|
|
@@ -17,57 +10,49 @@ export const searchChild = function (node: cc.Node, name: string) {
|
|
|
17
10
|
if (ret) return ret;
|
|
18
11
|
}
|
|
19
12
|
return null;
|
|
20
|
-
}
|
|
13
|
+
}
|
|
21
14
|
|
|
22
15
|
const CookDecoratorKey = ($desc: string) => `__ccc_decorator_${$desc}__`;
|
|
23
16
|
|
|
24
|
-
const KeyChild = CookDecoratorKey(
|
|
17
|
+
const KeyChild = CookDecoratorKey('child_cache');
|
|
25
18
|
|
|
26
19
|
type ParamType = {
|
|
27
20
|
path?: string;
|
|
28
21
|
};
|
|
29
22
|
|
|
30
|
-
export function FWPropertyNode($opt?: ParamType): PropertyDecorator {
|
|
23
|
+
export function FWPropertyNode($opt?: ParamType): FW.PropertyDecorator {
|
|
31
24
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
25
|
return ($target, $propertyKey: string, $descriptorOrInitializer) => {
|
|
33
|
-
const cache: { propertyKey: string; childName: string }[] = ($target[
|
|
34
|
-
KeyChild
|
|
35
|
-
] ??= []);
|
|
26
|
+
const cache: { propertyKey: string; childName: string }[] = ($target[KeyChild] ??= []);
|
|
36
27
|
if (!cache.some(($vo) => $vo.propertyKey === $propertyKey)) {
|
|
37
28
|
cache.push({
|
|
38
29
|
propertyKey: $propertyKey,
|
|
39
30
|
childName: $opt?.path || $propertyKey,
|
|
40
31
|
});
|
|
41
32
|
} else {
|
|
42
|
-
throw new Error(
|
|
43
|
-
`child 装饰器重复绑定属性:${$propertyKey},class:${$target?.name}`
|
|
44
|
-
);
|
|
33
|
+
throw new Error(`child 装饰器重复绑定属性:${$propertyKey},class:${$target?.name}`);
|
|
45
34
|
}
|
|
46
35
|
if (cache.length === 1) {
|
|
47
36
|
const oldOnLoad: () => void = $target.onLoad || undefined;
|
|
48
37
|
$target.onLoad = function () {
|
|
49
|
-
cache.forEach(
|
|
50
|
-
($vo) =>
|
|
51
|
-
(this[$vo.propertyKey] = searchChild(this.node, $vo.childName))
|
|
52
|
-
);
|
|
38
|
+
cache.forEach(($vo) => (this[$vo.propertyKey] = searchChild(this.node, $vo.childName)));
|
|
53
39
|
oldOnLoad && oldOnLoad.apply(this);
|
|
54
40
|
};
|
|
55
41
|
}
|
|
56
42
|
};
|
|
57
43
|
}
|
|
58
44
|
|
|
59
|
-
const KeyChildMulti = CookDecoratorKey(
|
|
45
|
+
const KeyChildMulti = CookDecoratorKey('child_cache_multi'); // 重新定义 Key,避免冲突
|
|
60
46
|
|
|
61
47
|
/** 查找多个节点,并存储为数组 */
|
|
62
|
-
export function FWPropertyNodes(...paths: string[]): PropertyDecorator {
|
|
48
|
+
export function FWPropertyNodes(...paths: string[]): FW.PropertyDecorator {
|
|
63
49
|
return ($target: any, $propertyKey: string) => {
|
|
64
50
|
// 确保 $target[KeyChild] 是数组
|
|
65
51
|
if (!$target[KeyChildMulti]) {
|
|
66
52
|
$target[KeyChildMulti] = [];
|
|
67
53
|
}
|
|
68
54
|
|
|
69
|
-
const cache: { propertyKey: string; childNames: string[] }[] =
|
|
70
|
-
$target[KeyChildMulti];
|
|
55
|
+
const cache: { propertyKey: string; childNames: string[] }[] = $target[KeyChildMulti];
|
|
71
56
|
|
|
72
57
|
// 查找是否已经存在该属性的绑定
|
|
73
58
|
const existingEntry = cache.find(($vo) => $vo.propertyKey === $propertyKey);
|
|
@@ -80,7 +65,7 @@ export function FWPropertyNodes(...paths: string[]): PropertyDecorator {
|
|
|
80
65
|
});
|
|
81
66
|
} else {
|
|
82
67
|
throw new Error(
|
|
83
|
-
`child 装饰器重复绑定属性:${$propertyKey}, class:${$target.constructor.name}
|
|
68
|
+
`child 装饰器重复绑定属性:${$propertyKey}, class:${$target.constructor.name}`,
|
|
84
69
|
);
|
|
85
70
|
}
|
|
86
71
|
|
|
@@ -123,13 +108,13 @@ interface INewable<T = any> extends Function {
|
|
|
123
108
|
new (...args: any[]): T;
|
|
124
109
|
}
|
|
125
110
|
|
|
126
|
-
const KeyComp = CookDecoratorKey(
|
|
111
|
+
const KeyComp = CookDecoratorKey('comp_cache');
|
|
127
112
|
|
|
128
113
|
export function FWPropertyComponent(
|
|
129
114
|
$componentClass: INewable<cc.Component>,
|
|
130
115
|
$childName?: string,
|
|
131
|
-
$mute = false
|
|
132
|
-
): PropertyDecorator {
|
|
116
|
+
$mute = false,
|
|
117
|
+
): FW.PropertyDecorator {
|
|
133
118
|
return ($target, $propertyKey: string, $descriptorOrInitializer) => {
|
|
134
119
|
const cache: {
|
|
135
120
|
propertyKey: string;
|
|
@@ -144,9 +129,7 @@ export function FWPropertyComponent(
|
|
|
144
129
|
});
|
|
145
130
|
} else {
|
|
146
131
|
if (!$mute) {
|
|
147
|
-
throw new Error(
|
|
148
|
-
`component装饰器重复绑定属性:${$propertyKey},class:${$target.name}`
|
|
149
|
-
);
|
|
132
|
+
throw new Error(`component装饰器重复绑定属性:${$propertyKey},class:${$target.name}`);
|
|
150
133
|
}
|
|
151
134
|
return;
|
|
152
135
|
}
|
|
@@ -154,21 +137,18 @@ export function FWPropertyComponent(
|
|
|
154
137
|
const oldOnLoad: () => void = $target.onLoad || undefined; //$target.onLoad也可以拿到父类的实现
|
|
155
138
|
$target.onLoad = function () {
|
|
156
139
|
cache.forEach(($vo) => {
|
|
157
|
-
const node = $vo.childName
|
|
158
|
-
? searchChild(this.node, $vo.childName)
|
|
159
|
-
: this.node;
|
|
140
|
+
const node = $vo.childName ? searchChild(this.node, $vo.childName) : this.node;
|
|
160
141
|
if (!node) {
|
|
161
142
|
if (!$mute) {
|
|
162
143
|
throw new Error(
|
|
163
|
-
`component装饰器没有找到适合的node节点:class:${$target?.name},组件:${$componentClass?.name},childName:${$childName}
|
|
144
|
+
`component装饰器没有找到适合的node节点:class:${$target?.name},组件:${$componentClass?.name},childName:${$childName}`,
|
|
164
145
|
);
|
|
165
146
|
} else {
|
|
166
147
|
return;
|
|
167
148
|
}
|
|
168
149
|
}
|
|
169
150
|
this[$vo.propertyKey] =
|
|
170
|
-
node.getComponent($vo.compClass) ||
|
|
171
|
-
node.addComponent($vo.compClass);
|
|
151
|
+
node.getComponent($vo.compClass) || node.addComponent($vo.compClass);
|
|
172
152
|
});
|
|
173
153
|
oldOnLoad && oldOnLoad.apply(this);
|
|
174
154
|
};
|
|
@@ -178,8 +158,8 @@ export function FWPropertyComponent(
|
|
|
178
158
|
|
|
179
159
|
export function FWPropertyComponents(
|
|
180
160
|
$componentClass: INewable<cc.Component>,
|
|
181
|
-
$childName?: string
|
|
182
|
-
): PropertyDecorator {
|
|
161
|
+
$childName?: string,
|
|
162
|
+
): FW.PropertyDecorator {
|
|
183
163
|
return ($target, $propertyKey: string, $descriptorOrInitializer) => {
|
|
184
164
|
const componentName = $childName || $propertyKey;
|
|
185
165
|
const oldOnLoad: () => void = $target.onLoad || undefined; //$target.onLoad也可以拿到父类的实现
|
|
@@ -223,11 +203,7 @@ export function isNull(message?: string) {
|
|
|
223
203
|
}
|
|
224
204
|
|
|
225
205
|
export function FWSocketAutoProcessPause() {
|
|
226
|
-
return function (
|
|
227
|
-
target: any,
|
|
228
|
-
propertyKey: string,
|
|
229
|
-
descriptor: PropertyDescriptor
|
|
230
|
-
) {
|
|
206
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
231
207
|
const originalMethod = descriptor.value;
|
|
232
208
|
|
|
233
209
|
descriptor.value = async function (...args: any[]) {
|
|
@@ -235,7 +211,7 @@ export function FWSocketAutoProcessPause() {
|
|
|
235
211
|
const result = await originalMethod.apply(this, args);
|
|
236
212
|
return result;
|
|
237
213
|
} finally {
|
|
238
|
-
|
|
214
|
+
FW.Log.debug('暂停socket消息处理');
|
|
239
215
|
FW.Entry.socketMgr.resumeMessageHandle();
|
|
240
216
|
}
|
|
241
217
|
};
|
|
@@ -245,25 +221,17 @@ export function FWSocketAutoProcessPause() {
|
|
|
245
221
|
}
|
|
246
222
|
|
|
247
223
|
export function FWDeprecated(description?: string) {
|
|
248
|
-
return function (
|
|
249
|
-
target: any,
|
|
250
|
-
propertyKey: string,
|
|
251
|
-
descriptor: PropertyDescriptor
|
|
252
|
-
) {
|
|
224
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
253
225
|
const originalMethod = descriptor.value;
|
|
254
226
|
descriptor.value = async function (...args: any[]) {
|
|
255
|
-
|
|
227
|
+
FW.Log.warn(`${propertyKey}方法已弃用!${description || ''}`);
|
|
256
228
|
originalMethod.apply(this, args);
|
|
257
229
|
};
|
|
258
230
|
return descriptor;
|
|
259
231
|
};
|
|
260
232
|
}
|
|
261
233
|
export function FWSocketAutoProcessResume() {
|
|
262
|
-
return function (
|
|
263
|
-
target: any,
|
|
264
|
-
propertyKey: string,
|
|
265
|
-
descriptor: PropertyDescriptor
|
|
266
|
-
) {
|
|
234
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
267
235
|
const originalMethod = descriptor.value;
|
|
268
236
|
|
|
269
237
|
descriptor.value = async function (...args: any[]) {
|
|
@@ -271,7 +239,7 @@ export function FWSocketAutoProcessResume() {
|
|
|
271
239
|
const result = await originalMethod.apply(this, args);
|
|
272
240
|
return result;
|
|
273
241
|
} finally {
|
|
274
|
-
|
|
242
|
+
FW.Log.debug('恢复socket消息处理');
|
|
275
243
|
FW.Entry.socketMgr.resumeMessageHandle();
|
|
276
244
|
}
|
|
277
245
|
};
|
|
@@ -281,11 +249,7 @@ export function FWSocketAutoProcessResume() {
|
|
|
281
249
|
}
|
|
282
250
|
|
|
283
251
|
export function RegisterEvents(events: FW.RegisterEventArgs[]) {
|
|
284
|
-
return function (
|
|
285
|
-
target: any,
|
|
286
|
-
propertyKey: string,
|
|
287
|
-
descriptor: PropertyDescriptor
|
|
288
|
-
) {
|
|
252
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
289
253
|
const originalMethod = descriptor.value;
|
|
290
254
|
|
|
291
255
|
descriptor.value = function (...args: any[]) {
|
|
@@ -300,11 +264,7 @@ export function RegisterEvents(events: FW.RegisterEventArgs[]) {
|
|
|
300
264
|
}
|
|
301
265
|
|
|
302
266
|
export function AutoRegisterCCEvent(nodePath: string, eventName?: string) {
|
|
303
|
-
return function (
|
|
304
|
-
target: any,
|
|
305
|
-
propertyKey: string,
|
|
306
|
-
descriptor: PropertyDescriptor
|
|
307
|
-
) {
|
|
267
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
308
268
|
const originalMethod = descriptor.value;
|
|
309
269
|
const originalOnInit = target.onInit;
|
|
310
270
|
const evt = eventName || cc.Node.EventType.TOUCH_END;
|
|
@@ -315,9 +275,7 @@ export function AutoRegisterCCEvent(nodePath: string, eventName?: string) {
|
|
|
315
275
|
let targetNode: cc.Node | null = null;
|
|
316
276
|
|
|
317
277
|
const cachedNodes = this[KeyChild] || [];
|
|
318
|
-
const cachedNode = cachedNodes.find(
|
|
319
|
-
(vo: any) => vo.childName === nodePath
|
|
320
|
-
);
|
|
278
|
+
const cachedNode = cachedNodes.find((vo: any) => vo.childName === nodePath);
|
|
321
279
|
|
|
322
280
|
if (cachedNode && this[cachedNode.propertyKey]) {
|
|
323
281
|
targetNode = this[cachedNode.propertyKey];
|
|
@@ -325,7 +283,7 @@ export function AutoRegisterCCEvent(nodePath: string, eventName?: string) {
|
|
|
325
283
|
targetNode = searchChild(this.layer?.node || this.node, nodePath);
|
|
326
284
|
|
|
327
285
|
if (targetNode && !cachedNode) {
|
|
328
|
-
const cacheKey = `_cached_${nodePath.replace(/\//g,
|
|
286
|
+
const cacheKey = `_cached_${nodePath.replace(/\//g, '_')}`;
|
|
329
287
|
this[cacheKey] = targetNode;
|
|
330
288
|
if (!this[KeyChild]) this[KeyChild] = [];
|
|
331
289
|
this[KeyChild].push({
|
|
@@ -336,53 +294,45 @@ export function AutoRegisterCCEvent(nodePath: string, eventName?: string) {
|
|
|
336
294
|
}
|
|
337
295
|
|
|
338
296
|
if (targetNode) {
|
|
339
|
-
this.registerEvent({
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
});
|
|
348
|
-
|
|
297
|
+
this.registerEvent({
|
|
298
|
+
CCEvent: [
|
|
299
|
+
{
|
|
300
|
+
eventName: evt,
|
|
301
|
+
cb: originalMethod.bind(this),
|
|
302
|
+
target: targetNode,
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
});
|
|
306
|
+
FW.Log.debug(`自动注册事件: ${nodePath} -> ${propertyKey}`);
|
|
349
307
|
} else {
|
|
350
|
-
|
|
308
|
+
FW.Log.warn(`自动注册事件失败: 未找到节点 ${nodePath}`);
|
|
351
309
|
}
|
|
352
310
|
};
|
|
353
311
|
};
|
|
354
312
|
}
|
|
355
313
|
|
|
356
314
|
export function AutoRegisterFWEvent(eventName: any) {
|
|
357
|
-
return function (
|
|
358
|
-
target: any,
|
|
359
|
-
propertyKey: string,
|
|
360
|
-
descriptor: PropertyDescriptor
|
|
361
|
-
) {
|
|
315
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
362
316
|
const originalMethod = descriptor.value;
|
|
363
317
|
const originalOnInit = target.onInit;
|
|
364
318
|
|
|
365
319
|
target.onInit = function (...args) {
|
|
366
320
|
originalOnInit?.call(this, args);
|
|
367
|
-
this.registerEvent({
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
});
|
|
321
|
+
this.registerEvent({
|
|
322
|
+
CCEvent: [
|
|
323
|
+
{
|
|
324
|
+
eventName: eventName,
|
|
325
|
+
cb: originalMethod.bind(this),
|
|
326
|
+
target: this,
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
});
|
|
376
330
|
};
|
|
377
331
|
};
|
|
378
332
|
}
|
|
379
333
|
|
|
380
334
|
export function PerformanceMonitor(operationName?: string) {
|
|
381
|
-
return function (
|
|
382
|
-
target: any,
|
|
383
|
-
propertyKey: string,
|
|
384
|
-
descriptor: PropertyDescriptor
|
|
385
|
-
) {
|
|
335
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
386
336
|
const originalMethod = descriptor.value;
|
|
387
337
|
|
|
388
338
|
descriptor.value = async function (...args: any[]) {
|
|
@@ -400,24 +350,16 @@ export function PerformanceMonitor(operationName?: string) {
|
|
|
400
350
|
const result = await originalMethod.apply(this, args);
|
|
401
351
|
const duration = Date.now() - startTime;
|
|
402
352
|
|
|
403
|
-
FW.Entry.performanceMgr?.recordOperationMetric(
|
|
404
|
-
moduleName,
|
|
405
|
-
methodName,
|
|
406
|
-
duration
|
|
407
|
-
);
|
|
353
|
+
FW.Entry.performanceMgr?.recordOperationMetric(moduleName, methodName, duration);
|
|
408
354
|
|
|
409
355
|
if (duration > 100) {
|
|
410
|
-
|
|
356
|
+
FW.Log.warn(`[${moduleName}] ${methodName} took ${duration}ms`);
|
|
411
357
|
}
|
|
412
358
|
|
|
413
359
|
return result;
|
|
414
360
|
} catch (error) {
|
|
415
361
|
const duration = Date.now() - startTime;
|
|
416
|
-
FW.Entry.performanceMgr?.recordOperationMetric(
|
|
417
|
-
moduleName,
|
|
418
|
-
`${methodName}_error`,
|
|
419
|
-
duration
|
|
420
|
-
);
|
|
362
|
+
FW.Entry.performanceMgr?.recordOperationMetric(moduleName, `${methodName}_error`, duration);
|
|
421
363
|
throw error;
|
|
422
364
|
}
|
|
423
365
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import FWLog from '../log/FWLog';
|
|
2
|
-
|
|
3
1
|
const { ccclass, property, menu } = cc._decorator;
|
|
4
2
|
|
|
5
3
|
interface EventTouch extends cc.Event.EventTouch {
|
|
@@ -59,9 +57,9 @@ export default class FWRollingViewNesting extends cc.Component {
|
|
|
59
57
|
let touch = event.touch;
|
|
60
58
|
if (viewGroup.content) {
|
|
61
59
|
if (viewGroup instanceof cc.PageView) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
viewGroup['_touchEndPosition'] = touch.getLocation();
|
|
61
|
+
}
|
|
62
|
+
viewGroup._handleReleaseLogic(touch);
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
if (
|