فهرست منبع

Merge branch 'master' of http://git.mokasz.com/zouyong/mk_framework into master

fengcong 5 سال پیش
والد
کامیت
40957c662f

+ 131 - 16
mk_framework/assets/resources/module/login/login.prefab

@@ -13,25 +13,28 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "load",
+    "_name": "login",
     "_objFlags": 0,
     "_parent": null,
     "_children": [
       {
         "__id__": 2
-      },
-      {
-        "__id__": 5
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 7
+        "__id__": 9
+      },
+      {
+        "__id__": 10
+      },
+      {
+        "__id__": 11
       }
     ],
     "_prefab": {
-      "__id__": 8
+      "__id__": 12
     },
     "_opacity": 255,
     "_color": {
@@ -82,20 +85,87 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "背景",
+    "_name": "动画节点",
     "_objFlags": 0,
     "_parent": {
       "__id__": 1
     },
+    "_children": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 6
+      }
+    ],
+    "_active": true,
+    "_components": [],
+    "_prefab": {
+      "__id__": 8
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "背景",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 3
+        "__id__": 4
       }
     ],
     "_prefab": {
-      "__id__": 4
+      "__id__": 5
     },
     "_opacity": 255,
     "_color": {
@@ -126,8 +196,8 @@
         0,
         0,
         1,
-        1,
-        1,
+        0.5,
+        0.5,
         1
       ]
     },
@@ -149,7 +219,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 2
+      "__id__": 3
     },
     "_enabled": true,
     "_materials": [
@@ -184,7 +254,7 @@
     "asset": {
       "__uuid__": "62252503-89e0-44ba-aeab-bf0baac4f65a"
     },
-    "fileId": "ceUXPj1chIxJ4EuDVb0+hr",
+    "fileId": "eftAQpmpZAsYxYf8Hiia4D",
     "sync": false
   },
   {
@@ -192,13 +262,13 @@
     "_name": "逻辑",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 1
+      "__id__": 2
     },
     "_children": [],
     "_active": true,
     "_components": [],
     "_prefab": {
-      "__id__": 6
+      "__id__": 7
     },
     "_opacity": 255,
     "_color": {
@@ -255,7 +325,18 @@
     "asset": {
       "__uuid__": "62252503-89e0-44ba-aeab-bf0baac4f65a"
     },
-    "fileId": "efQVwyTkhMY4jCVAZsECCA",
+    "fileId": "dfiMFrj1hEHYRxeHlpVsfv",
+    "sync": false
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "62252503-89e0-44ba-aeab-bf0baac4f65a"
+    },
+    "fileId": "9akj8beUxHU6GRm7Iaq7Ex",
     "sync": false
   },
   {
@@ -269,6 +350,40 @@
     "_id": ""
   },
   {
+    "__type__": "ac053zwqaRD6IJmTlQWmefZ",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "effect_par": {
+      "__id__": 2
+    },
+    "open_effect": 1,
+    "close_effect": 1,
+    "close_toPoint": "",
+    "_id": ""
+  },
+  {
+    "__type__": "58495/rJOBNGoxELFSp8G2a",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "color": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 120
+    },
+    "bClickClose": false,
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1

+ 28 - 0
mk_framework/assets/script/game/component/BtnOpenPanel.ts

@@ -0,0 +1,28 @@
+
+const { ccclass, property } = cc._decorator;
+/**
+ * 打开指定名字的面板
+ * @author 薛鸿潇
+ */
+@ccclass
+export default class BtnOpenPanel extends cc.Component {
+
+    @property({ displayName: '界面名字', tooltip: '对应路径:resources/prefab/uiPanel/' })
+    private panel_name = '';
+    @property({ displayName: '完成回调', tooltip: "面板打开完成后触发", type: cc.Component.EventHandler })
+    public onComplete: cc.Component.EventHandler = new cc.Component.EventHandler();
+
+    onLoad() {
+        if (!this.node.getComponent(cc.Button)) this.node.addComponent(cc.Button);
+    }
+
+    start() {
+        this.node.on('click', this.openPanel, this);
+    }
+    
+    private async openPanel() {
+        await mk.ui.openPanel(this.panel_name);
+        if (this.onComplete.handler) this.onComplete.emit([])
+    }
+    // update (dt) {}
+}

+ 9 - 0
mk_framework/assets/script/game/component/BtnOpenPanel.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "b8d2c9ea-f866-4b14-adf4-c5b2c3aabfe6",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 69 - 0
mk_framework/assets/script/game/component/UIBG.ts

@@ -0,0 +1,69 @@
+
+const TopEdgeDistance = 0;
+const BottomEdgeDistance = 0;
+const { ccclass, property } = cc._decorator;
+enum BGType {
+    /**
+     * 无
+     * @property {Number} None
+     */
+    None = 0,
+
+    /**
+     * 半透明
+     * @property {Number} Translucent
+     */
+    Translucent = 1,
+}
+
+/**
+ * 窗口遮罩
+ * - 挂载到节点上
+ * @author 薛鸿潇
+ */
+@ccclass//('UIBG')
+export class UIBG extends cc.Component {
+    @property({ displayName: '背景颜色' })
+    private color = new cc.Color(0, 0, 0, 120);
+    @property({ displayName: '点击关闭' })
+    private bClickClose: boolean = false;
+
+    /** 背景节点 */
+    private node_bg: cc.Node = null;
+
+    onLoad() {
+        this.initBG();
+    }
+
+    private initBG() {
+        const width = mk.game.getWinSize().width;
+        const height = mk.game.getWinSize().height;
+        this.node_bg = this.drawColorRect(new cc.Rect(-width / 2, -height / 2, width, height));
+        this.node_bg.parent = this.node;
+        this.node_bg.zIndex = -10000;
+        this.node_bg.addComponent(cc.Button);
+        this.node_bg.on('click', this.initClick, this);
+    }
+
+    /**
+     * 按钮回调
+     */
+    private initClick() {
+        if (this.bClickClose) mk.ui.closePanel(this.node.name);
+    }
+    /**
+     * 创建背景蒙版 by 绘图组件
+     * @param size 坐标及宽高
+     * @returns 创建的节点
+     */
+    public drawColorRect(size: cc.Rect): cc.Node {//
+        cc.log(size)
+        let node = new cc.Node('colorRect');
+        node.setContentSize(size);
+        let graph = node.addComponent(cc.Graphics);
+        graph.fillColor = this.color;
+        graph.fillRect(size.x, size.y, size.width, size.height);
+        return node;
+    }
+
+}

+ 0 - 0
mk_framework/assets/script/game/component/UIMask.ts.meta → mk_framework/assets/script/game/component/UIBG.ts.meta


+ 0 - 37
mk_framework/assets/script/game/component/UIMask.ts

@@ -1,37 +0,0 @@
-
-const TopEdgeDistance = 0;
-const BottomEdgeDistance = 0;
-const { ccclass, property } = cc._decorator;
-/**
- * 窗口遮罩
- * @author 薛鸿潇
- */
-@ccclass//('UIMask')
-export class UIMask extends cc.Component {
-    @property({ type: cc.Node, tooltip: '遮罩节点' })
-    private node_mask: cc.Node = null;
-
-    start() {
-        this.node.zIndex = -10000;
-        this.adaptTopAndBottomBox();
-        this.node.getComponent(cc.Widget).updateAlignment();
-        this.node_mask.getComponent(cc.Widget).updateAlignment();
-    }
-    /**
-     * 全面屏适配
-     */
-    private adaptTopAndBottomBox() {
-        let widget = this.node.getComponent(cc.Widget);
-        widget.top = TopEdgeDistance;
-        widget.bottom = BottomEdgeDistance;
-    }
-
-    /**
-     * 设置遮罩显示 or 隐藏
-     * @param bVisible {boolen} 显示或隐藏
-     */
-    public setMaskVisible(bVisible: boolean) {
-        this.node_mask.active = bVisible;
-    }
-
-}