@cc-component/cc-ex-component 1.5.4 → 1.5.5
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/assets/core/ViewModel.ts
CHANGED
|
@@ -295,12 +295,7 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
|
|
|
295
295
|
|
|
296
296
|
|
|
297
297
|
managerData() {
|
|
298
|
-
|
|
299
|
-
const module = this.config.module;
|
|
300
|
-
const name = this.config.name.replace('Window', '');
|
|
301
|
-
const manager: any = (js.getClassByName(`${module}Manager`))
|
|
302
|
-
manager.Ins[`${name}Data`] = this.viewModel
|
|
303
|
-
}
|
|
298
|
+
ExComponentModule.EmitUIWindow(this.config)
|
|
304
299
|
}
|
|
305
300
|
|
|
306
301
|
|
|
@@ -15,6 +15,7 @@ export class ExComponentModule {
|
|
|
15
15
|
param: { click: (comp: Button) => void }
|
|
16
16
|
paramSprite: { loadSprite: (param: { bundle: string, path: string }) => Promise<SpriteFrame>, getSprite: (param: { bundle: string, path: string }) => SpriteFrame }
|
|
17
17
|
paramSpine: { loadSpine: (param: { bundle: string, path: string }) => Promise<sp.SkeletonData>, getSpine: (param: { bundle: string, path: string }) => sp.SkeletonData }
|
|
18
|
+
paramUIWindow: { onLoad: (config: any) => void }
|
|
18
19
|
|
|
19
20
|
ResetBaseWindow: string = "BaseWindow";
|
|
20
21
|
static Init() {
|
|
@@ -30,6 +31,9 @@ export class ExComponentModule {
|
|
|
30
31
|
if (!isGet) ExComponentModule.Ins.ResetBaseWindow = name
|
|
31
32
|
return ExComponentModule.Ins.ResetBaseWindow
|
|
32
33
|
}
|
|
34
|
+
static OnVMManager(param: { onLoad: (config: any) => void }) {
|
|
35
|
+
ExComponentModule.Ins.paramUIWindow = param
|
|
36
|
+
}
|
|
33
37
|
|
|
34
38
|
static OnLoadSprite(param: { loadSprite: (param: { bundle: string, path: string }) => Promise<SpriteFrame>, getSprite: (param: { bundle: string, path: string }) => SpriteFrame }) {
|
|
35
39
|
ExComponentModule.Ins.paramSprite = param
|
|
@@ -56,6 +60,10 @@ export class ExComponentModule {
|
|
|
56
60
|
static EmitGetSpine(param: any): sp.SkeletonData {
|
|
57
61
|
return ExComponentModule.Ins.paramSpine?.getSpine?.(param)
|
|
58
62
|
}
|
|
63
|
+
|
|
64
|
+
static EmitUIWindow(this: any, param: any) {
|
|
65
|
+
return ExComponentModule.Ins.paramUIWindow?.onLoad?.call(this, param)
|
|
66
|
+
}
|
|
59
67
|
}
|
|
60
68
|
window.ExComponentModule = ExComponentModule;
|
|
61
69
|
|
|
@@ -13,13 +13,37 @@ declare global {
|
|
|
13
13
|
function OnLoadSpine(param: { loadSpine: (param: { bundle: string, path: string }) => Promise<sp.SkeletonData>, getSpine: (param: { bundle: string, path: string }) => sp.SkeletonData });
|
|
14
14
|
/**重置基础窗口 */
|
|
15
15
|
function ResetBaseWindow(name?: string, isGet?: boolean);
|
|
16
|
+
/**监听UI onLoad 给模块manager 赋值 */
|
|
17
|
+
function OnVMManager(param: {
|
|
18
|
+
onLoad: (config: {
|
|
19
|
+
module: string,
|
|
20
|
+
layer: string,
|
|
21
|
+
path: string,
|
|
22
|
+
bundle: string,
|
|
23
|
+
name?: string,/**窗口名称 */
|
|
24
|
+
index?: number,
|
|
25
|
+
is_load_sub?: boolean,
|
|
26
|
+
/**是否记录-不记录可重复打开窗口 */
|
|
27
|
+
is_record?: boolean,
|
|
28
|
+
}) => void
|
|
29
|
+
});
|
|
16
30
|
/**组件:内部使用方法 */
|
|
17
31
|
function Emit(btn: Button);
|
|
18
|
-
|
|
19
32
|
//#region 组件:内部使用方法----------------
|
|
20
33
|
function EmitLoadSprite(param: any): Promise<SpriteFrame>;
|
|
21
34
|
function EmitGetSprite(param: any): SpriteFrame;
|
|
22
35
|
function EmitLoadSpine(param: any): Promise<sp.SkeletonData>;
|
|
23
36
|
function EmitGetSpine(param: any): sp.SkeletonData;
|
|
37
|
+
function EmitUIWindow(this: any, param: {
|
|
38
|
+
module: string,
|
|
39
|
+
layer: string,
|
|
40
|
+
path: string,
|
|
41
|
+
bundle: string,
|
|
42
|
+
name?: string,/**窗口名称 */
|
|
43
|
+
index?: number,
|
|
44
|
+
is_load_sub?: boolean,
|
|
45
|
+
/**是否记录-不记录可重复打开窗口 */
|
|
46
|
+
is_record?: boolean,
|
|
47
|
+
});
|
|
24
48
|
}
|
|
25
49
|
}
|