@ives_xxz/framework 1.6.1 → 1.6.3
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/FW.d.ts +1 -0
- package/controller/FWLayerController.ts +14 -25
- package/expand/FWDecorator.ts +18 -8
- package/language/FWLanguage.ts +9 -6
- package/manager/FWPromiseManager.ts +1 -0
- package/package.json +2 -4
- package/service/http/FWHttp.ts +3 -1
package/FW.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { FWSystemDefine } from
|
|
2
|
-
import FWLayer from
|
|
3
|
-
import { FWLayerData } from
|
|
4
|
-
import { FrameworkBase } from
|
|
5
|
-
export abstract class FWLayerController
|
|
6
|
-
extends FrameworkBase
|
|
7
|
-
implements FW.LayerController
|
|
8
|
-
{
|
|
1
|
+
import { FWSystemDefine } from '../define/FWSystemDefine';
|
|
2
|
+
import FWLayer from '../layer/FWLayer';
|
|
3
|
+
import { FWLayerData } from '../manager/FWLayerManager';
|
|
4
|
+
import { FrameworkBase } from '../FrameworkBase';
|
|
5
|
+
export abstract class FWLayerController extends FrameworkBase implements FW.LayerController {
|
|
9
6
|
readonly entry: FW.Entry = FW.Entry;
|
|
10
7
|
/** layer数据 */
|
|
11
8
|
layerData: FWLayerData;
|
|
@@ -78,20 +75,16 @@ export abstract class FWLayerController
|
|
|
78
75
|
referenceNode: cc.Node,
|
|
79
76
|
type?: {
|
|
80
77
|
prototype: T;
|
|
81
|
-
}
|
|
78
|
+
},
|
|
82
79
|
) {
|
|
83
80
|
return this.find(path, referenceNode)?.getComponent<T>(type);
|
|
84
81
|
}
|
|
85
82
|
|
|
86
|
-
getComponentsInChildren<T extends cc.Component = cc.Component>(type: {
|
|
87
|
-
prototype: T;
|
|
88
|
-
}) {
|
|
83
|
+
getComponentsInChildren<T extends cc.Component = cc.Component>(type: { prototype: T }) {
|
|
89
84
|
return this.layer.getComponentsInChildren(type);
|
|
90
85
|
}
|
|
91
86
|
|
|
92
|
-
getComponentInChildren<T extends cc.Component = cc.Component>(type: {
|
|
93
|
-
prototype: T;
|
|
94
|
-
}) {
|
|
87
|
+
getComponentInChildren<T extends cc.Component = cc.Component>(type: { prototype: T }) {
|
|
95
88
|
return this.layer.getComponentInChildren(type);
|
|
96
89
|
}
|
|
97
90
|
|
|
@@ -100,16 +93,12 @@ export abstract class FWLayerController
|
|
|
100
93
|
*/
|
|
101
94
|
registerEvent(args: FW.RegisterArgs): void {
|
|
102
95
|
args.target = args.target || this;
|
|
103
|
-
args.CCEvent?.forEach(
|
|
104
|
-
|
|
105
|
-
);
|
|
106
|
-
args.FWEvent?.forEach(
|
|
107
|
-
(v) => (v.responseInterval = this.defaultResponseInterval)
|
|
108
|
-
);
|
|
96
|
+
args.CCEvent?.forEach((v) => (v.responseInterval = this.defaultResponseInterval));
|
|
97
|
+
args.FWEvent?.forEach((v) => (v.responseInterval = this.defaultResponseInterval));
|
|
109
98
|
return this.entry.uiMgr.register({
|
|
110
99
|
target: this,
|
|
111
|
-
CCEvent: args?.CCEvent
|
|
112
|
-
FWEvent: args?.FWEvent
|
|
100
|
+
CCEvent: args?.CCEvent || undefined,
|
|
101
|
+
FWEvent: args?.FWEvent || undefined,
|
|
113
102
|
});
|
|
114
103
|
}
|
|
115
104
|
|
|
@@ -117,7 +106,7 @@ export abstract class FWLayerController
|
|
|
117
106
|
target: cc.Node,
|
|
118
107
|
cb: (event: cc.Event) => void,
|
|
119
108
|
responseInterval?: number,
|
|
120
|
-
eventName?: string
|
|
109
|
+
eventName?: string,
|
|
121
110
|
): this {
|
|
122
111
|
this.registerEvent({
|
|
123
112
|
target: this,
|
|
@@ -138,7 +127,7 @@ export abstract class FWLayerController
|
|
|
138
127
|
eventName: string,
|
|
139
128
|
cb: (event: cc.Event) => void,
|
|
140
129
|
target?: cc.Node,
|
|
141
|
-
responseInterval?: number
|
|
130
|
+
responseInterval?: number,
|
|
142
131
|
): this {
|
|
143
132
|
this.registerEvent({
|
|
144
133
|
target: target || this,
|
package/expand/FWDecorator.ts
CHANGED
|
@@ -336,10 +336,15 @@ export function AutoRegisterCCEvent(nodePath: string, eventName?: string) {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
if (targetNode) {
|
|
339
|
-
this.
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
339
|
+
this.registerEvent({
|
|
340
|
+
CCEvent: [
|
|
341
|
+
{
|
|
342
|
+
eventName: evt,
|
|
343
|
+
cb: originalMethod.bind(this),
|
|
344
|
+
target: targetNode,
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
});
|
|
343
348
|
FWLog.debug(`自动注册事件: ${nodePath} -> ${propertyKey}`);
|
|
344
349
|
} else {
|
|
345
350
|
FWLog.warn(`自动注册事件失败: 未找到节点 ${nodePath}`);
|
|
@@ -359,10 +364,15 @@ export function AutoRegisterFWEvent(eventName: any) {
|
|
|
359
364
|
|
|
360
365
|
target.onInit = function (...args) {
|
|
361
366
|
originalOnInit?.call(this, args);
|
|
362
|
-
this.
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
367
|
+
this.registerEvent({
|
|
368
|
+
CCEvent: [
|
|
369
|
+
{
|
|
370
|
+
eventName: eventName,
|
|
371
|
+
cb: originalMethod.bind(this),
|
|
372
|
+
target: this,
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
});
|
|
366
376
|
};
|
|
367
377
|
};
|
|
368
378
|
}
|
package/language/FWLanguage.ts
CHANGED
|
@@ -38,14 +38,17 @@ export default abstract class FWLanguage extends cc.Component {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
protected onLoad(): void {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
this.registerEvent({
|
|
42
|
+
FWEvent: [
|
|
43
|
+
{
|
|
44
|
+
eventName: FWEventDefine.LanguageEvent.LANGUAGE_CHANGE,
|
|
45
|
+
cb: () => {
|
|
44
46
|
this._language = FW.Entry.languageMgr.getLanguageIndex();
|
|
45
47
|
this.onLanguageChange();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
});
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
protected onEnable(): void {
|
|
@@ -61,6 +61,7 @@ export default class FWPromiseManager
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const onAbort = () => {
|
|
64
|
+
FWLog.debug("promise abort");
|
|
64
65
|
timerSchedule?.unSchedule();
|
|
65
66
|
if (promiseProxy.status === FWSystemDefine.FWPromiseStatus.PENDING) {
|
|
66
67
|
promiseProxy.status = FWSystemDefine.FWPromiseStatus.CANCELLED;
|
package/package.json
CHANGED
package/service/http/FWHttp.ts
CHANGED
|
@@ -77,7 +77,9 @@ export default class FWHttp extends FWService {
|
|
|
77
77
|
...FWSystemConfig.PromiseConfig.http,
|
|
78
78
|
retryCondition(error, retryCount) {
|
|
79
79
|
return (
|
|
80
|
-
|
|
80
|
+
error ||
|
|
81
|
+
xhr.readyState != 4 ||
|
|
82
|
+
(xhr.status !== 200 && retryCount < 3)
|
|
81
83
|
);
|
|
82
84
|
},
|
|
83
85
|
}
|