Browse Source

组件优化

薛鸿潇 5 years ago
parent
commit
031ccbfc88

+ 74 - 40
assets/resources/module/redBagCash/redBagCash.prefab

@@ -21,23 +21,23 @@
         "__id__": 2
         "__id__": 2
       },
       },
       {
       {
-        "__id__": 53
+        "__id__": 55
       }
       }
     ],
     ],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 59
+        "__id__": 61
       },
       },
       {
       {
-        "__id__": 60
+        "__id__": 62
       },
       },
       {
       {
-        "__id__": 61
+        "__id__": 63
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 62
+      "__id__": 64
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -101,17 +101,17 @@
         "__id__": 6
         "__id__": 6
       },
       },
       {
       {
-        "__id__": 42
+        "__id__": 44
       }
       }
     ],
     ],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 51
+        "__id__": 53
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 52
+      "__id__": 54
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -291,13 +291,13 @@
         "__id__": 35
         "__id__": 35
       },
       },
       {
       {
-        "__id__": 38
+        "__id__": 39
       }
       }
     ],
     ],
     "_active": true,
     "_active": true,
     "_components": [],
     "_components": [],
     "_prefab": {
     "_prefab": {
-      "__id__": 41
+      "__id__": 43
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -1371,10 +1371,13 @@
     "_components": [
     "_components": [
       {
       {
         "__id__": 36
         "__id__": 36
+      },
+      {
+        "__id__": 37
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 37
+      "__id__": 38
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -1459,6 +1462,20 @@
     "_id": ""
     "_id": ""
   },
   },
   {
   {
+    "__type__": "b8d2cnq+GZLFK30xbLDqr/m",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 35
+    },
+    "_enabled": true,
+    "panel_name": "",
+    "open_type": 0,
+    "transition_type": 3,
+    "onComplete": [],
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "__type__": "cc.PrefabInfo",
     "root": {
     "root": {
       "__id__": 1
       "__id__": 1
@@ -1480,11 +1497,14 @@
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 39
+        "__id__": 40
+      },
+      {
+        "__id__": 41
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 40
+      "__id__": 42
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -1517,7 +1537,7 @@
         1,
         1,
         1,
         1,
         1,
         1,
-        1
+        0
       ]
       ]
     },
     },
     "_eulerAngles": {
     "_eulerAngles": {
@@ -1538,7 +1558,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 38
+      "__id__": 39
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_materials": [
     "_materials": [
@@ -1569,6 +1589,20 @@
     "_id": ""
     "_id": ""
   },
   },
   {
   {
+    "__type__": "b8d2cnq+GZLFK30xbLDqr/m",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 39
+    },
+    "_enabled": true,
+    "panel_name": "",
+    "open_type": 0,
+    "transition_type": 3,
+    "onComplete": [],
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "__type__": "cc.PrefabInfo",
     "root": {
     "root": {
       "__id__": 1
       "__id__": 1
@@ -1599,20 +1633,20 @@
     },
     },
     "_children": [
     "_children": [
       {
       {
-        "__id__": 43
+        "__id__": 45
       }
       }
     ],
     ],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 48
+        "__id__": 50
       },
       },
       {
       {
-        "__id__": 49
+        "__id__": 51
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 50
+      "__id__": 52
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -1666,21 +1700,21 @@
     "_name": "view",
     "_name": "view",
     "_objFlags": 0,
     "_objFlags": 0,
     "_parent": {
     "_parent": {
-      "__id__": 42
+      "__id__": 44
     },
     },
     "_children": [
     "_children": [
       {
       {
-        "__id__": 44
+        "__id__": 46
       }
       }
     ],
     ],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 46
+        "__id__": 48
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 47
+      "__id__": 49
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -1734,13 +1768,13 @@
     "_name": "content",
     "_name": "content",
     "_objFlags": 0,
     "_objFlags": 0,
     "_parent": {
     "_parent": {
-      "__id__": 43
+      "__id__": 45
     },
     },
     "_children": [],
     "_children": [],
     "_active": true,
     "_active": true,
     "_components": [],
     "_components": [],
     "_prefab": {
     "_prefab": {
-      "__id__": 45
+      "__id__": 47
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -1805,7 +1839,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 43
+      "__id__": 45
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_materials": [
     "_materials": [
@@ -1836,7 +1870,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 42
+      "__id__": 44
     },
     },
     "_enabled": true,
     "_enabled": true,
     "horizontal": false,
     "horizontal": false,
@@ -1848,10 +1882,10 @@
     "scrollEvents": [],
     "scrollEvents": [],
     "cancelInnerEvents": false,
     "cancelInnerEvents": false,
     "_N$content": {
     "_N$content": {
-      "__id__": 44
+      "__id__": 46
     },
     },
     "content": {
     "content": {
-      "__id__": 44
+      "__id__": 46
     },
     },
     "_N$horizontalScrollBar": null,
     "_N$horizontalScrollBar": null,
     "_N$verticalScrollBar": null,
     "_N$verticalScrollBar": null,
@@ -1862,7 +1896,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 42
+      "__id__": 44
     },
     },
     "_enabled": true,
     "_enabled": true,
     "pre_item": [
     "pre_item": [
@@ -1873,7 +1907,7 @@
     "scr_item": [
     "scr_item": [
       "RedBagItem"
       "RedBagItem"
     ],
     ],
-    "itemInterval": 0,
+    "itemInterval": 20,
     "_id": ""
     "_id": ""
   },
   },
   {
   {
@@ -1934,17 +1968,17 @@
     },
     },
     "_children": [
     "_children": [
       {
       {
-        "__id__": 54
+        "__id__": 56
       }
       }
     ],
     ],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 57
+        "__id__": 59
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 58
+      "__id__": 60
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -1998,17 +2032,17 @@
     "_name": "按钮纹理",
     "_name": "按钮纹理",
     "_objFlags": 0,
     "_objFlags": 0,
     "_parent": {
     "_parent": {
-      "__id__": 53
+      "__id__": 55
     },
     },
     "_children": [],
     "_children": [],
     "_active": true,
     "_active": true,
     "_components": [
     "_components": [
       {
       {
-        "__id__": 55
+        "__id__": 57
       }
       }
     ],
     ],
     "_prefab": {
     "_prefab": {
-      "__id__": 56
+      "__id__": 58
     },
     },
     "_opacity": 255,
     "_opacity": 255,
     "_color": {
     "_color": {
@@ -2062,7 +2096,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 54
+      "__id__": 56
     },
     },
     "_enabled": true,
     "_enabled": true,
     "_materials": [
     "_materials": [
@@ -2105,7 +2139,7 @@
     "_name": "",
     "_name": "",
     "_objFlags": 0,
     "_objFlags": 0,
     "node": {
     "node": {
-      "__id__": 53
+      "__id__": 55
     },
     },
     "_enabled": true,
     "_enabled": true,
     "node_panel": {
     "node_panel": {
@@ -2161,7 +2195,7 @@
     },
     },
     "_enabled": true,
     "_enabled": true,
     "sroll_view": {
     "sroll_view": {
-      "__id__": 48
+      "__id__": 50
     },
     },
     "_id": ""
     "_id": ""
   },
   },

+ 7 - 1
assets/script/game/component/BtnOpenPanel.ts

@@ -12,11 +12,16 @@ export default class BtnOpenPanel extends cc.Component {
     private panel_name = '';
     private panel_name = '';
     @property({ displayName: '打开类型', tooltip: 'normal不操作,closeOther关闭其他,closeLast关闭上一个', type: cc.Enum(OpenActionType) })
     @property({ displayName: '打开类型', tooltip: 'normal不操作,closeOther关闭其他,closeLast关闭上一个', type: cc.Enum(OpenActionType) })
     private open_type = OpenActionType.normal;
     private open_type = OpenActionType.normal;
+    @property({ displayName: '点击效果', tooltip: "仅支持 NONE 和 SCALE", type: cc.Enum(cc.Button.Transition) })
+    public transition_type: cc.Button.Transition = cc.Button.Transition.NONE;
     @property({ displayName: '完成回调', tooltip: "面板打开完成后触发", type: cc.Component.EventHandler })
     @property({ displayName: '完成回调', tooltip: "面板打开完成后触发", type: cc.Component.EventHandler })
     public onComplete: cc.Component.EventHandler[] = [];
     public onComplete: cc.Component.EventHandler[] = [];
 
 
     onLoad() {
     onLoad() {
-        if (!this.node.getComponent(cc.Button)) this.node.addComponent(cc.Button);
+        if (!this.node.getComponent(cc.Button)) {
+            let btn_comp = this.node.addComponent(cc.Button);
+            btn_comp.transition = this.transition_type;
+        }
     }
     }
 
 
     start() {
     start() {
@@ -24,6 +29,7 @@ export default class BtnOpenPanel extends cc.Component {
     }
     }
 
 
     private async openPanel() {
     private async openPanel() {
+        if (!this.panel_name) return;
         await mk.ui.openPanel(this.panel_name, this.open_type);
         await mk.ui.openPanel(this.panel_name, this.open_type);
         const c_count = this.onComplete.length;
         const c_count = this.onComplete.length;
         for (let i = 0; i < c_count; i++) {
         for (let i = 0; i < c_count; i++) {