dzkcc-mflow 0.0.1 → 0.0.2
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/dist/App.d.ts +22 -22
- package/dist/App.js +27 -27
- package/dist/_virtual/_tslib.js +30 -30
- package/dist/core/Api.d.ts +53 -53
- package/dist/core/Core.d.ts +18 -18
- package/dist/core/Core.js +78 -78
- package/dist/core/Decorators.d.ts +7 -7
- package/dist/core/Decorators.js +99 -99
- package/dist/core/ICocosResManager.d.ts +11 -11
- package/dist/core/ServiceLocator.d.ts +7 -7
- package/dist/core/ServiceLocator.js +31 -31
- package/dist/core/index.d.ts +5 -5
- package/dist/libs/BaseView.d.ts +21 -21
- package/dist/libs/BaseView.js +78 -78
- package/dist/libs/Broadcaster.d.ts +101 -101
- package/dist/libs/Broadcaster.js +240 -240
- package/dist/libs/CocosCore.d.ts +5 -5
- package/dist/libs/CocosCore.js +16 -16
- package/dist/libs/ResLoader.d.ts +10 -10
- package/dist/libs/ResLoader.js +76 -74
- package/dist/libs/UIManager.d.ts +34 -34
- package/dist/libs/UIManager.js +251 -251
- package/dist/libs/UIRoot.d.ts +4 -4
- package/dist/libs/UIRoot.js +4 -4
- package/dist/libs/index.d.ts +6 -6
- package/dist/mflow-tools.zip +0 -0
- package/dist/utils/ArrayExt.d.ts +67 -67
- package/dist/utils/ArrayExt.js +298 -298
- package/dist/utils/ArrayUtil.d.ts +41 -41
- package/dist/utils/ArrayUtil.js +93 -93
- package/dist/utils/CameraUtil.d.ts +10 -10
- package/dist/utils/CameraUtil.js +23 -23
- package/dist/utils/ImageUtil.d.ts +33 -33
- package/dist/utils/ImageUtil.js +92 -92
- package/dist/utils/MathUtil.d.ts +213 -213
- package/dist/utils/MathUtil.js +435 -435
- package/dist/utils/ObjectUtil.d.ts +24 -24
- package/dist/utils/ObjectUtil.js +58 -58
- package/dist/utils/PlatformUtil.d.ts +9 -9
- package/dist/utils/PlatformUtil.js +27 -27
- package/dist/utils/RotateUtil.d.ts +30 -30
- package/dist/utils/RotateUtil.js +63 -63
- package/dist/utils/StringUtil.d.ts +107 -107
- package/dist/utils/StringUtil.js +249 -249
- package/dist/utils/TimeUtil.d.ts +31 -31
- package/dist/utils/TimeUtil.js +85 -85
- package/dist/utils/index.d.ts +9 -9
- package/package.json +1 -1
package/dist/libs/ResLoader.js
CHANGED
|
@@ -1,80 +1,82 @@
|
|
|
1
1
|
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
2
|
import { assetManager, Prefab, Asset, SpriteFrame, sp } from 'cc';
|
|
3
3
|
|
|
4
|
-
const DefaultBundle = "resources";
|
|
5
|
-
class ResLoader {
|
|
6
|
-
loadAsset(path, type, nameOrUrl = DefaultBundle) {
|
|
7
|
-
//TODO: bundle.release和assetManager.releaseAsset的区别?
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
4
|
+
const DefaultBundle = "resources";
|
|
5
|
+
class ResLoader {
|
|
6
|
+
loadAsset(path, type, nameOrUrl = DefaultBundle) {
|
|
7
|
+
//TODO: bundle.release和assetManager.releaseAsset的区别?
|
|
8
|
+
//TODO: prefab是否需要addRef,prefab被克隆出来的节点被销毁时,对应的prefab如何处理?
|
|
9
|
+
if (assetManager.assets.has(path)) {
|
|
10
|
+
const asset = assetManager.assets.get(path);
|
|
11
|
+
asset.addRef();
|
|
12
|
+
return Promise.resolve(asset);
|
|
13
|
+
}
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
assetManager.loadBundle(nameOrUrl, (err, bundle) => {
|
|
16
|
+
if (err) {
|
|
17
|
+
reject(err);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
bundle.load(path, type, (err, data) => {
|
|
21
|
+
if (err) {
|
|
22
|
+
reject(err);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
data.addRef();
|
|
26
|
+
resolve(data);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
loadPrefab(path, nameOrUrl = DefaultBundle) {
|
|
34
|
+
return this.loadAsset(path, Prefab, nameOrUrl);
|
|
35
|
+
}
|
|
36
|
+
loadSpriteFrame(ref, path, nameOrUrl = DefaultBundle) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const sf = yield this.loadAsset(path, SpriteFrame, nameOrUrl);
|
|
39
|
+
if (ref === null || ref === void 0 ? void 0 : ref.isValid) {
|
|
40
|
+
ref.spriteFrame = sf;
|
|
41
|
+
return Promise.resolve(sf);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// 没有引用到的资源,释放掉
|
|
45
|
+
this.release(path, SpriteFrame, nameOrUrl);
|
|
46
|
+
return Promise.reject(new Error("Sprite is not valid"));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
loadSpine(ref, path, nameOrUrl = DefaultBundle) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const spine = yield this.loadAsset(path, sp.SkeletonData);
|
|
53
|
+
if (ref === null || ref === void 0 ? void 0 : ref.isValid) {
|
|
54
|
+
ref.skeletonData = spine;
|
|
55
|
+
return Promise.resolve(spine);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// 没有引用到的资源,释放掉
|
|
59
|
+
this.release(path, sp.SkeletonData, nameOrUrl);
|
|
60
|
+
return Promise.reject(new Error("Spine is not valid"));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
release(pathOrAsset, type, nameOrUrl = DefaultBundle) {
|
|
65
|
+
if (typeof pathOrAsset === "string") {
|
|
66
|
+
const bundle = assetManager.getBundle(nameOrUrl);
|
|
67
|
+
const asset = bundle === null || bundle === void 0 ? void 0 : bundle.get(pathOrAsset, type);
|
|
68
|
+
asset === null || asset === void 0 ? void 0 : asset.decRef();
|
|
69
|
+
if ((asset === null || asset === void 0 ? void 0 : asset.refCount) === 0) {
|
|
70
|
+
bundle === null || bundle === void 0 ? void 0 : bundle.release(pathOrAsset, type);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (pathOrAsset instanceof Asset) {
|
|
74
|
+
pathOrAsset.decRef();
|
|
75
|
+
if (pathOrAsset.refCount === 0) {
|
|
76
|
+
assetManager.releaseAsset(pathOrAsset);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
export { ResLoader };
|
package/dist/libs/UIManager.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { Component } from "cc";
|
|
2
|
-
import { IUIManager, IView } from "../core";
|
|
3
|
-
type ICocosView = IView & Component;
|
|
4
|
-
declare abstract class CcocosUIManager implements IUIManager {
|
|
5
|
-
getTopView(): IView | undefined;
|
|
6
|
-
open<T extends IView>(viewType: new () => T, args?: any): Promise<T>;
|
|
7
|
-
close<T extends IView>(viewortype: T | (new () => T), destory?: boolean): void;
|
|
8
|
-
openAndPush<T extends IView>(viewType: new () => T, group: string, args?: any): Promise<T>;
|
|
9
|
-
closeAndPop(group: string, destroy?: boolean): void;
|
|
10
|
-
clearStack(group: string, destroy?: boolean): void;
|
|
11
|
-
protected abstract internalOpen<T extends ICocosView>(viewType: new () => T, args?: any): Promise<T>;
|
|
12
|
-
protected abstract internalClose<T extends ICocosView>(viewortype: T | (new () => T), destory?: boolean): void;
|
|
13
|
-
protected abstract internalOpenAndPush<T extends ICocosView>(viewType: new () => T, group: string, args?: any): Promise<T>;
|
|
14
|
-
protected abstract internalCloseAndPop(group: string, destroy?: boolean): void;
|
|
15
|
-
protected abstract internalClearStack(group: string, destroy?: boolean): void;
|
|
16
|
-
protected abstract internalGetTopView(): ICocosView | undefined;
|
|
17
|
-
}
|
|
18
|
-
export declare class UIManager extends CcocosUIManager {
|
|
19
|
-
private _cache;
|
|
20
|
-
private _groupStacks;
|
|
21
|
-
constructor();
|
|
22
|
-
private _getPrefabPath;
|
|
23
|
-
private _adjustMaskLayer;
|
|
24
|
-
private _blockInput;
|
|
25
|
-
private _load;
|
|
26
|
-
private _remove;
|
|
27
|
-
protected internalGetTopView(): ICocosView | undefined;
|
|
28
|
-
protected internalOpen<T extends ICocosView>(viewType: new () => T, args?: any): Promise<T>;
|
|
29
|
-
protected internalClose<T extends ICocosView>(viewortype: T | (new () => T), destroy?: boolean): void;
|
|
30
|
-
protected internalOpenAndPush<T extends ICocosView>(viewType: new () => T, group: string, args?: any): Promise<T>;
|
|
31
|
-
protected internalCloseAndPop(group: string, destroy?: boolean): void;
|
|
32
|
-
protected internalClearStack(group: string, destroy?: boolean): void;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
1
|
+
import { Component } from "cc";
|
|
2
|
+
import { IUIManager, IView } from "../core";
|
|
3
|
+
type ICocosView = IView & Component;
|
|
4
|
+
declare abstract class CcocosUIManager implements IUIManager {
|
|
5
|
+
getTopView(): IView | undefined;
|
|
6
|
+
open<T extends IView>(viewType: new () => T, args?: any): Promise<T>;
|
|
7
|
+
close<T extends IView>(viewortype: T | (new () => T), destory?: boolean): void;
|
|
8
|
+
openAndPush<T extends IView>(viewType: new () => T, group: string, args?: any): Promise<T>;
|
|
9
|
+
closeAndPop(group: string, destroy?: boolean): void;
|
|
10
|
+
clearStack(group: string, destroy?: boolean): void;
|
|
11
|
+
protected abstract internalOpen<T extends ICocosView>(viewType: new () => T, args?: any): Promise<T>;
|
|
12
|
+
protected abstract internalClose<T extends ICocosView>(viewortype: T | (new () => T), destory?: boolean): void;
|
|
13
|
+
protected abstract internalOpenAndPush<T extends ICocosView>(viewType: new () => T, group: string, args?: any): Promise<T>;
|
|
14
|
+
protected abstract internalCloseAndPop(group: string, destroy?: boolean): void;
|
|
15
|
+
protected abstract internalClearStack(group: string, destroy?: boolean): void;
|
|
16
|
+
protected abstract internalGetTopView(): ICocosView | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare class UIManager extends CcocosUIManager {
|
|
19
|
+
private _cache;
|
|
20
|
+
private _groupStacks;
|
|
21
|
+
constructor();
|
|
22
|
+
private _getPrefabPath;
|
|
23
|
+
private _adjustMaskLayer;
|
|
24
|
+
private _blockInput;
|
|
25
|
+
private _load;
|
|
26
|
+
private _remove;
|
|
27
|
+
protected internalGetTopView(): ICocosView | undefined;
|
|
28
|
+
protected internalOpen<T extends ICocosView>(viewType: new () => T, args?: any): Promise<T>;
|
|
29
|
+
protected internalClose<T extends ICocosView>(viewortype: T | (new () => T), destroy?: boolean): void;
|
|
30
|
+
protected internalOpenAndPush<T extends ICocosView>(viewType: new () => T, group: string, args?: any): Promise<T>;
|
|
31
|
+
protected internalCloseAndPop(group: string, destroy?: boolean): void;
|
|
32
|
+
protected internalClearStack(group: string, destroy?: boolean): void;
|
|
33
|
+
}
|
|
34
|
+
export {};
|