@ives_xxz/framework 2.1.15 → 2.1.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/FrameworkInitialize.ts +1 -1
- package/item/FWVirtualListItem.ts +1 -2
- package/manager/FWResManager.ts +12 -15
- package/package.json +1 -1
- package/registry/FWRegistry.ts +9 -14
- package/types/FW.d.ts +0 -16
- package/utils/FWObjectPool.ts +4 -6
package/FrameworkInitialize.ts
CHANGED
|
@@ -47,7 +47,7 @@ export function initializeFramework() {
|
|
|
47
47
|
FW.Registry = require('./registry/FWRegistry').FWRegistry;
|
|
48
48
|
FW.Framework = new (require('./Framework').Framework)();
|
|
49
49
|
FW.FrameworkBase = require('./FrameworkBase').FrameworkBase;
|
|
50
|
-
FW.Object = require('./
|
|
50
|
+
FW.Object = require('./utils/FWObject').FWObject;
|
|
51
51
|
FW.Entry = new (require('./entry/FWEntry').FWEntry)();
|
|
52
52
|
FW.Scene = require('./scene/FWScene').FWScene;
|
|
53
53
|
FW.Logic = require('./logic/FWLogic').FWLogic;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import FWVirtualViewComponent from '../component/FWVirtualViewComponent';
|
|
2
|
-
import FWObject from '../utils/FWObject';
|
|
3
2
|
|
|
4
3
|
const { ccclass, property, disallowMultiple, menu, executionOrder } = cc._decorator;
|
|
5
4
|
|
|
@@ -13,7 +12,7 @@ enum SelectedType {
|
|
|
13
12
|
@disallowMultiple()
|
|
14
13
|
@menu('CustomComponent/FWVirtualListItem')
|
|
15
14
|
@executionOrder(-5001) //先于List
|
|
16
|
-
export default class FWVirtualListItem extends
|
|
15
|
+
export default class FWVirtualListItem extends FW.Object {
|
|
17
16
|
onGet(args: any) {}
|
|
18
17
|
onPut() {}
|
|
19
18
|
onInit() {}
|
package/manager/FWResManager.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FWSystemConfig } from
|
|
2
|
-
import { FWLodash } from
|
|
3
|
-
import { FWAssetManager } from
|
|
4
|
-
import { FWBundleManager } from
|
|
5
|
-
import { FWManager } from
|
|
1
|
+
import { FWSystemConfig } from '../config/FWSystemConfig';
|
|
2
|
+
import { FWLodash } from '../utils/FWLodash';
|
|
3
|
+
import { FWAssetManager } from './FWAssetManager';
|
|
4
|
+
import { FWBundleManager } from './FWBundleManager';
|
|
5
|
+
import { FWManager } from './FWManager';
|
|
6
6
|
|
|
7
7
|
export class FWResManager extends FWManager implements FW.ResManager {
|
|
8
8
|
private bundleMgr: FW.BundleManager;
|
|
@@ -21,7 +21,6 @@ export class FWResManager extends FWManager implements FW.ResManager {
|
|
|
21
21
|
async loadBundle(bundleName: string): Promise<cc.AssetManager.Bundle> {
|
|
22
22
|
return await this.invoke<cc.AssetManager.Bundle>(
|
|
23
23
|
FW.Entry.promiseMgr.execute(async (resolve, reject, signal) => {
|
|
24
|
-
const bundle = await this.bundleMgr.load(bundleName);
|
|
25
24
|
const depends = FWLodash.cloneDeep(FW.Entry.getDepend(bundleName));
|
|
26
25
|
try {
|
|
27
26
|
if (depends && depends.length > 0) {
|
|
@@ -31,7 +30,7 @@ export class FWResManager extends FWManager implements FW.ResManager {
|
|
|
31
30
|
await this.loadBundle(depend);
|
|
32
31
|
|
|
33
32
|
const config = FW.Entry.getComponent<FW.AssetConfig>(
|
|
34
|
-
`${depend}${FW.SystemDefine.FWBindTag.CONFIG}
|
|
33
|
+
`${depend}${FW.SystemDefine.FWBindTag.CONFIG}`,
|
|
35
34
|
);
|
|
36
35
|
if (!config) continue;
|
|
37
36
|
const preLoad = config.preLoad;
|
|
@@ -62,12 +61,15 @@ export class FWResManager extends FWManager implements FW.ResManager {
|
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
}
|
|
64
|
+
|
|
65
|
+
const bundle = await this.bundleMgr.load(bundleName);
|
|
66
|
+
|
|
65
67
|
resolve(bundle);
|
|
66
68
|
} catch (e) {
|
|
67
69
|
reject(e);
|
|
68
70
|
}
|
|
69
71
|
}, FWSystemConfig.PromiseConfig.loadBundle).promise,
|
|
70
|
-
`loadBundle -> ${bundleName}
|
|
72
|
+
`loadBundle -> ${bundleName}`,
|
|
71
73
|
);
|
|
72
74
|
}
|
|
73
75
|
/**
|
|
@@ -84,10 +86,7 @@ export class FWResManager extends FWManager implements FW.ResManager {
|
|
|
84
86
|
return await this.assetMgr.loadSpineDataFromRemote(data);
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
async loadRemote<T extends cc.Asset = cc.Asset>(
|
|
88
|
-
url: string,
|
|
89
|
-
cb: (asset: any) => T
|
|
90
|
-
): Promise<T> {
|
|
89
|
+
async loadRemote<T extends cc.Asset = cc.Asset>(url: string, cb: (asset: any) => T): Promise<T> {
|
|
91
90
|
const asset = await this.assetMgr.loadRemote(url);
|
|
92
91
|
if (asset instanceof cc.Texture2D) {
|
|
93
92
|
return new cc.SpriteFrame(asset) as unknown as T;
|
|
@@ -134,9 +133,7 @@ export class FWResManager extends FWManager implements FW.ResManager {
|
|
|
134
133
|
* @param assetProperty
|
|
135
134
|
* @returns
|
|
136
135
|
*/
|
|
137
|
-
async loadAsset<T extends cc.Asset>(
|
|
138
|
-
assetProperty: FW.AssetProperty
|
|
139
|
-
): Promise<T> {
|
|
136
|
+
async loadAsset<T extends cc.Asset>(assetProperty: FW.AssetProperty): Promise<T> {
|
|
140
137
|
const res = await this.assetMgr.load(assetProperty);
|
|
141
138
|
return this.process<T>(res).asset as T;
|
|
142
139
|
}
|
package/package.json
CHANGED
package/registry/FWRegistry.ts
CHANGED
|
@@ -40,16 +40,7 @@ export abstract class FWRegistry implements FW.Registry {
|
|
|
40
40
|
readonly handle?: FW.Newable<FW.Handle>;
|
|
41
41
|
|
|
42
42
|
register(): void {
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
unRegister(): void {
|
|
46
|
-
this.bundleEnabled(false);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
bundleEnabled(enable?: boolean) {
|
|
50
|
-
const frameworkInvoke = enable ? FW.Framework.register : FW.Framework.unRegister;
|
|
51
|
-
const entryInvoke = enable ? FW.Entry.register : FW.Entry.unRegister;
|
|
52
|
-
frameworkInvoke.bind(FW.Framework)({
|
|
43
|
+
FW.Framework.register.bind(FW.Framework)({
|
|
53
44
|
bundleName: this.bundleName,
|
|
54
45
|
logic: this.logic,
|
|
55
46
|
data: this.data,
|
|
@@ -57,11 +48,15 @@ export abstract class FWRegistry implements FW.Registry {
|
|
|
57
48
|
sender: this.sender,
|
|
58
49
|
handle: this.handle,
|
|
59
50
|
});
|
|
60
|
-
|
|
51
|
+
}
|
|
52
|
+
unRegister(): void {
|
|
53
|
+
FW.Framework.unRegister.bind(FW.Framework)({
|
|
61
54
|
bundleName: this.bundleName,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
logic: this.logic,
|
|
56
|
+
data: this.data,
|
|
57
|
+
config: this.config,
|
|
58
|
+
sender: this.sender,
|
|
59
|
+
handle: this.handle,
|
|
65
60
|
});
|
|
66
61
|
}
|
|
67
62
|
}
|
package/types/FW.d.ts
CHANGED
|
@@ -2779,18 +2779,6 @@ declare namespace FW {
|
|
|
2779
2779
|
* bundle名字
|
|
2780
2780
|
*/
|
|
2781
2781
|
abstract readonly bundleName: string;
|
|
2782
|
-
/**
|
|
2783
|
-
* 是否自动释放
|
|
2784
|
-
*/
|
|
2785
|
-
readonly autoRelease?: boolean;
|
|
2786
|
-
/**
|
|
2787
|
-
* 场景名字
|
|
2788
|
-
*/
|
|
2789
|
-
readonly sceneName?: string;
|
|
2790
|
-
/**
|
|
2791
|
-
* 依赖
|
|
2792
|
-
*/
|
|
2793
|
-
readonly depend?: string[];
|
|
2794
2782
|
/**
|
|
2795
2783
|
* 逻辑
|
|
2796
2784
|
*/
|
|
@@ -2820,10 +2808,6 @@ declare namespace FW {
|
|
|
2820
2808
|
* 卸载
|
|
2821
2809
|
*/
|
|
2822
2810
|
unRegister(): void;
|
|
2823
|
-
/**
|
|
2824
|
-
* 启用bundle
|
|
2825
|
-
*/
|
|
2826
|
-
bundleEnabled(enable?: boolean);
|
|
2827
2811
|
}
|
|
2828
2812
|
}
|
|
2829
2813
|
|
package/utils/FWObjectPool.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import FWObject from './FWObject';
|
|
2
|
-
|
|
3
1
|
const POOL_DISABLE_POSITION: cc.Vec3 = cc.v3(50000, 50000);
|
|
4
2
|
|
|
5
|
-
export class FWObjectPool<T extends
|
|
3
|
+
export class FWObjectPool<T extends FW.Object = FW.Object> implements FW.ObjectPool {
|
|
6
4
|
private uniqueId: number;
|
|
7
5
|
private type: FW.SystemDefine.FWObjectType;
|
|
8
6
|
private enablePoolMap: Map<number, FW.ObjectProperty>;
|
|
@@ -51,7 +49,7 @@ export class FWObjectPool<T extends FWObject = FWObject> implements FW.ObjectPoo
|
|
|
51
49
|
if (property.node.uuid == uuid) {
|
|
52
50
|
return property;
|
|
53
51
|
}
|
|
54
|
-
} else if (arguments[0] instanceof
|
|
52
|
+
} else if (arguments[0] instanceof FW.Object) {
|
|
55
53
|
if (uniqueId == arguments[0]?.uniqueId) {
|
|
56
54
|
return property;
|
|
57
55
|
}
|
|
@@ -77,7 +75,7 @@ export class FWObjectPool<T extends FWObject = FWObject> implements FW.ObjectPoo
|
|
|
77
75
|
};
|
|
78
76
|
if (this.isEmpty()) {
|
|
79
77
|
node = cc.instantiate(this.node);
|
|
80
|
-
element = (node.getComponent(
|
|
78
|
+
element = (node.getComponent(FW.Object) as T) || undefined;
|
|
81
79
|
ObjectProperty.uniqueId = ++this.uniqueId;
|
|
82
80
|
ObjectProperty.node = node;
|
|
83
81
|
ObjectProperty.component = element;
|
|
@@ -142,7 +140,7 @@ export class FWObjectPool<T extends FWObject = FWObject> implements FW.ObjectPoo
|
|
|
142
140
|
let property: FW.ObjectProperty = this.findObjectProperty(arguments[0]);
|
|
143
141
|
|
|
144
142
|
const node: cc.Node = property.node;
|
|
145
|
-
const element = (node.getComponent(
|
|
143
|
+
const element = (node.getComponent(FW.Object) as T) || undefined;
|
|
146
144
|
|
|
147
145
|
if (!cc.isValid(node)) {
|
|
148
146
|
return;
|