future 1 year ago
parent
commit
9e254a6648
2 changed files with 160 additions and 10 deletions
  1. 150 8
      assets/resources/prefab/widget_item.prefab
  2. 10 2
      assets/script/edit/widget_item.ts

+ 150 - 8
assets/resources/prefab/widget_item.prefab

@@ -40,14 +40,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 106
+        "__id__": 112
       },
       {
-        "__id__": 108
+        "__id__": 114
       }
     ],
     "_prefab": {
-      "__id__": 110
+      "__id__": 116
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -1903,16 +1903,19 @@
       },
       {
         "__id__": 89
+      },
+      {
+        "__id__": 103
       }
     ],
     "_active": false,
     "_components": [
       {
-        "__id__": 103
+        "__id__": 109
       }
     ],
     "_prefab": {
-      "__id__": 105
+      "__id__": 111
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -2424,6 +2427,142 @@
     "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
+  {
+    "__type__": "cc.Node",
+    "_name": "lab_remark",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 82
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 104
+      },
+      {
+        "__id__": 106
+      }
+    ],
+    "_prefab": {
+      "__id__": 108
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": -102,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 103
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 105
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 200,
+      "height": 50.4
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "42RdnWIJlLk6l5B+/+FPJ2"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 103
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 107
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_string": "备注",
+    "_horizontalAlign": 1,
+    "_verticalAlign": 1,
+    "_actualFontSize": 19,
+    "_fontSize": 20,
+    "_fontFamily": "Arial",
+    "_lineHeight": 40,
+    "_overflow": 2,
+    "_enableWrapText": true,
+    "_font": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_isItalic": false,
+    "_isBold": true,
+    "_isUnderline": false,
+    "_underlineHeight": 2,
+    "_cacheMode": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "f3mfdyradKDoaQDp7KHrDE"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "abTNOex05O3IjNzMcN7nXa",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
   {
     "__type__": "cc.UITransform",
     "_name": "",
@@ -2434,7 +2573,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 104
+      "__id__": 110
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -2475,7 +2614,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 107
+      "__id__": 113
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -2503,7 +2642,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 109
+      "__id__": 115
     },
     "lab_name": {
       "__id__": 17
@@ -2548,6 +2687,9 @@
     "other_drag_content": {
       "__id__": 2
     },
+    "lab_remark": {
+      "__id__": 103
+    },
     "_id": ""
   },
   {

+ 10 - 2
assets/script/edit/widget_item.ts

@@ -27,6 +27,7 @@ export class widget_item extends Component {
     @property(Node) toggle_active:Node = null;
     @property(Node) toggle_check:Node = null;
     @property(Node) other_drag_content:Node = null;
+    @property(Node) lab_remark:Node = null;
     private m_data:widget_item_data = null;
     private m_att:attributes_data = null;
     private isMove:boolean = false;
@@ -51,6 +52,7 @@ export class widget_item extends Component {
                         this.call_back(this.m_data)
                     }
                 })
+                this.lab_remark.getComponent(Label).string = this.m_data.att.remark
             }else{
                 this.node.on(Node.EventType.TOUCH_END,()=>{
                     if(this.call_back!=null){
@@ -224,11 +226,17 @@ export class widget_item extends Component {
         this.m_data = data;
         this.initWidgetHaveAtt(att)
         if(this.m_data.type===config.Widget_Type_List.UI_TOP){ //弹窗不可以拖动
-            this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
+            // this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
+            //     ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
+            // })
+            this.node.on(Node.EventType.TOUCH_END,(et:EventTouch)=>{
                 ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
             })
         }else if(this.m_data.type===config.Widget_Type_List.TEXT_SOUND){
-            this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
+            // this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
+            //     ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
+            // })
+            this.node.on(Node.EventType.TOUCH_END,(et:EventTouch)=>{
                 ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
             })
         }else{