xx il y a 11 mois
Parent
commit
ba2ec9ded1

+ 4 - 1
assets/data/data.ts

@@ -36,7 +36,7 @@ export class attributes_data{
 }
 
 export class att_container{
-
+    public widget_list:widget_item_data[] = []; //控件列表
 }
 
 export class att_count_down{
@@ -77,6 +77,9 @@ export class ani_frame{ //动画帧
     public transparent:number = 255; //透明度
     public url:string = "";//资源
     public url_name:string = "";
+    public scale_x:number=1; //缩放
+    public scale_y:number = 1;
+
 }
 
 

Fichier diff supprimé car celui-ci est trop grand
+ 2026 - 199
assets/resources/prefab/add_animation.prefab


+ 4 - 0
assets/resources/prefab/run/scene_page.prefab

@@ -995,6 +995,10 @@
       "__uuid__": "6e5ce0cd-11e9-41d1-b398-5e1d6f5aab1d",
       "__expectedType__": "cc.Prefab"
     },
+    "widget_container_prefab": {
+      "__uuid__": "f5153021-1328-4821-896e-0a1097c0fbcb",
+      "__expectedType__": "cc.Prefab"
+    },
     "widget_animation_prefab": {
       "__uuid__": "cf554c72-98e6-4a7c-a229-b2db7736547d",
       "__expectedType__": "cc.Prefab"

+ 350 - 0
assets/resources/prefab/run/widget/widget_container.prefab

@@ -0,0 +1,350 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "widget_container",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "persistent": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "widget_container",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 10
+      },
+      {
+        "__id__": 12
+      },
+      {
+        "__id__": 14
+      }
+    ],
+    "_prefab": {
+      "__id__": 16
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "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.Node",
+    "_name": "img_zhaobutong",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": false,
+    "_components": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      },
+      {
+        "__id__": 7
+      }
+    ],
+    "_prefab": {
+      "__id__": 9
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "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__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 4
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 100
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "23gj6Ll/tPdq6OHEIgelsk"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 6
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "81848ce8-921b-4400-b961-a62e4d96f457@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "f7GYVnKs1KVo3etb40d0d3"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 8
+    },
+    "_alignFlags": 45,
+    "_target": null,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_horizontalCenter": 0,
+    "_verticalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 284,
+    "_originalHeight": 268,
+    "_alignMode": 2,
+    "_lockFlags": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "35PDEOvCNPxI6jtOxxNG5M"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "68XIga/DNJ1b0X8NU4SnEx",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 11
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 100
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "88hqnMkhpPGqb/qDFn4uBx"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 13
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": null,
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "39cBmhhZFOhbPBVAFNYqgn"
+  },
+  {
+    "__type__": "7a28fFHboNAJJatS8adI5Yv",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 15
+    },
+    "icon": {
+      "__id__": 1
+    },
+    "img_zhaobutong": {
+      "__id__": 2
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "c7O76gxcpOTaLctjdN7Op+"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "43bsJEwzBMBriLvLW10lgK",
+    "instance": null,
+    "targetOverrides": null
+  }
+]

+ 13 - 0
assets/resources/prefab/run/widget/widget_container.prefab.meta

@@ -0,0 +1,13 @@
+{
+  "ver": "1.1.49",
+  "importer": "prefab",
+  "imported": true,
+  "uuid": "f5153021-1328-4821-896e-0a1097c0fbcb",
+  "files": [
+    ".json"
+  ],
+  "subMetas": {},
+  "userData": {
+    "syncNodeName": "widget_container"
+  }
+}

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

@@ -44,22 +44,25 @@
       },
       {
         "__id__": 132
+      },
+      {
+        "__id__": 140
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 140
+        "__id__": 146
       },
       {
-        "__id__": 142
+        "__id__": 148
       },
       {
-        "__id__": 144
+        "__id__": 150
       }
     ],
     "_prefab": {
-      "__id__": 146
+      "__id__": 152
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -3310,6 +3313,133 @@
     "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
+  {
+    "__type__": "cc.Node",
+    "_name": "container",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 141
+      },
+      {
+        "__id__": 143
+      }
+    ],
+    "_prefab": {
+      "__id__": 145
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "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__": 140
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 142
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 210,
+      "height": 210
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "1ci2YjOKJNFKjmdCobzG6/"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 140
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 144
+    },
+    "_alignFlags": 45,
+    "_target": null,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_horizontalCenter": 0,
+    "_verticalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 100,
+    "_originalHeight": 100,
+    "_alignMode": 2,
+    "_lockFlags": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "85VqtT3rVNg6ARycCYQ1Fy"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "97HEUX4HNCwa3lZuZpTtrC",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
   {
     "__type__": "cc.UITransform",
     "_name": "",
@@ -3320,7 +3450,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 141
+      "__id__": 147
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -3348,7 +3478,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 143
+      "__id__": 149
     },
     "lab_name": {
       "__id__": 17
@@ -3384,6 +3514,10 @@
       "__uuid__": "647d2443-215f-435c-8ea1-55a948f5e099",
       "__expectedType__": "cc.Prefab"
     },
+    "self_pf": {
+      "__uuid__": "26a4ee93-2eda-4748-8fe4-558a29b656a3",
+      "__expectedType__": "cc.Prefab"
+    },
     "toggle_active": {
       "__id__": 88
     },
@@ -3402,6 +3536,9 @@
     "btn_delete": {
       "__id__": 132
     },
+    "container": {
+      "__id__": 140
+    },
     "_id": ""
   },
   {
@@ -3416,9 +3553,9 @@
     "node": {
       "__id__": 1
     },
-    "_enabled": true,
+    "_enabled": false,
     "__prefab": {
-      "__id__": 145
+      "__id__": 151
     },
     "_id": ""
   },

+ 1 - 0
assets/script/config.ts

@@ -205,6 +205,7 @@ export class config {
         rotation:"rotation",
         anchor:"anchor",
         show_more_scene_arrow:"show_more_scene_arrow",
+        container:"container",
     }
 
     static last_id:number = 0;

+ 17 - 1
assets/script/edit/Attributes.ts

@@ -121,7 +121,7 @@ export class Attributes extends Component {
         return this._main
     }
     onContainerAddWidget(){
-
+        ClientEvent.dispatchEvent(config.Event.UpdateAttributesToView,this.cur_att_data,config.attributes_list_type.container)
     }
 
     onChangeRemark(text: string) {
@@ -534,6 +534,12 @@ export class Attributes extends Component {
             for (let i = 0; i < element.page_widget_list.length; i++) {
                 const widget = element.page_widget_list[i];
                 temp.push(widget)
+                if(widget.type==config.Widget_Type_List.CONTAINER_LAYER){
+                    for (let j = 0; j < widget.att.container_layer.widget_list.length; j++) {
+                        const element = widget.att.container_layer.widget_list[j];
+                        temp.push(element)
+                    }
+                }
             }
         }
         return temp;
@@ -552,6 +558,16 @@ export class Attributes extends Component {
                 if(type===widget.type){
                     temp.push(widget)
                 }
+                if(type==config.Widget_Type_List.CONTAINER_LAYER){
+                    if(widget.att.container_layer!=null){
+                        for (let j = 0; j <   widget.att.container_layer.widget_list.length; j++) {
+                            const container_widget = widget.att.container_layer.widget_list[j];
+                            if(type===container_widget.type){
+                                temp.push(container_widget)
+                            }
+                        }
+                    }
+                }
             }
         }
         return temp;

+ 8 - 3
assets/script/edit/animation/edit_animation.ts

@@ -1,4 +1,4 @@
-import { _decorator, Color, Component, instantiate, Label, Node, Prefab, Size, Slider, Sprite, Toggle, tween, Tween, UIOpacity, UITransform, Vec3 } from 'cc';
+import { _decorator, Color, Component, instantiate, Label, Node, Prefab, Size, Slider, Sprite, Toggle, tween, Tween, UIOpacity, UITransform, Vec2, Vec3 } from 'cc';
 import { ani_frame, att_ani_data } from '../../../data/data';
 import { frame_item } from './frame_item';
 import { new_frame } from './new_frame';
@@ -131,7 +131,9 @@ export class edit_animation extends Component {
         let self = this;
         let tweenDuration: number = frame.next_time;
         let origin_x = self.m_data.ani_frame_list[0].pos_x;
-        let origin_y = self.m_data.ani_frame_list[0].pos_y
+        let origin_y = self.m_data.ani_frame_list[0].pos_y;
+        let scale_x = self.m_data.ani_frame_list[0].scale_x;
+        let scale_y = self.m_data.ani_frame_list[0].scale_y;
         this.ani_sf.getComponent(Sprite).spriteFrame = control.res_map.get(frame.url_name)
         let n_pos:Vec3 = new Vec3(frame.pos_x-origin_x,frame.pos_y-origin_y)
         let _color = new Color()
@@ -145,6 +147,7 @@ export class edit_animation extends Component {
             rotation:number;
             anchorPointX:number;
             anchorPointY:number;
+            scale:Vec3;
         }
         let bindTarget : BindTarget = new BindTarget();
         let rotation = up_frame.rotation == undefined?0:up_frame.rotation
@@ -153,16 +156,18 @@ export class edit_animation extends Component {
         bindTarget.opacity = up_frame.transparent;
         bindTarget.size = new Size(up_frame.size_width,up_frame.size_height)
         bindTarget.pos = new Vec3(up_frame.pos_x-origin_x,up_frame.pos_y-origin_y)
+        bindTarget.scale = new Vec3(up_frame.scale_x,up_frame.scale_y)
         bindTarget.anchorPointX = up_frame.anchor_point_x==undefined?0.5:up_frame.anchor_point_x
         bindTarget.anchorPointY = up_frame.anchor_point_y==undefined?0.5:up_frame.anchor_point_y
         let color_opactiy_tw_size = tween(bindTarget)
-        .to( tweenDuration, { pos:n_pos,color: _color,opacity:frame.transparent,size:new Size(frame.size_width,frame.size_height),rotation:frame.rotation, anchorPointX:frame.anchor_point_x, anchorPointY:frame.anchor_point_y }, {
+        .to( tweenDuration, { scale:new Vec3(frame.scale_x,frame.scale_y),pos:n_pos,color: _color,opacity:frame.transparent,size:new Size(frame.size_width,frame.size_height),rotation:frame.rotation, anchorPointX:frame.anchor_point_x, anchorPointY:frame.anchor_point_y }, {
             onUpdate(tar:BindTarget){
                 self.ani_sf.getComponent(Sprite).color = tar.color; 
                 self.ani_sf.getComponent(UIOpacity).opacity = tar.opacity;
                 self.ani_sf.getComponent(UITransform).setContentSize(tar.size)
                 self.ani_sf.position = tar.pos
                 self.ani_sf.angle = tar.rotation;
+                self.ani_sf.scale = tar.scale;
                 self.ani_sf.getComponent(UITransform).setAnchorPoint(tar.anchorPointX, tar.anchorPointY)
             }
         }).call(()=>{

+ 36 - 0
assets/script/edit/animation/new_frame.ts

@@ -36,6 +36,10 @@ export class new_frame extends Component {
 
     @property(Node) btn_update_cur_pos:Node = null;
 
+
+    @property(Node) scale_x:Node = null;
+    @property(Node) scale_y:Node = null;
+
     private m_up_frame:ani_frame = null;
     private m_create_call = null;
     private m_edit_call = null;
@@ -147,6 +151,8 @@ export class new_frame extends Component {
         this.rotation.on('editing-did-ended', this.change, this);
         this.anchor_point_x.on('editing-did-ended', this.change, this);
         this.anchor_point_y.on('editing-did-ended', this.change, this);
+        this.scale_x.on('editing-did-ended', this.change, this);
+        this.scale_y.on('editing-did-ended', this.change, this);
     }
 
     close(){
@@ -179,6 +185,15 @@ export class new_frame extends Component {
             // console.log('x=',this.m_data.rotation_x, 'y=',this.m_data.rotation_y)
             ani_frame_data.anchor_point_x = this.m_data.anchor_point_x;
             ani_frame_data.anchor_point_y = this.m_data.anchor_point_y;
+            if(this.m_data.scale_x==null||this.m_data.scale_x==undefined){
+                this.m_data.scale_x = 1
+            }
+
+            if(this.m_data.scale_y==null||this.m_data.scale_y==undefined){
+                this.m_data.scale_y = 1
+            }
+            ani_frame_data.scale_x = this.m_data.scale_x
+            ani_frame_data.scale_y = this.m_data.scale_y
             console.log("ani_frame_data//",ani_frame_data)
             if(this.checkAnchorXY()) {
                 this.m_create_call(ani_frame_data)
@@ -225,10 +240,18 @@ export class new_frame extends Component {
             if(up_frame.anchor_point_y==undefined||up_frame==null) {
                 up_frame.anchor_point_y = 0.5
             }
+            if(up_frame.scale_x==undefined||up_frame==null) {
+                up_frame.scale_x = 1
+            }
+            if(up_frame.scale_y==undefined||up_frame==null) {
+                up_frame.scale_y = 1
+            }
         } 
         this.m_data.rotation = up_frame?up_frame.rotation:0
         this.m_data.anchor_point_x = up_frame?up_frame.anchor_point_x:att.anchor_x
         this.m_data.anchor_point_y = up_frame?up_frame.anchor_point_y:att.anchor_y
+        this.m_data.scale_x = up_frame.scale_x
+        this.m_data.scale_y = up_frame.scale_y
         this.lab_origin_pos.getComponent(Label).string = `(x:${Math.floor(att.x)},y:${Math.floor(att.y)})`
         this.lab_origin_size.getComponent(Label).string = `(w:${att.width},h:${att.height})`
         this.initAtt()
@@ -263,6 +286,16 @@ export class new_frame extends Component {
         this.size_height.getComponent(EditBox).string =  this.m_data.size_height.toString()
         this.color.getComponent(EditBox).string =  this.m_data.color.toString()
         this.transparent.getComponent(EditBox).string =  this.m_data.transparent.toString()
+        
+        if(this.m_data.scale_x==undefined||this.m_data.scale_x==null) {
+            this.m_data.scale_x = 1;
+        }
+        if(this.m_data.scale_y==undefined||this.m_data.scale_y==null) {
+            this.m_data.scale_y = 1;
+        }
+        this.scale_x.getComponent(EditBox).string = this.m_data.scale_x.toString()
+        this.scale_y.getComponent(EditBox).string = this.m_data.scale_y.toString()
+
         if(this.m_data.rotation==undefined){
             this.m_data.rotation = 0;
         }
@@ -297,6 +330,9 @@ export class new_frame extends Component {
         this.m_data.size_height = parseInt(this.size_height.getComponent(EditBox).string)
         this.m_data.color = this.color.getComponent(EditBox).string
         this.m_data.transparent = parseInt(this.transparent.getComponent(EditBox).string)
+    
+        this.m_data.scale_x = parseInt(this.scale_x.getComponent(EditBox).string)
+        this.m_data.scale_y = parseInt(this.scale_y.getComponent(EditBox).string)
     }
 
     checkAnchorXY():boolean {

+ 13 - 2
assets/script/edit/attributes/attributes_container.ts

@@ -2,7 +2,7 @@ import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
 import { Attributes } from '../Attributes';
 import { config } from '../../config';
 import { widget_item } from '../widget_item';
-import { att_click_data, att_container } from '../../../data/data';
+import { att_click_data, att_container, widget_item_data } from '../../../data/data';
 const { ccclass, property } = _decorator;
 
 @ccclass('attributes_container')
@@ -24,8 +24,19 @@ export class attributes_container extends Component {
     addWidgetByType(type:number){
         // let node = instantiate(this.item_prefab)
         let node =  this.cur_att_manager.getMain().control_view.getWidgetByType(type)
+        // let temp_data =  node.getComponent(widget_item).getData(); 
         // node.getComponent(widget_item).initWidgetByScene(data)
-        this.cur_att_manager.getMain().onPushEndWidget(node,Attributes.Singleton.get_cur_att_data().id)  
+        let att = Attributes.Singleton.get_cur_att_data()
+        // if(att.container_layer==null){
+        //     att.container_layer = new att_container
+        // }
+        // let data  = new widget_item_data(temp_data.name,temp_data.type)
+        // data.att = temp_data.att;
+        // att.container_layer.widget_list.push(data)
+        // if(this.call_back){
+        //     this.call_back()
+        // }
+        this.cur_att_manager.getMain().onPushEndWidget(node,att.id,type)  
     }
     start() {
         this.btn_add_animation.on(Node.EventType.TOUCH_END,()=>{

+ 17 - 1
assets/script/edit/cur_edit_scene.ts

@@ -77,14 +77,30 @@ export class cur_edit_scene extends Component {
         let cur_page_num = this.getCurEditBaseView().cur_page();
         let cur_page_data =  scene_data.page_list[cur_page_num]
         let temp = []
+        // console.log("updateWidgetData",bg)
         for (let index = 0; index < bg.children.length; index++) {
             let node = bg.children[index]
             let temp_data =  node.getComponent(widget_item).getData(); 
             let data  = new widget_item_data(temp_data.name,temp_data.type)
-            data.att = temp_data.att;
+            if(temp_data.type==config.Widget_Type_List.CONTAINER_LAYER){
+                let container = node.getComponent(widget_item).getContainer()
+                temp_data.att.container_layer.widget_list = []
+                for (let j = 0; j < container.children.length; j++) {
+                    const element = container.children[j];
+                    let element_data =  element.getComponent(widget_item).getWidgetAtt(); 
+                    let item_data  = new widget_item_data(element_data.name,element_data.widget_type)
+                    item_data.att = element_data
+                    temp_data.att.container_layer.widget_list.push(item_data)
+                }
+                data.att = temp_data.att;
+            }else{
+                data.att = temp_data.att;
+            }
             temp.push(data)
         }
         cur_page_data.page_widget_list =temp
+        // console.log("updateWidgetData",temp)
+
     }
     public removeWidget(node:Node){
         // let scene_data = this.getCurEditSceneData()

+ 1 - 1
assets/script/edit/scroll_scene.ts

@@ -97,7 +97,7 @@ export class scroll_scene extends Component {
     public addContainer(container_id:number,node:Node){
         let container = this.getWidget(container_id)
         if(container!=null){
-            node.parent = container
+            node.parent = container.getComponent(widget_item).getContainer()
         }
     }
 

+ 1 - 0
assets/script/edit/show_widget_list.ts

@@ -22,6 +22,7 @@ export class show_widget_list extends Component {
             item.parent = this.content;
             let item_component = item.getComponent(widget_item)
             item_component.initHideDragOtherList()
+            item_component.hideContainerChilden()
             item_component.initView(element,this.onItemClick.bind(this),null)
             item_component.showButtonDelete(true,this.onItemDeleteClick.bind(this))
 

+ 3 - 0
assets/script/edit/task/scene_task.ts

@@ -347,6 +347,9 @@ export class scene_task extends Component {
         let item_spacing_y:number = 20
 
         let task_data = this.getTaskData()
+        if(task_data==null){
+            return console.error("任务数据是空的")
+        }
         let data_list = task_data.event_list
         let check_yes = false
         for (let index = 0; index < data_list.length; index++) {

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

@@ -23,12 +23,14 @@ export class widget_item extends Component {
     @property(Prefab) text_sound_pf:Prefab = null;
     @property(Prefab) count_down_pf:Prefab = null;
     @property(Prefab) question_select_pf:Prefab = null;
+    @property(Prefab) self_pf:Prefab = null;
     @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;
     @property(Node) btn_look_voice_text:Node = null;
     @property(Node) btn_delete:Node = null;
+    @property(Node) container:Node = null;
     private m_data:widget_item_data = null;
     private m_att:attributes_data = null;
     private isMove:boolean = false;
@@ -40,12 +42,16 @@ export class widget_item extends Component {
     private x_len:number = 0;
     private y_len:number = 0;
     private m_isShowDragOtherList:boolean = false;
+    private m_isShowContainerChilden:boolean = true;
     private m_delete_cb = null;
     protected start(): void {
         this.btn_delete.on(Node.EventType.TOUCH_END, ()=>{
             this.m_delete_cb && this.m_delete_cb(this)
         })
     }
+    public hideContainerChilden(){
+        this.m_isShowContainerChilden = false
+    }
     public initHideDragOtherList() {
         // 点击->控件列表,不显示拖拽其他按钮
         this.m_isShowDragOtherList = true
@@ -197,7 +203,17 @@ export class widget_item extends Component {
     }
 
     initConatiner(){
-        
+        let container_layer = this.m_att.container_layer
+        this.container.removeAllChildren()
+        if(container_layer!=null){
+            for (let index = 0; index < container_layer.widget_list.length; index++) {
+                const widget_data = container_layer.widget_list[index];
+                console.log("widget_data",widget_data)
+                let node = instantiate(this.self_pf)
+                node.getComponent(widget_item).initWidgetByScene(widget_data,widget_data.att)
+                node.parent = this.container
+            }
+        }
     }
 
     initCountDown(){
@@ -266,7 +282,9 @@ export class widget_item extends Component {
             if(this.m_att.container_layer===null){
                 this.m_att.container_layer = new att_container;
             }
-            this.initConatiner()
+            if(this.m_isShowContainerChilden){
+                this.initConatiner()
+            }
             this.lab_name.getComponent(Label).string =`容器层-id:${this.m_att.id}`
         }
         this.node.active = this.m_att.edit_active
@@ -378,6 +396,7 @@ export class widget_item extends Component {
             return;
         }
         if(data.id===this.m_att.id){
+            console.log("this.m_att",this.m_att)
             switch(update_type){
                 case config.attributes_list_type.pos:
                     this.m_att.x = data.x;
@@ -545,6 +564,10 @@ export class widget_item extends Component {
                 case config.attributes_list_type.show:
                     this.m_att.is_show = data.is_show;
                 break;
+                case config.attributes_list_type.container:
+                    this.m_att.container_layer = data.container_layer
+                    // this.initConatiner()
+                break;
             }
         }
         director.once(Director.EVENT_AFTER_DRAW,()=>{
@@ -662,6 +685,9 @@ export class widget_item extends Component {
         this.m_data = data;
     }
 
+    public getContainer(){
+        return this.container
+    }
 
 }
 

+ 2 - 1
assets/script/edit/widget_list.ts

@@ -33,7 +33,8 @@ export class widget_list extends Component {
         let content = this.node.getComponent(ScrollView).content
         for (let index = 0; index < content.children.length; index++) {
             const element = content.children[index];
-            if(element.getComponent(widget_item).getData().type==type){
+            let data = element.getComponent(widget_item).getData()
+            if(data.type==type){
                 return element
             }
         }

+ 4 - 2
assets/script/main.ts

@@ -134,7 +134,9 @@ export class main extends Component {
             this.action_node.active = true;
             let clone_node = instantiate(node)
             clone_node.parent = this.action_node;
-            clone_node.getComponent(widget_item).setData(node.getComponent(widget_item).getData())
+            let data = node.getComponent(widget_item).getData()
+            console.log("getData",data)
+            clone_node.getComponent(widget_item).setData(data)
             let n_p = node.parent.getComponent(UITransform).convertToWorldSpaceAR(node.position)
             clone_node.position = n_p;
         }
@@ -207,7 +209,7 @@ export class main extends Component {
         return this.res_action_node.children.length>0
     }
 
-    public onPushEndWidget(node:Node,container_id:number){
+    public onPushEndWidget(node:Node,container_id:number,type:number){
         this.onDragWidget(node)
         ClientEvent.dispatchEvent(config.Event.DragWidgetEnd,container_id)
         this.action_node.removeAllChildren()

+ 1 - 1
assets/script/run/gameManager.ts

@@ -384,7 +384,7 @@ export class gameManager extends Component {
         let temp:widget_item_data[] = []
         for (let index = 0; index < scene_data.page_widget_list.length; index++) {
             const data = scene_data.page_widget_list[index];
-            if(data.type<=4 ){
+            if(data.type<=4 ||data.type==config.Widget_Type_List.CONTAINER_LAYER){
                 temp.push(data)
             }
         }

+ 68 - 0
assets/script/run/scene_page.ts

@@ -25,6 +25,7 @@ export class scene_page extends Component {
     @property(Prefab) widget_drag_prefab:Prefab = null;
     @property(Prefab) widget_slide_prefab:Prefab = null;
     @property(Prefab) widget_img_prefab:Prefab = null;
+    @property(Prefab) widget_container_prefab:Prefab = null;
     @property(Prefab) widget_animation_prefab:Prefab = null;
     private mData:scene_item_data = null;
     private mIsMask:boolean = false;
@@ -231,6 +232,9 @@ export class scene_page extends Component {
                         item = instantiate(this.widget_drag_prefab)
                     }
                 break;
+                case config.Widget_Type_List.CONTAINER_LAYER:
+                    item = instantiate(this.widget_container_prefab)
+                break;
                 case config.Widget_Type_List.IMG_TYPE:
                     item = instantiate(this.widget_img_prefab)
                 break;
@@ -248,6 +252,70 @@ export class scene_page extends Component {
                     item.parent = this.content;
                     this.mWidgetList.set(widget_data.att.id,item)
                 }
+                //新增加容器控件
+                if(widget_data.type==config.Widget_Type_List.CONTAINER_LAYER&&com!=null){
+                    this.initContainerWidgetList(com.getIcon(),widget_data.att.container_layer.widget_list)
+                }
+            }
+        }
+    }
+
+
+    public initContainerWidgetList(container:Node,widget_list:widget_item_data[]){
+        widget_list.sort((a,b)=>{
+            return a.att.z - b.att.z;
+        })
+        let is_dai_dao_ju_drag = (id:number)=>{
+            let task:guo_ju_qing_dai_dao_ju =gameManager.Singleton.mSceneManager.getSceneTask()._guo_ju_qing_dai_dao_ju;
+            if(task==null){
+                return false;
+            }
+
+            for (let index = 0; index < task.widget_list.length; index++) {
+                const element = task.widget_list[index];
+                if(id==element.widget_id){
+                    return true
+                }
+            }
+            return false;
+        } 
+        for (let index = 0; index < widget_list.length; index++) {
+            const widget_data = widget_list[index];
+            let item:Node = null;
+            switch (widget_data.type) {
+                case config.Widget_Type_List.CLICK_TYPE:
+                    item = instantiate(this.widget_click_prefab)
+                break;
+                case config.Widget_Type_List.SLIDE_TYPE:
+                    item = instantiate(this.widget_slide_prefab)
+                break;
+                case config.Widget_Type_List.DRAG_TYPE:
+                    if(is_dai_dao_ju_drag(widget_data.att.id)){
+
+                    }else{
+                        item = instantiate(this.widget_drag_prefab)
+                    }
+                break;
+                // case config.Widget_Type_List.CONTAINER_LAYER:
+                //     item = instantiate(this.widget_container_prefab)
+                // break;
+                case config.Widget_Type_List.IMG_TYPE:
+                    item = instantiate(this.widget_img_prefab)
+                break;
+                case config.Widget_Type_List.ACTION_TYPE:
+                    item = instantiate(this.widget_animation_prefab)
+                break;
+            }
+            if(item){
+                let com = item.getComponent(widget_base);
+                if(com===null){
+                    console.log("error--widget_data.type:",widget_data.type)
+                }else{
+                    item.name =`type${widget_data.type}-id${ widget_data.att.id}`
+                    com.initView(widget_data)
+                    item.parent =container;
+                    this.mWidgetList.set(widget_data.att.id,item)
+                }
             }
     
     

+ 8 - 1
assets/script/run/widget/widget_base.ts

@@ -14,6 +14,7 @@ class BindTarget{
     rotation:number;
     anchorPointX:number;
     anchorPointY:number;
+    scale:Vec3;
 }
 @ccclass('widget_base')
 export class widget_base extends Component {
@@ -240,15 +241,17 @@ export class widget_base extends Component {
         this.bindTarget.opacity = up_frame.transparent;
         this.bindTarget.size = new Size(up_frame.size_width,up_frame.size_height)
         this.bindTarget.pos = new Vec3(up_frame.pos_x,up_frame.pos_y)
+        this.bindTarget.scale = new Vec3(up_frame.scale_x,up_frame.scale_y)
         this.bindTarget.anchorPointX = up_frame.anchor_point_x==undefined?0.5:up_frame.anchor_point_x
         this.bindTarget.anchorPointY = up_frame.anchor_point_y==undefined?0.5:up_frame.anchor_point_y
 
         let color_opactiy_tw_size = tween(this.bindTarget)
-        .to( tweenDuration, { pos:n_pos,color: _color,opacity:frame.transparent,size:new Size(frame.size_width,frame.size_height),rotation:frame.rotation, anchorPointX:frame.anchor_point_x, anchorPointY:frame.anchor_point_y}, {
+        .to( tweenDuration, { scale:new Vec3(frame.scale_x,frame.scale_y),pos:n_pos,color: _color,opacity:frame.transparent,size:new Size(frame.size_width,frame.size_height),rotation:frame.rotation, anchorPointX:frame.anchor_point_x, anchorPointY:frame.anchor_point_y}, {
             onUpdate(tar:BindTarget){
                 self.icon.getComponent(Sprite).color = tar.color; 
                 self.icon.getComponent(UIOpacity).opacity = tar.opacity;
                 self.icon.getComponent(UITransform).setContentSize(tar.size)
+                self.icon.scale = tar.scale;
                 // console.log('tar.anchorPointX_Y=',tar.anchorPointX,'-',tar.anchorPointY)
                 self.icon.getComponent(UITransform).setAnchorPoint(tar.anchorPointX, tar.anchorPointY)
                 if(self.mCurAnimation.isMove){
@@ -283,6 +286,10 @@ export class widget_base extends Component {
 
     }
 
+    public getIcon(){
+        return this.icon
+    }
+
     public offEvent(){
         this.node.off(Node.EventType.TOUCH_START)
         this.node.off(Node.EventType.TOUCH_END)

+ 32 - 0
assets/script/run/widget/widget_container.ts

@@ -0,0 +1,32 @@
+import { _decorator, Component, Node, Size, UITransform } from 'cc';
+import { widget_base } from './widget_base';
+import { att_container } from '../../../data/data';
+const { ccclass, property } = _decorator;
+
+@ccclass('widget_container')
+export class widget_container extends widget_base {
+    @property(Node) img_zhaobutong:Node = null;
+    private mContainerData:att_container = null;
+    protected init(): void {
+        if(this.mData.att.container_layer!=null){
+            this.mContainerData = this.mData.att.container_layer
+        }
+    }
+
+    protected update(dt: number): void {
+    //    let node =  this.getIcon()
+    //    let origin_width =  this.mData.att.width
+    //    let origin_height = this.mData.att.height
+    //    let cur_width = node.getComponent(UITransform).contentSize.width
+    //    let cur_height = node.getComponent(UITransform).contentSize.height
+    //    let scaleX = cur_width/origin_width
+    //    let scaleY = cur_height/origin_height
+ 
+    //    for (let index = 0; index < node.children.length; index++) {
+    //         const element = node.children[index];
+    //         element.setScale(scaleX,scaleY,1)
+    //    }
+    }
+}
+
+

+ 9 - 0
assets/script/run/widget/widget_container.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "7a28f147-6e83-4024-96ad-4bc69d23962f",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff