@ives_xxz/framework 1.5.15 → 1.5.17
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/expand/FWDecorator.ts +1 -2
- package/manager/FWBundleManager.ts +15 -11
- package/manager/FWLayerManager.ts +1 -2
- package/manager/FWResManager.ts +55 -1
- package/package.json +1 -1
package/expand/FWDecorator.ts
CHANGED
|
@@ -7,7 +7,7 @@ type PropertyDecorator = (
|
|
|
7
7
|
$descriptorOrInitializer?: any
|
|
8
8
|
) => void;
|
|
9
9
|
|
|
10
|
-
const searchChild = function (node: cc.Node, name: string) {
|
|
10
|
+
export const searchChild = function (node: cc.Node, name: string) {
|
|
11
11
|
let ret = node.getChildByName(name);
|
|
12
12
|
if (ret) return ret;
|
|
13
13
|
for (let i = 0; i < node.children.length; i++) {
|
|
@@ -289,7 +289,6 @@ export function RegisterEvents(events: FW.RegisterEventArgs[]) {
|
|
|
289
289
|
const originalMethod = descriptor.value;
|
|
290
290
|
|
|
291
291
|
descriptor.value = function (...args: any[]) {
|
|
292
|
-
// 在初始化时自动注册事件
|
|
293
292
|
if (this.registerEvent) {
|
|
294
293
|
this.registerEvent(events);
|
|
295
294
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { FWManager } from
|
|
2
|
-
import FWLog from
|
|
3
|
-
import Framework from
|
|
4
|
-
import { FWSystemConfig } from
|
|
1
|
+
import { FWManager } from "./FWManager";
|
|
2
|
+
import FWLog from "../log/FWLog";
|
|
3
|
+
import Framework from "../Framework";
|
|
4
|
+
import { FWSystemConfig } from "../config/FWSystemConfig";
|
|
5
|
+
import { FWLodash } from "../utils/FWLodash";
|
|
5
6
|
|
|
6
7
|
export class FWBundleManager extends FWManager implements FW.BundleManager {
|
|
7
8
|
bundleMap: Map<string, cc.AssetManager.Bundle>;
|
|
@@ -35,25 +36,28 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
|
|
|
35
36
|
return await this.invoke(
|
|
36
37
|
FW.Entry.promiseMgr.execute((resolve, reject, signal) => {
|
|
37
38
|
const remote = this.remoteBundleConfigMap.get(bundleName);
|
|
38
|
-
const url = remote ? remote.url :
|
|
39
|
+
const url = remote ? remote.url : "";
|
|
39
40
|
const path = `${url}${bundleName}`;
|
|
40
41
|
cc.assetManager.loadBundle(
|
|
41
42
|
path,
|
|
42
|
-
{
|
|
43
|
-
|
|
43
|
+
{
|
|
44
|
+
version: this.remoteBundleConfigMap.get(bundleName)?.version || "",
|
|
45
|
+
},
|
|
46
|
+
async (err: Error, bundle: cc.AssetManager.Bundle) => {
|
|
44
47
|
if (err || !bundle) {
|
|
45
48
|
FWLog.error(`"加载bundle失败:"${bundleName}!`);
|
|
46
49
|
reject(err);
|
|
47
50
|
}
|
|
48
|
-
this.bundleMap.set(bundleName, bundle);
|
|
49
51
|
|
|
50
52
|
Framework.createRegistry(bundleName)?.register();
|
|
51
53
|
|
|
54
|
+
this.bundleMap.set(bundleName, bundle);
|
|
55
|
+
|
|
52
56
|
resolve(bundle);
|
|
53
|
-
}
|
|
57
|
+
}
|
|
54
58
|
);
|
|
55
59
|
}, FWSystemConfig.PromiseConfig.loadBundle).promise,
|
|
56
|
-
`loadBundle -> ${bundleName}
|
|
60
|
+
`loadBundle -> ${bundleName}`
|
|
57
61
|
);
|
|
58
62
|
}
|
|
59
63
|
|
|
@@ -64,7 +68,7 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
|
|
|
64
68
|
*/
|
|
65
69
|
get(bundleName: string): cc.AssetManager.Bundle {
|
|
66
70
|
if (!this.has(bundleName)) {
|
|
67
|
-
FWLog.error(
|
|
71
|
+
FWLog.error("获取bundle失败,请先加载!");
|
|
68
72
|
return undefined;
|
|
69
73
|
}
|
|
70
74
|
return this.bundleMap.get(bundleName);
|
|
@@ -54,11 +54,10 @@ export class FWLayerManager extends FWManager implements FW.LayerManager {
|
|
|
54
54
|
/**
|
|
55
55
|
* 同步打开
|
|
56
56
|
*/
|
|
57
|
-
@PerformanceMonitor("openSync")
|
|
58
57
|
openSync<Ctr extends FW.LayerController = FW.LayerController>(
|
|
59
58
|
data: FW.LayerOpenArgs
|
|
60
59
|
): Ctr {
|
|
61
|
-
return this.openManager.openLayerSync(data) as
|
|
60
|
+
return this.openManager.openLayerSync(data) as Ctr;
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
/**
|
package/manager/FWResManager.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import FWAssetConfig from "../config/FWAssetConfig";
|
|
2
|
+
import { FWSystemConfig } from "../config/FWSystemConfig";
|
|
3
|
+
import { FWSystemDefine } from "../define/FWSystemDefine";
|
|
4
|
+
import FWLog from "../log/FWLog";
|
|
5
|
+
import { FWLodash } from "../utils/FWLodash";
|
|
1
6
|
import { FWAssetManager } from "./FWAssetManager";
|
|
2
7
|
import { FWBundleManager } from "./FWBundleManager";
|
|
3
8
|
import { FWManager } from "./FWManager";
|
|
@@ -19,7 +24,56 @@ export class FWResManager extends FWManager implements FW.ResManager {
|
|
|
19
24
|
* @returns
|
|
20
25
|
*/
|
|
21
26
|
async loadBundle(bundleName: string): Promise<cc.AssetManager.Bundle> {
|
|
22
|
-
return this.
|
|
27
|
+
return await this.invoke<cc.AssetManager.Bundle>(
|
|
28
|
+
FW.Entry.promiseMgr.execute(async (resolve, reject, signal) => {
|
|
29
|
+
const bundle = await this.bundleMgr.load(bundleName);
|
|
30
|
+
const depends = FWLodash.cloneDeep(FW.Entry.getDepend(bundleName));
|
|
31
|
+
try {
|
|
32
|
+
if (depends && depends.length > 0) {
|
|
33
|
+
for (const depend of depends) {
|
|
34
|
+
if (this.bundleMgr.has(depend)) continue;
|
|
35
|
+
|
|
36
|
+
await this.loadBundle(depend);
|
|
37
|
+
|
|
38
|
+
const config = FW.Entry.getComponent<FWAssetConfig>(
|
|
39
|
+
`${depend}${FWSystemDefine.FWBindTag.CONFIG}`
|
|
40
|
+
);
|
|
41
|
+
if (!config) continue;
|
|
42
|
+
const preLoad = config.preLoad;
|
|
43
|
+
const keys = Object.keys(preLoad);
|
|
44
|
+
|
|
45
|
+
if (keys.length > 0) {
|
|
46
|
+
const find = (o) => {
|
|
47
|
+
Object.keys(o).forEach(async (key) => {
|
|
48
|
+
const value: FW.AssetProperty = o[key];
|
|
49
|
+
const path: string = value.path;
|
|
50
|
+
const type: string = value.type;
|
|
51
|
+
const d: string = value.bundle || depend;
|
|
52
|
+
const priorityLoaded = value.priorityLoaded || false;
|
|
53
|
+
if (path) {
|
|
54
|
+
if (priorityLoaded) {
|
|
55
|
+
await this.assetMgr.load({
|
|
56
|
+
path: path,
|
|
57
|
+
bundle: d,
|
|
58
|
+
type: type,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
find(value);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
find(config.preLoad);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
resolve(bundle);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
reject(e);
|
|
73
|
+
}
|
|
74
|
+
}, FWSystemConfig.PromiseConfig.loadBundle).promise,
|
|
75
|
+
`loadBundleDepend -> ${bundleName}`
|
|
76
|
+
);
|
|
23
77
|
}
|
|
24
78
|
/**
|
|
25
79
|
* 从远程加载spine动画
|