| 12345678910111213141516171819202122232425262728293031323334 |
- const { ccclass, property } = cc._decorator;
- import { OpenActionType, PanelType } from '../../mk/system/UISystem';
- /**
- * 关闭指定面板
- * @author 薛鸿潇
- */
- @ccclass
- export default class BtnClosePanel extends cc.Component {
- @property({ displayName: '关闭界面', tooltip: '', type: cc.Node })
- private node_panel: cc.Node = null!;;
- @property({ displayName: '完成回调', tooltip: "面板打开完成后触发", type: cc.Component.EventHandler })
- public onComplete: cc.Component.EventHandler[] = [];
- onLoad() {
- if (!this.node.getComponent(cc.Button)) this.node.addComponent(cc.Button);
- }
- start() {
- this.node.on('click', this.closePanel, this);
- }
- private async closePanel() {
- if (this.node_panel) {
- mk.ui.closePanel(this.node_panel.name);
- }
- const c_count = this.onComplete.length;
- for (let i = 0; i < c_count; i++) {
- if (this.onComplete[i].handler) this.onComplete[i].emit([])
- }
- }
- // update (dt) {}
- }
|