Explorar o código

[FC] 修改UISystem 域的问题

fengcong %!s(int64=5) %!d(string=hai) anos
pai
achega
7909eb20ff
Modificáronse 1 ficheiros con 14 adicións e 13 borrados
  1. 14 13
      mk_framework/assets/script/mk/system/UISystem.ts

+ 14 - 13
mk_framework/assets/script/mk/system/UISystem.ts

@@ -34,48 +34,49 @@ export default class UISystem extends cc.Component {
      * @param openAction 打开之后的操(需不需要关闭其他界面)
      * @param openAction 打开之后的操(需不需要关闭其他界面)
      */
      */
     openPanel(panelName: string, openAction: OpenActionType = OpenActionType.normal): Promise<any> {
     openPanel(panelName: string, openAction: OpenActionType = OpenActionType.normal): Promise<any> {
-
-        if (this.isPanelOpening || this.getCurOnPanel(panelName)) {
+       
+        let self = this;
+        if (self.isPanelOpening || self.getCurOnPanel(panelName)) {
             return;
             return;
         }
         }
 
 
-        this.isPanelOpening = true;
+        self.isPanelOpening = true;
 
 
         return new Promise((resolve, reject) => {
         return new Promise((resolve, reject) => {
 
 
-            mk.loader.load(`${this.panelPrefanbUrl}` + panelName, cc.Prefab)
+            mk.loader.load(`${self.panelPrefanbUrl}` + panelName, cc.Prefab)
                 .then((prefab) => {
                 .then((prefab) => {
 
 
-                    this.isPanelOpening = false;
+                    self.isPanelOpening = false;
                     let node_panel = cc.instantiate(prefab);
                     let node_panel = cc.instantiate(prefab);
-                    this.curOnPanelDic[panelName] = node_panel;
+                    self.curOnPanelDic[panelName] = node_panel;
 
 
                     //如果父节点不存在,就默认把该节点定为panel的父节点
                     //如果父节点不存在,就默认把该节点定为panel的父节点
-                    if (!this.panelParent) {
+                    if (!self.panelParent) {
                         console.error("[UISystem] UI的父节点panelParent为null,请检查脚本挂载情况");
                         console.error("[UISystem] UI的父节点panelParent为null,请检查脚本挂载情况");
                         return;
                         return;
                     }
                     }
 
 
-                    this.panelParent.addChild(node_panel);
+                    self.panelParent.addChild(node_panel);
 
 
                     switch (openAction) {
                     switch (openAction) {
                         case OpenActionType.normal:
                         case OpenActionType.normal:
                             break;
                             break;
                         case OpenActionType.closeLast:
                         case OpenActionType.closeLast:
-                            if (this.lastOpenPanelName) {
-                                this.closePanel(this.lastOpenPanelName);
+                            if (self.lastOpenPanelName) {
+                                self.closePanel(self.lastOpenPanelName);
                             }
                             }
                             break;
                             break;
                         case OpenActionType.closeOther:
                         case OpenActionType.closeOther:
-                            let keys = Object.keys(this.curOnPanelDic).filter((key) => { key != panelName });
+                            let keys = Object.keys(self.curOnPanelDic).filter((key) => { key != panelName });
                             for (var i = 0; i < keys.length; i++) {
                             for (var i = 0; i < keys.length; i++) {
                                 let key = keys[i];
                                 let key = keys[i];
-                                this.closePanel(key);
+                                self.closePanel(key);
                             }
                             }
                             break;
                             break;
                     }
                     }
 
 
-                    this.lastOpenPanelName = panelName;
+                    self.lastOpenPanelName = panelName;
 
 
                     //返回panel
                     //返回panel
                     resolve(node_panel);
                     resolve(node_panel);