@cc-component/cc-ex-component 1.8.4 → 1.8.7
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.
|
@@ -54,7 +54,8 @@ export class BaseWindow extends BaseReference {
|
|
|
54
54
|
public pop(param?: { is_anim?: boolean, param?: any, finish?: Function }) {
|
|
55
55
|
//this.maskAinm(false)
|
|
56
56
|
this.paramClose = param;
|
|
57
|
-
this.param?.
|
|
57
|
+
//this.param?.close?.(param?.param)//回调方法
|
|
58
|
+
ExComponentModule.EmitCloseWindow(this.param, param?.param)
|
|
58
59
|
if (param?.is_anim && this.root && this.maskOpacity) {
|
|
59
60
|
this.hideAnim()
|
|
60
61
|
} else {
|
|
@@ -87,8 +88,8 @@ export class BaseWindow extends BaseReference {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
destroyNode() {
|
|
90
|
-
this.paramClose?.
|
|
91
|
-
|
|
91
|
+
this.paramClose?.finish()
|
|
92
|
+
if (this.node && this.node.isValid) { this.destroyWindow() }
|
|
92
93
|
}
|
|
93
94
|
maskAinm(show: boolean) {
|
|
94
95
|
if (!this.maskOpacity) return
|
package/assets/core/ViewModel.ts
CHANGED
|
@@ -537,23 +537,23 @@ function updateStatus(data: IBindingData, com: Component, value: any, self: any)
|
|
|
537
537
|
switch (data.type) {
|
|
538
538
|
case 'cc.Label':
|
|
539
539
|
if (data.reset) {
|
|
540
|
-
if (value
|
|
540
|
+
if (value != undefined && value !== null && value != 'undefined') data.reset.call(self, value, com);
|
|
541
541
|
} else {
|
|
542
|
-
if (value != undefined && value !== null) (com as Label).string = value?.toString() || '';
|
|
542
|
+
if (value != undefined && value !== null && value != 'undefined') (com as Label).string = value?.toString() || '';
|
|
543
543
|
}
|
|
544
544
|
break;
|
|
545
545
|
case 'cc.RichText':
|
|
546
546
|
if (data.reset) {
|
|
547
|
-
if (value !== undefined
|
|
547
|
+
if (value !== undefined && value !== null && value != 'undefined') data.reset.call(self, value, com);
|
|
548
548
|
} else
|
|
549
|
-
if (value != undefined && value !== null)
|
|
549
|
+
if (value != undefined && value !== null && value != 'undefined')
|
|
550
550
|
(com as RichText).string = value?.toString() || '';
|
|
551
551
|
break;
|
|
552
552
|
case 'cc.Sprite':
|
|
553
553
|
// 假设 value 是 SpriteFrame 路径或资源
|
|
554
554
|
// 需要额外处理资源加载逻辑
|
|
555
555
|
if (data.reset) {
|
|
556
|
-
if (value !== undefined
|
|
556
|
+
if (value !== undefined && value !== null) data.reset.call(self, value, com);
|
|
557
557
|
} else
|
|
558
558
|
if (value != undefined && value !== null) {
|
|
559
559
|
if (value instanceof SpriteFrame)
|
|
@@ -570,19 +570,19 @@ function updateStatus(data: IBindingData, com: Component, value: any, self: any)
|
|
|
570
570
|
case 'cc.Button':
|
|
571
571
|
const com_btn = (com as Button);
|
|
572
572
|
if (data.reset) {
|
|
573
|
-
if (value !== undefined
|
|
573
|
+
if (value !== undefined && value !== null) data.reset.call(self, value, com);
|
|
574
574
|
} else
|
|
575
|
-
if (value !== undefined
|
|
575
|
+
if (value !== undefined && value !== null) com_btn.node.active = value ?? true;
|
|
576
576
|
break;
|
|
577
577
|
case 'cc.ProgressBar':
|
|
578
578
|
if (data.reset) {
|
|
579
|
-
if (value !== undefined
|
|
579
|
+
if (value !== undefined && value !== null) data.reset.call(self, value, com);
|
|
580
580
|
} else
|
|
581
581
|
if (value != undefined && value !== null) (com as ProgressBar).progress = Number(value) || 0;
|
|
582
582
|
break;
|
|
583
583
|
case 'sp.Skeleton':
|
|
584
584
|
if (data.reset) {
|
|
585
|
-
if (value !== undefined
|
|
585
|
+
if (value !== undefined && value !== null) data.reset.call(self, value, com);
|
|
586
586
|
} else
|
|
587
587
|
if (value != undefined && value !== null)
|
|
588
588
|
if (value instanceof sp.SkeletonData)
|
|
@@ -605,7 +605,7 @@ function updateStatus(data: IBindingData, com: Component, value: any, self: any)
|
|
|
605
605
|
{
|
|
606
606
|
const com_sld = (com as Slider);
|
|
607
607
|
if (data.reset) {
|
|
608
|
-
if (value !== undefined
|
|
608
|
+
if (value !== undefined && value !== null) data.reset.call(self, value, com);
|
|
609
609
|
} else
|
|
610
610
|
if (value != undefined && value !== null) com_sld.progress = Number(value) || 0;
|
|
611
611
|
}
|
|
@@ -614,7 +614,7 @@ function updateStatus(data: IBindingData, com: Component, value: any, self: any)
|
|
|
614
614
|
{
|
|
615
615
|
const com_tg = (com as Toggle);
|
|
616
616
|
if (data.reset) {
|
|
617
|
-
if (value !== undefined
|
|
617
|
+
if (value !== undefined && value !== null) data.reset.call(self, value, com);
|
|
618
618
|
} else
|
|
619
619
|
if (value != undefined && value !== null) com_tg.isChecked = Boolean(value);
|
|
620
620
|
}
|
|
@@ -623,7 +623,7 @@ function updateStatus(data: IBindingData, com: Component, value: any, self: any)
|
|
|
623
623
|
{
|
|
624
624
|
const com_eb = (com as EditBox);
|
|
625
625
|
if (data.reset) {
|
|
626
|
-
if (value !== undefined
|
|
626
|
+
if (value !== undefined && value !== null) data.reset.call(self, value, com);
|
|
627
627
|
} else
|
|
628
628
|
if (value != undefined && value !== null) com_eb.string = value?.toString() || '';
|
|
629
629
|
}
|
|
@@ -632,7 +632,7 @@ function updateStatus(data: IBindingData, com: Component, value: any, self: any)
|
|
|
632
632
|
{
|
|
633
633
|
const com_tgc = (com as ToggleContainer);
|
|
634
634
|
if (data.reset) {
|
|
635
|
-
if (value !== undefined
|
|
635
|
+
if (value !== undefined && value !== null) data.reset.call(self, value, com);
|
|
636
636
|
}
|
|
637
637
|
//事件
|
|
638
638
|
if (com_tgc.checkEvents.length <= 0) {
|
|
@@ -17,6 +17,7 @@ export class ExComponentModule {
|
|
|
17
17
|
paramSprite: { loadSprite: (param: { bundle: string, path: string }) => Promise<SpriteFrame>, getSprite: (param: { bundle: string, path: string }) => SpriteFrame }
|
|
18
18
|
paramSpine: { loadSpine: (param: { bundle: string, path: string }) => Promise<sp.SkeletonData>, getSpine: (param: { bundle: string, path: string }) => sp.SkeletonData }
|
|
19
19
|
paramUIWindow: { onLoad: (config: any, viewModel: any) => void }
|
|
20
|
+
paramClose: { close: (openParam: any, closeParam: any) => void }
|
|
20
21
|
|
|
21
22
|
ResetBaseWindow: string = "BaseWindow";
|
|
22
23
|
static Init() {
|
|
@@ -29,6 +30,9 @@ export class ExComponentModule {
|
|
|
29
30
|
static OnButtonClick(param: { click: (comp: Button) => void }) {
|
|
30
31
|
ExComponentModule.Ins.param = param
|
|
31
32
|
}
|
|
33
|
+
static OnCloseWindow(param: { close: (openParam: any, param: any) => void }) {
|
|
34
|
+
ExComponentModule.Ins.paramClose = param
|
|
35
|
+
}
|
|
32
36
|
|
|
33
37
|
static ResetBaseWindow(name?: string, isGet?: boolean) {
|
|
34
38
|
if (!isGet) ExComponentModule.Ins.ResetBaseWindow = name
|
|
@@ -70,7 +74,12 @@ export class ExComponentModule {
|
|
|
70
74
|
static EmitUIWindow(param: any, viewModel: any) {
|
|
71
75
|
return ExComponentModule.Ins.paramUIWindow?.onLoad?.(param, viewModel)
|
|
72
76
|
}
|
|
77
|
+
|
|
78
|
+
static EmitCloseWindow(openParam: any, closeParam: any) {
|
|
79
|
+
return ExComponentModule.Ins.paramClose?.close?.(openParam, closeParam)
|
|
80
|
+
}
|
|
73
81
|
}
|
|
82
|
+
|
|
74
83
|
window.ExComponentModule = ExComponentModule;
|
|
75
84
|
|
|
76
85
|
|
|
@@ -21,6 +21,8 @@ declare global {
|
|
|
21
21
|
function EnableButtonScale(param: { enable: boolean });
|
|
22
22
|
/**监听所有按钮的点击事件 */
|
|
23
23
|
function OnButtonClick(param: { click: (comp: Button) => void });
|
|
24
|
+
/**监听窗口的关闭 */
|
|
25
|
+
function OnCloseWindow(param: { close: (openParam: any, closeParam: any) => void });
|
|
24
26
|
/**监听加载图片 */
|
|
25
27
|
function OnLoadSprite(param: { loadSprite: (param: { bundle: string, path: string }) => Promise<SpriteFrame>, getSprite: (param: { bundle: string, path: string }) => SpriteFrame });
|
|
26
28
|
function OnLoadSpine(param: { loadSpine: (param: { bundle: string, path: string }) => Promise<sp.SkeletonData>, getSpine: (param: { bundle: string, path: string }) => sp.SkeletonData });
|
|
@@ -37,5 +39,6 @@ declare global {
|
|
|
37
39
|
function EmitLoadSpine(param: any): Promise<sp.SkeletonData>;
|
|
38
40
|
function EmitGetSpine(param: any): sp.SkeletonData;
|
|
39
41
|
function EmitUIWindow(param: IConfig, viewModel: any);
|
|
42
|
+
function EmitCloseWindow(openParam: any, closeParam: any);
|
|
40
43
|
}
|
|
41
44
|
}
|