zouyong 5 anni fa
parent
commit
4176089566

+ 37 - 51
assets/resources/game/prefab/game.prefab

@@ -30,11 +30,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 34
+        "__id__": 33
       }
     ],
     "_prefab": {
-      "__id__": 35
+      "__id__": 34
     },
     "_opacity": 255,
     "_color": {
@@ -276,11 +276,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 32
+        "__id__": 31
       }
     ],
     "_prefab": {
-      "__id__": 33
+      "__id__": 32
     },
     "_opacity": 255,
     "_color": {
@@ -341,26 +341,26 @@
         "__id__": 9
       },
       {
-        "__id__": 14
+        "__id__": 13
       },
       {
-        "__id__": 19
+        "__id__": 18
       },
       {
-        "__id__": 24
+        "__id__": 23
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 29
+        "__id__": 28
       },
       {
-        "__id__": 30
+        "__id__": 29
       }
     ],
     "_prefab": {
-      "__id__": 31
+      "__id__": 30
     },
     "_opacity": 255,
     "_color": {
@@ -427,7 +427,7 @@
       }
     ],
     "_prefab": {
-      "__id__": 13
+      "__id__": 12
     },
     "_opacity": 255,
     "_color": {
@@ -516,23 +516,12 @@
       "__id__": 9
     },
     "_enabled": true,
-    "panel_name": "pigBank",
+    "panel_name": "module/pigBank/pigBank",
     "open_type": 0,
-    "panel_type": 2,
-    "onComplete": {
-      "__id__": 12
-    },
+    "onComplete": [],
     "_id": ""
   },
   {
-    "__type__": "cc.ClickEvent",
-    "target": null,
-    "component": "",
-    "_componentId": "",
-    "handler": "",
-    "customEventData": ""
-  },
-  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -554,14 +543,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 15
+        "__id__": 14
       },
       {
-        "__id__": 16
+        "__id__": 15
       }
     ],
     "_prefab": {
-      "__id__": 18
+      "__id__": 17
     },
     "_opacity": 255,
     "_color": {
@@ -615,7 +604,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 14
+      "__id__": 13
     },
     "_enabled": true,
     "_materials": [
@@ -647,14 +636,13 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 14
+      "__id__": 13
     },
     "_enabled": true,
-    "panel_name": "turnable",
+    "panel_name": "module/turnable/turnable",
     "open_type": 0,
-    "panel_type": 2,
     "onComplete": {
-      "__id__": 17
+      "__id__": 16
     },
     "_id": ""
   },
@@ -688,14 +676,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 20
+        "__id__": 19
       },
       {
-        "__id__": 21
+        "__id__": 20
       }
     ],
     "_prefab": {
-      "__id__": 23
+      "__id__": 22
     },
     "_opacity": 255,
     "_color": {
@@ -749,7 +737,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 19
+      "__id__": 18
     },
     "_enabled": true,
     "_materials": [
@@ -781,14 +769,13 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 19
+      "__id__": 18
     },
     "_enabled": true,
-    "panel_name": "sign",
+    "panel_name": "module/sign/sign",
     "open_type": 0,
-    "panel_type": 2,
     "onComplete": {
-      "__id__": 22
+      "__id__": 21
     },
     "_id": ""
   },
@@ -822,14 +809,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 25
+        "__id__": 24
       },
       {
-        "__id__": 26
+        "__id__": 25
       }
     ],
     "_prefab": {
-      "__id__": 28
+      "__id__": 27
     },
     "_opacity": 255,
     "_color": {
@@ -883,7 +870,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 24
+      "__id__": 23
     },
     "_enabled": true,
     "_materials": [
@@ -915,14 +902,13 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 24
+      "__id__": 23
     },
     "_enabled": true,
-    "panel_name": "reward",
+    "panel_name": "module/reward/reward",
     "open_type": 0,
-    "panel_type": 2,
     "onComplete": {
-      "__id__": 27
+      "__id__": 26
     },
     "_id": ""
   },
@@ -1027,13 +1013,13 @@
       "__id__": 9
     },
     "btn2": {
-      "__id__": 14
+      "__id__": 13
     },
     "btn3": {
-      "__id__": 19
+      "__id__": 18
     },
     "btn4": {
-      "__id__": 24
+      "__id__": 23
     },
     "_id": ""
   },

+ 1 - 3
assets/script/Main.ts

@@ -1,5 +1,3 @@
-import UISystem, { PanelType } from "./mk/system/UISystem";
-
 const { ccclass, property } = cc._decorator;
 
 @ccclass
@@ -11,6 +9,6 @@ export default class Main extends cc.Component {
 
     start() {
         console.log("init");
-        mk.ui.openPanel("login",PanelType.module);
+        mk.ui.openPanel("module/login/login");
     }
 }

+ 0 - 1
assets/script/game/component/BtnClosePanel.ts

@@ -1,6 +1,5 @@
 
 const { ccclass, property } = cc._decorator;
-import { OpenActionType, PanelType } from '../../mk/system/UISystem';
 /**
  * 关闭指定面板
  * @author 薛鸿潇

+ 3 - 5
assets/script/game/component/BtnOpenPanel.ts

@@ -1,6 +1,6 @@
 
 const { ccclass, property } = cc._decorator;
-import { OpenActionType, PanelType } from '../../mk/system/UISystem';
+import { OpenActionType } from '../../mk/system/UISystem';
 /**
  * 打开指定名字的面板
  * @author 薛鸿潇
@@ -8,12 +8,10 @@ import { OpenActionType, PanelType } from '../../mk/system/UISystem';
 @ccclass
 export default class BtnOpenPanel extends cc.Component {
 
-    @property({ displayName: '界面名字', tooltip: '对应路径:resources/prefab/uiPanel/' })
+    @property({ displayName: '预制体路径', tooltip: '对应路径:resources/' })
     private panel_name = '';
     @property({ displayName: '打开类型', tooltip: 'normal不操作,closeOther关闭其他,closeLast关闭上一个', type: cc.Enum(OpenActionType) })
     private open_type = OpenActionType.normal;
-    @property({ displayName: '面板类型', tooltip: 'game游戏界面,module模块界面', type: cc.Enum(PanelType) })
-    private panel_type = PanelType.module;
     @property({ displayName: '完成回调', tooltip: "面板打开完成后触发", type: cc.Component.EventHandler })
     public onComplete: cc.Component.EventHandler[] = [];
 
@@ -26,7 +24,7 @@ export default class BtnOpenPanel extends cc.Component {
     }
 
     private async openPanel() {
-        await mk.ui.openPanel(this.panel_name, this.panel_type, this.open_type);
+        await mk.ui.openPanel(this.panel_name, this.open_type);
         const c_count = this.onComplete.length;
         for (let i = 0; i < c_count; i++) {
             if (this.onComplete[i].handler) this.onComplete[i].emit([])

+ 1 - 3
assets/script/game/module/module/login/Login.ts

@@ -1,5 +1,3 @@
-import { PanelType } from "../../../../mk/system/UISystem";
-
 const { ccclass, property } = cc._decorator;
 
 @ccclass
@@ -26,7 +24,7 @@ export default class Login extends cc.Component {
             return;
         }
         if(gData.gameData.dataFinish){//登录流程完毕
-            mk.ui.openPanel("game",PanelType.game);
+            mk.ui.openPanel("game/prefab/game");
         }
     }
 }

+ 1 - 3
assets/script/game/module/module/turntable/Turnable.ts

@@ -1,7 +1,5 @@
-import { PanelType } from "../../../../mk/system/UISystem";
 import BtnClosePanel from "../../../component/BtnClosePanel";
 import { AdFun } from "../../../data/AdData";
-import { GameProp } from "../../../data/GameData";
 import TurnableItem from "./TurnableItem";
 
 const { ccclass, property } = cc._decorator;
@@ -54,7 +52,7 @@ export default class Turnable extends cc.Component {
     private playOver() {
         this.btn_close.getComponent(BtnClosePanel).block_click = false;
         this.updateLeftTimes();
-        mk.ui.openPanel("reward", PanelType.module);
+        mk.ui.openPanel("module/reward/reward");
     }
 
     updateLeftTimes() {

+ 4 - 35
assets/script/mk/system/UISystem.ts

@@ -9,10 +9,6 @@ export default class UISystem extends cc.Component {
 
     /** panel父节点 */
     private panelParent: cc.Node = null;
-    /** 界面预制体路径 */
-    private gamePanelbUrl: string = './game/prefab';
-    /** 模块界面预制体路径 */
-    private modulPanelUrl: string = './module';
     /** 是否正在打开界面 */
     private isPanelOpening: boolean = false;
     /** 是否界面正在关闭 */
@@ -34,13 +30,12 @@ export default class UISystem extends cc.Component {
 
     /**
      * 打开panel界面
-     * @param panelName  界面名称
-     * @param panelType  界面类型
+     * @param panelUrl  界面名称全路径
      * @param openAction 打开之后的操(需不需要关闭其他界面)
      */
-    openPanel(panelName: string, panelType: PanelType, openAction: OpenActionType = OpenActionType.normal): Promise<any> {
-
-        let panelUrl = this.getUrlByPanelType(panelName, panelType);
+    openPanel(panelUrl: string, openAction: OpenActionType = OpenActionType.normal): Promise<any> {
+        let arr = panelUrl.split("/");
+        let panelName = arr[arr.length - 1];
 
         let self = this;
         if (self.isPanelOpening || self.getCurOnPanel(panelName)) {
@@ -134,24 +129,6 @@ export default class UISystem extends cc.Component {
         this.isPanelClosing = false;
         callBack && callBack();
     }
-
-    /**
-     * 根据界面类型获取url
-     * @param panelName 界面名称
-     * @param panelType 界面类型
-     */
-    getUrlByPanelType(pannelName: string, panelType: PanelType): string {
-        let url: string = "";
-        switch (panelType) {
-            case PanelType.game:
-                url = `${this.gamePanelbUrl}/${pannelName}`
-                break;
-            case PanelType.module:
-                url = `${this.modulPanelUrl}/${pannelName}/${pannelName}`
-                break;
-        }
-        return url;
-    }
 }
 
 /** 界面打开操作 */
@@ -162,12 +139,4 @@ export enum OpenActionType {
     closeOther = 1,
     /** 关闭上一个 */
     closeLast = 2
-}
-
-/** */
-export enum PanelType {
-    /**游戏界面 */
-    game = 1,
-    /**模块界面 */
-    module = 2,
 }