@ives_xxz/framework 1.5.8 → 1.5.9
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/manager/FWLayerManager.ts +27 -19
- package/manager/FWPromiseManager.ts +1 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import FWLogic from "../logic/FWLogic";
|
|
|
9
9
|
import FWData from "../data/FWData";
|
|
10
10
|
import FWSocketSender from "../service/socket/FWSocketSender";
|
|
11
11
|
import FWSocketHandle from "../service/socket/FWSocketHandle";
|
|
12
|
+
import Framework from "../Framework";
|
|
12
13
|
|
|
13
14
|
const ADD_EXTERNAL_REFERENCE: string = "addExternalReference";
|
|
14
15
|
|
|
@@ -296,18 +297,39 @@ class FWLayerDataManager {
|
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
|
|
300
|
+
private findBundleNameByClassName(name: string): string | undefined {
|
|
301
|
+
const registeredComponents = Framework.getRegisteredComponents();
|
|
302
|
+
|
|
303
|
+
const bundleNames = Array.from(registeredComponents.keys());
|
|
304
|
+
|
|
305
|
+
for (const bundleName of bundleNames) {
|
|
306
|
+
if (this.doesClassNameContainBundleName(name, bundleName)) {
|
|
307
|
+
return bundleName;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return undefined;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
private doesClassNameContainBundleName(
|
|
314
|
+
className: string,
|
|
315
|
+
bundleName: string
|
|
316
|
+
): boolean {
|
|
317
|
+
const bundleNameLower = bundleName.toLowerCase();
|
|
318
|
+
const classNameLower = className.toLowerCase();
|
|
319
|
+
return classNameLower.includes(bundleNameLower);
|
|
320
|
+
}
|
|
321
|
+
|
|
299
322
|
/**
|
|
300
323
|
* 生成数据
|
|
301
324
|
*/
|
|
302
325
|
private generationData(ctr: FW.LayerController): FWLayerData {
|
|
303
326
|
const layerData = new FWLayerData();
|
|
304
327
|
const layerType = ctr.layerType;
|
|
328
|
+
const constructorName = ctr.constructor.name;
|
|
329
|
+
const bundleName = this.findBundleNameByClassName(constructorName);
|
|
330
|
+
const configTag = FWSystemDefine.FWBindTag.CONFIG;
|
|
305
331
|
|
|
306
|
-
ctr.config = FW.Entry.getComponent(
|
|
307
|
-
ctr.logic = FW.Entry.getComponent(FWLogic);
|
|
308
|
-
ctr.data = FW.Entry.getComponent(FWData);
|
|
309
|
-
ctr.sender = FW.Entry.getComponent(FWSocketSender);
|
|
310
|
-
ctr.handle = FW.Entry.getComponent(FWSocketHandle);
|
|
332
|
+
ctr.config = FW.Entry.getComponent(`${bundleName}${configTag}`);
|
|
311
333
|
|
|
312
334
|
layerData.layerRenderOrder = ctr.renderOrder;
|
|
313
335
|
layerData.layerAssetProperty = ctr.layerAssetProperty;
|
|
@@ -561,20 +583,6 @@ class FWLayerOpenManager {
|
|
|
561
583
|
return true;
|
|
562
584
|
}
|
|
563
585
|
|
|
564
|
-
/**
|
|
565
|
-
* 获取undefined结果
|
|
566
|
-
*/
|
|
567
|
-
private getUndefinedResult<Ctr>(isAsync: boolean): Promise<Ctr> | Ctr {
|
|
568
|
-
return isAsync ? Promise.resolve(undefined) : undefined;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* 包装结果
|
|
573
|
-
*/
|
|
574
|
-
private wrapResult<Ctr>(result: Ctr, isAsync: boolean): Promise<Ctr> | Ctr {
|
|
575
|
-
return isAsync ? Promise.resolve(result) : result;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
586
|
/**
|
|
579
587
|
* 异步生成Layer
|
|
580
588
|
*/
|
|
@@ -29,6 +29,7 @@ export default class FWPromiseManager
|
|
|
29
29
|
const retryInterval = options.retryInterval || 0;
|
|
30
30
|
let retryCount = 0;
|
|
31
31
|
let timerSchedule: FW.TimerSchedule;
|
|
32
|
+
|
|
32
33
|
const createPromise = (): Promise<T> => {
|
|
33
34
|
return new Promise<T>((resolve, reject) => {
|
|
34
35
|
if (options.timeout && options.timeout > 0) {
|