future 11 місяців тому
батько
коміт
152a6eeb0d

+ 3 - 0
assets/data/data.ts

@@ -307,6 +307,9 @@ export class widget_item_data  {
     public name:string = "";
     public type:number =0;
     public att:attributes_data = null;
+    public scene_type:number = 0; //场景类型
+    public scene_page_number:number = 0;//场景页码
+    public is_container_layer:boolean = false; //是容器层
 }
 
 export class scene_item_data  {

+ 2 - 2
assets/resources/prefab/edit_event.prefab

@@ -46465,8 +46465,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1919.9999999999998,
-      "height": 1919.9999999999998
+      "width": 1920,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 5 - 5
assets/resources/prefab/select_widget_list.prefab

@@ -824,7 +824,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 900,
-      "height": 0
+      "height": 70
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -896,9 +896,9 @@
     "_paddingLeft": 10,
     "_paddingRight": 0,
     "_paddingTop": 0,
-    "_paddingBottom": 0,
+    "_paddingBottom": 70,
     "_spacingX": 50,
-    "_spacingY": 50,
+    "_spacingY": 70,
     "_verticalDirection": 1,
     "_horizontalDirection": 0,
     "_constraint": 2,
@@ -1320,8 +1320,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1919.9999999999998,
-      "height": 1919.9999999999998
+      "width": 1920,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 7 - 7
assets/resources/prefab/show_widget_list.prefab

@@ -166,7 +166,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 0,
+      "y": -30,
       "z": 0
     },
     "_lrot": {
@@ -403,7 +403,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 12,
-      "height": 800
+      "height": 850
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -644,7 +644,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 400,
+      "y": 425,
       "z": 0
     },
     "_lrot": {
@@ -685,7 +685,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 900,
-      "height": 800
+      "height": 850
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -830,7 +830,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 900,
-      "height": 0
+      "height": 70
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -902,7 +902,7 @@
     "_paddingLeft": 10,
     "_paddingRight": 0,
     "_paddingTop": 0,
-    "_paddingBottom": 0,
+    "_paddingBottom": 70,
     "_spacingX": 50,
     "_spacingY": 70,
     "_verticalDirection": 1,
@@ -958,7 +958,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 900,
-      "height": 800
+      "height": 850
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 12 - 12
assets/resources/prefab/widget_item.prefab

@@ -2071,7 +2071,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 47.358,
+      "y": 5,
       "z": 0
     },
     "_lrot": {
@@ -2120,8 +2120,8 @@
     },
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 0,
-      "y": 25.97,
+      "x": 20.112,
+      "y": 0,
       "z": 0
     },
     "_lrot": {
@@ -2161,8 +2161,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 160,
-      "height": 50.4
+      "width": 136,
+      "height": 31.5
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -2200,10 +2200,10 @@
     "_string": "在场景中是否显示",
     "_horizontalAlign": 1,
     "_verticalAlign": 1,
-    "_actualFontSize": 20,
-    "_fontSize": 20,
+    "_actualFontSize": 17,
+    "_fontSize": 17,
     "_fontFamily": "Arial",
-    "_lineHeight": 40,
+    "_lineHeight": 25,
     "_overflow": 0,
     "_enableWrapText": true,
     "_font": null,
@@ -2263,8 +2263,8 @@
     },
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 0,
-      "y": -12.222,
+      "x": -67.839,
+      "y": 0,
       "z": 0
     },
     "_lrot": {
@@ -2592,8 +2592,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 100,
-      "height": 100
+      "width": 200,
+      "height": 30
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 30 - 4
assets/script/edit/Attributes.ts

@@ -525,6 +525,7 @@ export class Attributes extends Component {
 
     public get_cur_scene_all_widget():widget_item_data[]{ //获取当前所有控件
         let data = this._main.edit_scene_view.getCurSelectScene()
+        // console.log('get_cur_scene_all_widget ==',data)
         if(!data){
             return []
         }
@@ -533,11 +534,16 @@ export class Attributes extends Component {
             const element = data.page_list[index];
             for (let i = 0; i < element.page_widget_list.length; i++) {
                 const widget = element.page_widget_list[i];
+                widget.scene_type = data.type
+                widget.scene_page_number = index+1
                 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)
+                        const container_widget = widget.att.container_layer.widget_list[j];
+                        container_widget.scene_type = data.type
+                        container_widget.scene_page_number = index+1
+                        container_widget.is_container_layer = true
+                        temp.push(container_widget)
                     }
                 }
             }
@@ -555,13 +561,18 @@ export class Attributes extends Component {
             const element = data.page_list[index];
             for (let i = 0; i < element.page_widget_list.length; i++) {
                 const widget = element.page_widget_list[i];
+                widget.scene_type = data.type
+                widget.scene_page_number = index+1
                 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++) {
+                        for (let j = 0; j < widget.att.container_layer.widget_list.length; j++) {
                             const container_widget = widget.att.container_layer.widget_list[j];
+                            container_widget.scene_type = data.type
+                            container_widget.scene_page_number = index+1
+                            container_widget.is_container_layer = true
                             if(type===container_widget.type){
                                 temp.push(container_widget)
                             }
@@ -583,14 +594,19 @@ export class Attributes extends Component {
             const element = data.page_list[index];
             for (let i = 0; i < element.page_widget_list.length; i++) {
                 const widget = element.page_widget_list[i];
+                widget.scene_type = data.type
+                widget.scene_page_number = index+1
                 if(widget.type!=config.Widget_Type_List.UI_TOP){
                     temp.push(widget)
                 }
 
                 if(widget.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++) {
+                        for (let j = 0; j < widget.att.container_layer.widget_list.length; j++) {
                             const container_widget = widget.att.container_layer.widget_list[j];
+                            container_widget.scene_type = data.type
+                            container_widget.scene_page_number = index+1
+                            container_widget.is_container_layer = true
                             temp.push(container_widget)
                         }
                     }
@@ -606,6 +622,8 @@ export class Attributes extends Component {
             const element = data.page_list[index];
             for (let i = 0; i < element.page_widget_list.length; i++) {
                 const widget = element.page_widget_list[i];
+                widget.scene_type = data.type
+                widget.scene_page_number = index+1
                 if(widget.att.id===id){
                     return widget;
                 }
@@ -614,6 +632,9 @@ export class Attributes extends Component {
                     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];
+                            container_widget.scene_type = data.type
+                            container_widget.scene_page_number = index+1
+                            container_widget.is_container_layer = true
                             if(container_widget.att.id===id){
                                 return container_widget;
                             }
@@ -632,6 +653,8 @@ export class Attributes extends Component {
             const element = data.page_list[index];
             for (let i = 0; i < element.page_widget_list.length; i++) {
                 const widget = element.page_widget_list[i];
+                widget.scene_type = data.type
+                widget.scene_page_number = index+1
                 if(widget.att.id===select_widget.att.id){
                     page_index = index;
                     break;
@@ -641,6 +664,9 @@ export class Attributes extends Component {
                     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];
+                            container_widget.scene_type = data.type
+                            container_widget.scene_page_number = index+1
+                            container_widget.is_container_layer = true
                             if(container_widget.att.id===select_widget.att.id){
                                 page_index = index;
                                 break;

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

@@ -46,7 +46,7 @@ export class cur_edit_scene extends Component {
                 }
                 if(container_id==-1){
                     page.getComponent(scroll_scene).addWidget(node)
-                    setTimeout(()=>{node.getComponent(widget_item).initWidgetAddCurEditSecne()},50)
+                    node.getComponent(widget_item).initWidgetAddCurEditSecne(50)
                 }else{
                     node.position = new Vec3(0,0);
                     page.getComponent(scroll_scene).addContainer(container_id,node)

+ 2 - 1
assets/script/edit/event/select_widget_list.ts

@@ -15,8 +15,9 @@ export class select_widget_list extends Component {
             const element = list[index];
             let item = instantiate(this.item_prefab)
             item.parent = this.content;
-            item.getComponent(widget_item).initHideDragOtherList()
+            item.getComponent(widget_item).hideDragOtherList()
             item.getComponent(widget_item).initView(element,this.onItemClick.bind(this),cur_select_id)
+            item.getComponent(widget_item).showPageNumberName()
         }
         this.btn_close.on(Node.EventType.TOUCH_END,()=>{
             this.close()

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

@@ -21,9 +21,10 @@ export class show_widget_list extends Component {
             let item = instantiate(this.item_prefab)
             item.parent = this.content;
             let item_component = item.getComponent(widget_item)
-            item_component.initHideDragOtherList()
+            item_component.hideDragOtherList()
             item_component.hideContainerChilden()
             item_component.initView(element,this.onItemClick.bind(this),null)
+            item_component.showPageNumberName()
             item_component.showButtonDelete(true,this.onItemDeleteClick.bind(this))
 
         }

+ 85 - 47
assets/script/edit/widget_item.ts

@@ -50,9 +50,24 @@ export class widget_item extends Component {
         })
     }
 
-    public initWidgetAddCurEditSecne() {
-        this.lab_name.setPosition(this.lab_name.getPosition().x,-117,0)
-        this.lab_name.getComponent(Label).string = this.m_data.name + (this.m_data.att?`id:${this.m_data.att.id}`:"");
+    public showPageNumberName() {
+        // console.log('showPageNumberName lab_name=',this.lab_name.getComponent(Label).string)
+        if(this.m_data.scene_type>0) {
+            if(this.m_data.is_container_layer) {
+                let name = `第${this.m_data.scene_page_number}页-容器层-${this.lab_name.getComponent(Label).string}`
+                this.lab_name.getComponent(Label).string = name
+            } else {
+                let name = `第${this.m_data.scene_page_number}页-${this.lab_name.getComponent(Label).string}`
+                this.lab_name.getComponent(Label).string = name
+            }
+        }
+    }
+
+    public initWidgetAddCurEditSecne(timeout:number=0) {
+        setTimeout(()=>{
+            this.updateLabNamePosition()
+            this.lab_name.getComponent(Label).string = this.m_data.name + (this.m_data.att?`id:${this.m_data.att.id}`:"");
+        },timeout)  
     }
 
     public initWidgetType() {
@@ -62,7 +77,7 @@ export class widget_item extends Component {
     public hideContainerChilden(){
         this.m_isShowContainerChilden = false
     }
-    public initHideDragOtherList() {
+    public hideDragOtherList() {
         // 点击->控件列表,不显示拖拽其他按钮
         this.hideContainerChilden()
         this.m_isShowDragOtherList = true
@@ -219,7 +234,7 @@ export class widget_item extends Component {
         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)
+                // 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
@@ -246,49 +261,55 @@ export class widget_item extends Component {
             this.m_att.id = config.getNewId();
         }
 
-        if(this.m_data.type===config.Widget_Type_List.DRAG_TYPE){
-            if(this.m_att.drag_data===null){
-                this.m_att.drag_data = new att_drag_data;
-            }
-            this.drag.active = true;
-            if(this.m_isShowDragOtherList == false) {
-                this.initDrag()
+        if(this.m_data.type===config.Widget_Type_List.CLICK_TYPE){
+            if(this.m_att.click_data===null){
+                this.m_att.click_data = new att_click_data;
             }
+            this.lab_name.getComponent(Label).string = config.clcik_type_map.get(this.m_att.click_data.click_type) +`id:${this.m_att.id}`
         }else if(this.m_data.type===config.Widget_Type_List.SLIDE_TYPE){
             this.slide.active = true;
             if(this.m_att.slide_data===null){
                 this.m_att.slide_data = new att_slide_data;
             }
             this.initSlide()
-        }else if(this.m_data.type===config.Widget_Type_List.CLICK_TYPE){
-            if(this.m_att.click_data===null){
-                this.m_att.click_data = new att_click_data;
+            this.lab_name.getComponent(Label).string = `滑动id:${this.m_att.id}`
+        }else if(this.m_data.type===config.Widget_Type_List.DRAG_TYPE){
+            if(this.m_att.drag_data===null){
+                this.m_att.drag_data = new att_drag_data;
             }
-            this.lab_name.getComponent(Label).string = config.clcik_type_map.get(this.m_att.click_data.click_type) +`id${this.m_att.id}`
+            this.drag.active = true;
+            if(this.m_isShowDragOtherList == false) {
+                this.initDrag()
+            }
+            this.lab_name.getComponent(Label).string = `拖拽id:${this.m_att.id}`
         }else if(this.m_data.type===config.Widget_Type_List.UI_TOP){
             if(this.m_att.top_data===null){
                 this.m_att.top_data = new att_top_data;
             }
             this.initUiWidget()
-            this.lab_name.getComponent(Label).string = `弹窗:${config.top_view_type_map.get(this.m_att.top_data.top_ui_type)}:id${this.m_att.id}`
+            this.lab_name.getComponent(Label).string = `弹窗:${config.top_view_type_map.get(this.m_att.top_data.top_ui_type)}:id:${this.m_att.id}`
+        }else if(this.m_data.type==config.Widget_Type_List.IMG_TYPE) {
+            this.lab_name.getComponent(Label).string = `图片id:${this.m_att.id}`
+        }else if(this.m_data.type==config.Widget_Type_List.ACTION_TYPE) {
+            this.lab_name.getComponent(Label).string = `动画id:${this.m_att.id}`
         }else if(this.m_data.type===config.Widget_Type_List.TEXT_SOUND){
             if(this.m_att.text_sound_data===null){
                 this.m_att.text_sound_data = new att_text_sound_data;
             }
-            this.lab_name.getComponent(Label).string =`文本和语音-id:${this.m_att.id}`
+            this.lab_name.getComponent(Label).string =`文本和语音id:${this.m_att.id}`
             this.initTextSound()
         }else if(this.m_data.type===config.Widget_Type_List.QUESTION_SELECT){
             if(this.m_att.question_select===null){
                 this.m_att.question_select = new att_question_select;
             }
             this.initQuestionSelect()
-            this.lab_name.getComponent(Label).string =`问题选择-id:${this.m_att.id}`
+            this.lab_name.getComponent(Label).string =`问题选择id:${this.m_att.id}`
         }else if(this.m_data.type===config.Widget_Type_List.COUNT_DOWN){
             if(this.m_att.count_down===null){
                 this.m_att.count_down = new att_count_down;
             }
             this.initCountDown()
-            this.lab_name.getComponent(Label).string =`倒计时-id:${this.m_att.id}`
+            this.lab_name.getComponent(Label).string =`倒计时id:${this.m_att.id}`
         }else if(this.m_data.type===config.Widget_Type_List.CONTAINER_LAYER){
             if(this.m_att.container_layer===null){
                 this.m_att.container_layer = new att_container;
@@ -296,7 +317,7 @@ export class widget_item extends Component {
             if(this.m_isShowContainerChilden){
                 this.initConatiner()
             }
-            this.lab_name.getComponent(Label).string =`容器层-id:${this.m_att.id}`
+            this.lab_name.getComponent(Label).string =`容器层id:${this.m_att.id}`
         }
         this.node.active = this.m_att.edit_active
     }
@@ -327,6 +348,13 @@ export class widget_item extends Component {
             })
         }
         else if(this.m_data.type==config.Widget_Type_List.CONTAINER_LAYER){
+            // MAC电脑浏览器
+            if(config.is_MAC_edit) {
+                this.node.on(Node.EventType.TOUCH_END,(et:EventTouch)=>{
+                    ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
+                },this,true)
+                return
+            }
             this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
                 ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
             },this,true)
@@ -345,30 +373,24 @@ export class widget_item extends Component {
                     ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
                 }
             })
-            this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
-                et.propagationStopped = true;
-                let pos = this.node.parent.getComponent(UITransform).convertToWorldSpaceAR(this.node.position)
-                if(this.x_len==0){
-                    this.x_len = (et.getUILocation().x - pos.x)*2;
-                    this.y_len = (et.getUILocation().y - pos.y)*2;
-                    let p = new Vec3(et.getUILocation().x,et.getUILocation().y)
-                    let n_p = this.node.parent.getComponent(UITransform).convertToNodeSpaceAR(p)
-                    this.node.position = new Vec3(n_p.x-this.x_len,n_p.y-this.y_len);
-                    // console.log("a_x",this.x_len, this.y_len ,et.getUILocation().x,this.m_att.width)
-                }
-                // console.log("this.x_len",this.x_len,this.y_len)
-                this.isMove = true;
-                ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
-            })
-    
-            this.node.on(Node.EventType.MOUSE_LEAVE,()=>{
-                if(this.node.parent.name=="content"){
-                    this.node.parent.parent.parent.getComponent(scroll_scene).startTouch()
-                }
-                this.isMove = false;
-                this.x_len =  0;
-                this.y_len = 0;
-            })
+
+            if(!config.is_MAC_edit) {
+                this.node.on(Node.EventType.MOUSE_DOWN,(et:EventTouch)=>{
+                    et.propagationStopped = true;
+                    let pos = this.node.parent.getComponent(UITransform).convertToWorldSpaceAR(this.node.position)
+                    if(this.x_len==0){
+                        this.x_len = (et.getUILocation().x - pos.x)*2;
+                        this.y_len = (et.getUILocation().y - pos.y)*2;
+                        let p = new Vec3(et.getUILocation().x,et.getUILocation().y)
+                        let n_p = this.node.parent.getComponent(UITransform).convertToNodeSpaceAR(p)
+                        this.node.position = new Vec3(n_p.x-this.x_len,n_p.y-this.y_len);
+                        // console.log("a_x",this.x_len, this.y_len ,et.getUILocation().x,this.m_att.width)
+                    }
+                    // console.log("this.x_len",this.x_len,this.y_len)
+                    this.isMove = true;
+                    ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
+                })
+            }
             this.node.on(Node.EventType.TOUCH_END,(et:EventTouch)=>{
                 if(this.node.parent.name=="content"){
                     this.node.parent.parent.parent.getComponent(scroll_scene).startTouch()
@@ -393,7 +415,15 @@ export class widget_item extends Component {
                     ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
                 } 
             })
-          
+            
+            this.node.on(Node.EventType.MOUSE_LEAVE,()=>{
+                if(this.node.parent.name=="content"){
+                    this.node.parent.parent.parent.getComponent(scroll_scene).startTouch()
+                }
+                this.isMove = false;
+                this.x_len =  0;
+                this.y_len = 0;
+            })
         }
         ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
         ClientEvent.on(config.Event.UpdateAttributesToView,this.UpdateAttributesToView,this)
@@ -408,7 +438,7 @@ export class widget_item extends Component {
             return;
         }
         if(data.id===this.m_att.id){
-            console.log("this.m_att",this.m_att)
+            // console.log("this.m_att",this.m_att)
             switch(update_type){
                 case config.attributes_list_type.pos:
                     this.m_att.x = data.x;
@@ -425,6 +455,7 @@ export class widget_item extends Component {
                     this.m_att.height = data.height;
                     this.spr.getComponent(UITransform).contentSize = new Size(data.width,data.height)
                     this.node.getComponent(UITransform).contentSize  = this.spr.getComponent(UITransform).contentSize
+                    this.updateLabNamePosition()
                     break;
                 case config.attributes_list_type.anchor:
                     this.m_att.anchor_x = data.anchor_x;
@@ -450,6 +481,7 @@ export class widget_item extends Component {
                                 spFrame2.texture = texture;
                                 this.spr.getComponent(Sprite).spriteFrame = spFrame2
                                 this.spr.getComponent(UITransform).contentSize = new Size(data.width,data.height)
+                                this.updateLabNamePosition()
                                 director.once(Director.EVENT_AFTER_DRAW,()=>{
                                     this.node.getComponent(UITransform).contentSize  = this.spr.getComponent(UITransform).contentSize
                                 })
@@ -462,6 +494,7 @@ export class widget_item extends Component {
                     if(this.m_att.src.length>0){
                         this.spr.getComponent(UITransform).setContentSize(new Size(this.m_att.width,this.m_att.height))
                         this.node.getComponent(UITransform).contentSize  = this.spr.getComponent(UITransform).contentSize
+                        this.updateLabNamePosition()
                         ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
 
                         // this.spr.getComponent(Sprite).sizeMode = Sprite.SizeMode.RAW;
@@ -587,6 +620,11 @@ export class widget_item extends Component {
         })
     }
 
+    updateLabNamePosition() {
+        let lab_name_y = -(this.spr.getComponent(UITransform).contentSize.height/2+17) //-117
+        this.lab_name.setPosition(this.lab_name.getPosition().x,lab_name_y,0)
+    }
+
     updateDir(){
         if(this.call_back==null){
             switch (this.m_att.img_dir) {