@cc-component/cc-ex-component 1.2.9 → 1.3.1
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/BaseReference.ts.meta +1 -1
- package/assets/core/BaseViewModelData.ts.meta +1 -1
- package/assets/core/BaseWindow.ts +80 -0
- package/assets/core/BaseWindow.ts.meta +9 -0
- package/assets/core/ReferenceComponent.ts.meta +1 -1
- package/assets/core/ViewModel.ts.meta +1 -1
- package/assets/core.meta +1 -1
- package/assets/ex/EXButton.ts.meta +1 -1
- package/assets/ex/ExCommon.ts +5 -0
- package/assets/ex/ExCommon.ts.meta +1 -1
- package/assets/ex/ExTool.ts.meta +1 -1
- package/assets/ex/ExTween.ts.meta +1 -1
- package/assets/ex.meta +1 -1
- package/assets/lib/collectView/lib-ext/custom-grid-flow-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib-ext/horizontal-center-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib-ext/yx-card-page-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib-ext/yx-carousel-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib-ext/yx-cover-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib-ext/yx-masonry-flow-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib-ext/yx-page-view.ts.meta +1 -1
- package/assets/lib/collectView/lib-ext/yx-table-view.ts.meta +1 -1
- package/assets/lib/collectView/lib-ext.meta +1 -1
- package/assets/lib/collectView/lib_collect/yx-collection-view.ts.meta +1 -1
- package/assets/lib/collectView/lib_collect/yx-compact-flow-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib_collect/yx-flow-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib_collect/yx-page-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib_collect/yx-table-layout.ts.meta +1 -1
- package/assets/lib/collectView/lib_collect.meta +1 -1
- package/assets/lib/collectView.meta +1 -1
- package/assets/lib/tableView/IListView.ts.meta +1 -1
- package/assets/lib/tableView/ListView.ts.meta +1 -1
- package/assets/lib/tableView/ListViewPage.ts.meta +1 -1
- package/assets/lib/tableView/ListViewPageLoop.ts.meta +1 -1
- package/assets/lib/tableView/TableView.ts.meta +1 -1
- package/assets/lib/tableView.meta +1 -1
- package/assets/lib.meta +1 -1
- package/assets.meta +1 -1
- package/index.ts.meta +1 -1
- package/package.json +1 -1
- package/package.json.meta +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { UIOpacity, tween, Vec3 } from 'cc';
|
|
2
|
+
import { _decorator, Component, Node } from 'cc';
|
|
3
|
+
import { BaseReference } from './BaseReference';
|
|
4
|
+
const { ccclass, property } = _decorator;
|
|
5
|
+
|
|
6
|
+
@ccclass('BaseWindow')
|
|
7
|
+
export class BaseWindow extends BaseReference {
|
|
8
|
+
maskOpacity: UIOpacity;
|
|
9
|
+
root: Node;
|
|
10
|
+
/**关闭事件-当系统级关闭所有打开的界面时。如果关闭界面时需要执行自己的业务逻辑,使用此属性
|
|
11
|
+
* eventName:关闭方法名称
|
|
12
|
+
* param:参数
|
|
13
|
+
*/
|
|
14
|
+
closeEvent: { eventName: string, param?: any };
|
|
15
|
+
/**参数*/
|
|
16
|
+
param: any;
|
|
17
|
+
/**关闭参数 */
|
|
18
|
+
paramClose: { is_anim?: boolean, param?: any, finish?: Function };
|
|
19
|
+
|
|
20
|
+
protected onLoad(): void {
|
|
21
|
+
this.maskOpacity = this.node.getChildByName('mask')?.getComponent(UIOpacity)
|
|
22
|
+
this.root = this.node.getChildByName('root')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 显示弹窗特效(主动调用)
|
|
27
|
+
*/
|
|
28
|
+
public open() {
|
|
29
|
+
if (!this.root || !this.maskOpacity) { return }
|
|
30
|
+
this.showAnim()
|
|
31
|
+
}
|
|
32
|
+
public close(param?: { is_anim?: boolean, param?: any, finish?: Function }) {
|
|
33
|
+
this.paramClose = param;
|
|
34
|
+
this.param?.callBack?.(param?.param)//回调方法
|
|
35
|
+
if (param?.is_anim && this.root && this.maskOpacity) {
|
|
36
|
+
this.hideAnim()
|
|
37
|
+
} else {
|
|
38
|
+
param?.finish()
|
|
39
|
+
this.destroyWindow()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
destroyWindow() { this.node.destroy(); }
|
|
44
|
+
|
|
45
|
+
/**打开动画-可重写动画*/
|
|
46
|
+
public showAnim() {
|
|
47
|
+
this.root.setScale(0.001, 0.001);
|
|
48
|
+
this.maskOpacity.opacity = 0;
|
|
49
|
+
tween(this.maskOpacity).to(0.2, { opacity: 255 }).start()
|
|
50
|
+
tween(this.root)
|
|
51
|
+
.to(0.068, { scale: new Vec3(1.15, 1.15, 1.15) })
|
|
52
|
+
.to(0.088, { scale: new Vec3(0.88, 0.88, 0.88) })
|
|
53
|
+
.to(0.088, { scale: new Vec3(1, 1, 1) })
|
|
54
|
+
.start();
|
|
55
|
+
}
|
|
56
|
+
/**关闭动画-可重写动画*/
|
|
57
|
+
public hideAnim() {
|
|
58
|
+
tween(this.maskOpacity).to(0.2, { opacity: 0 }).start()
|
|
59
|
+
//销毁动画
|
|
60
|
+
tween(this.root)
|
|
61
|
+
.to(0.1, { scale: new Vec3(1.028, 1.028, 1.028) })
|
|
62
|
+
.to(0.1, { scale: new Vec3(0.001, 0.001, 0.001) })
|
|
63
|
+
.call(() => {
|
|
64
|
+
this.paramClose.param?.finish()
|
|
65
|
+
setTimeout(() => { if (this.node && this.node.isValid) { this.destroyWindow() } });
|
|
66
|
+
})
|
|
67
|
+
.start();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
// BaseWindow.ts
|
|
74
|
+
// export function BaseWindowMixin<T extends new (...args: any[]) => Component>(Base: T) {
|
|
75
|
+
// return class extends Base {
|
|
76
|
+
// show() { /* 你的显示逻辑 */ }
|
|
77
|
+
// close() { /* 你的关闭逻辑 */ }
|
|
78
|
+
// // ... 其他方法
|
|
79
|
+
// };
|
|
80
|
+
// }
|
package/assets/core.meta
CHANGED
package/assets/ex/ExCommon.ts
CHANGED
package/assets/ex/ExTool.ts.meta
CHANGED
package/assets/ex.meta
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"
|
|
1
|
+
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"76830660-44be-4583-804a-12c8c9b6f838","files":[],"subMetas":{},"userData":{}}
|
package/assets/lib.meta
CHANGED
package/assets.meta
CHANGED
package/index.ts.meta
CHANGED
package/package.json
CHANGED