薛鸿潇 5 лет назад
Родитель
Сommit
11a83b93f3

+ 1 - 2
mk_framework/assets/script/game/component/UIBG.ts

@@ -56,8 +56,7 @@ export class UIBG extends cc.Component {
      * @param size 坐标及宽高
      * @returns 创建的节点
      */
-    public drawColorRect(size: cc.Rect): cc.Node {//
-        cc.log(size)
+    public drawColorRect(size: cc.Rect): cc.Node {
         let node = new cc.Node('colorRect');
         node.setContentSize(size);
         let graph = node.addComponent(cc.Graphics);

+ 3 - 2
mk_framework/assets/script/game/component/tween/UIOpenAndClose.ts

@@ -42,9 +42,10 @@ export default class UIOpenAndClose extends cc.Component {
         this._play_open = v;
     }
     private _play_close: boolean = false;
-    @property({ displayName: "预览" })
+    @property({ displayName: "预览" })
     get play_close(): boolean {
         if (this._play_close) {
+            this.effect_par.scale = 1;
             this.hideEffect();
             this._play_close = false;
         }
@@ -90,7 +91,7 @@ export default class UIOpenAndClose extends cc.Component {
      * 关闭打开效果
      * @param cb 结束回调
      */
-    private hideEffect(cb: Function = null) {
+    public hideEffect(cb: Function = null) {
         if (this.effect_par) {
             switch (this.close_effect) {
                 case EffectType.None:

+ 12 - 3
mk_framework/assets/script/mk/system/UISystem.ts

@@ -19,11 +19,11 @@ export default class UISystem extends cc.Component {
     private curOnPanelDic: { [key: string]: cc.Node } = {};
     /** 上一个打开的界面名称 */
     private lastOpenPanelName: string = "";
-    
+
     onLoad() {
         mk.ui = this;
     }
-  
+
     start() {
         if (!this.panelParent) {
             this.panelParent = this.node;
@@ -113,9 +113,18 @@ export default class UISystem extends cc.Component {
         this.isPanelClosing = true;
 
         let node_panel = this.getCurOnPanel(panelName);
+
+        // 是否存在关闭动画
+        let comp_anim = node_panel.getComponent('UIOpenAndClose');
+        if (comp_anim) {
+            comp_anim.hideEffect(this.destroyNode.bind(this, node_panel, panelName));
+        } else {
+            this.destroyNode(node_panel, panelName);
+        }
+    }
+    private destroyNode(node_panel, panelName) {
         node_panel.destroy();
         delete this.curOnPanelDic[panelName];
-
         this.isPanelClosing = false;
     }
 }