future 1 yıl önce
ebeveyn
işleme
2d9765d30d

+ 1 - 1
assets/edit_game.scene

@@ -35396,7 +35396,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -1546.7000000000003,
+      "y": -1646.7000000000003,
       "z": 0
     },
     "_lrot": {

+ 16 - 3
assets/script/config.ts

@@ -1,12 +1,11 @@
-import { _decorator, Component, Node } from 'cc';
+import { _decorator, Color, Component, Node } from 'cc';
 import { scene_item_data, widget_item_data } from '../data/data';
-import { control } from './edit/control';
 const { ccclass, property } = _decorator;
 
 export class config {
     static debug = true;
     static domain = "https://zcapi.xwrun.com";
-    static is_MAC_edit = true; //目前临时处理
+    static is_MAC_edit = false; //目前临时处理
     static select_res_and_control_type = {
         RES_TYPE:0,
         CONTROL_TYPE:1,
@@ -38,6 +37,20 @@ export class config {
         ShowWidgetList:"ShowWidgetList"
     }
 
+    static COLOR_LIST = [
+        new Color().fromHEX("#2e8b57"),
+        new Color().fromHEX("#FF0000"),
+        new Color().fromHEX("#664228"),
+        new Color().fromHEX("#003153"),
+        new Color().fromHEX("#422256"),
+        new Color().fromHEX("#FBD26A"),
+        new Color().fromHEX("#004ea2"),
+        new Color().fromHEX("#ac6c56"),
+        new Color().fromHEX("#ffa631"),
+        new Color().fromHEX("#009664"),
+        new Color().fromHEX("#e7767f"),
+    ]
+
     public static init(){
         //控件
         config.Widget_Type.set(config.Widget_Type_List.CLICK_TYPE,new widget_item_data("点击",this.Widget_Type_List.CLICK_TYPE))

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

@@ -19,6 +19,7 @@ export class show_widget_list extends Component {
             const element = list[index];
             let item = instantiate(this.item_prefab)
             item.parent = this.content;
+            item.getComponent(widget_item).initIsShowWidgetList()
             item.getComponent(widget_item).initView(element,this.onItemClick.bind(this),null)
         }
         this.btn_close.on(Node.EventType.TOUCH_END,()=>{

+ 21 - 4
assets/script/edit/widget_item.ts

@@ -39,6 +39,11 @@ export class widget_item extends Component {
     private m_count_down:Node = null;
     private x_len:number = 0;
     private y_len:number = 0;
+    private m_isShowWidgetList:boolean = false;
+    public initIsShowWidgetList() {
+        // 点击->控件列表,不显示拖拽其他按钮
+        this.m_isShowWidgetList = true
+    }
     public initView(data:widget_item_data,call=null,cur_select_id:number=-1){
         this.m_data = data;
         this.lab_name.getComponent(Label).string = data.name + (this.m_data.att?`id:${this.m_data.att.id}`:"");
@@ -122,7 +127,7 @@ export class widget_item extends Component {
         }
         this.other_drag_content.removeAllChildren()
         for (let index = 0; index < this.m_att.drag_data.other_drag_list.length; index++) {
-            const element =  this.m_att.drag_data.other_drag_list[index];
+            const element:att_drag_data =  this.m_att.drag_data.other_drag_list[index];
             let item =  instantiate(this.drag)
             item.off(Node.EventType.TOUCH_MOVE)
             item.parent = this.other_drag_content;
@@ -135,7 +140,7 @@ export class widget_item extends Component {
                 this.m_att.drag_data.other_drag_list[index].drag_pos_x = item.position.x;
                 this.m_att.drag_data.other_drag_list[index].drag_pos_y = item.position.y;
             })
-            item.getComponent(Sprite).color = Color.YELLOW
+            item.getComponent(Sprite).color = this.getOtherDragListColor(index) //Color.YELLOW
         }
         this.lab_drag.getComponent(Label).string = `${this.m_data.name}id:${this.m_att.id}`
     }
@@ -196,7 +201,9 @@ export class widget_item extends Component {
                 this.m_att.drag_data = new att_drag_data;
             }
             this.drag.active = true;
-            this.initDrag()
+            if(this.m_isShowWidgetList == false) {
+                this.initDrag()
+            }
         }else if(this.m_data.type===config.Widget_Type_List.SLIDE_TYPE){
             this.slide.active = true;
             if(this.m_att.slide_data===null){
@@ -423,7 +430,7 @@ export class widget_item extends Component {
                                 this.m_att.drag_data.other_drag_list[index].drag_pos_x = item.position.x;
                                 this.m_att.drag_data.other_drag_list[index].drag_pos_y = item.position.y;
                             })
-                            item.getComponent(Sprite).color = Color.YELLOW
+                            item.getComponent(Sprite).color = this.getOtherDragListColor(index) //Color.YELLOW
                         }
                     }
                 break;
@@ -514,6 +521,16 @@ export class widget_item extends Component {
         }
     }
 
+    getOtherDragListColor(index:number):Color {
+        var color_index = index
+        if(index >= config.COLOR_LIST.length) {
+            let count = Math.floor(index / config.COLOR_LIST.length)
+            color_index = index - (config.COLOR_LIST.length * count)
+        }
+        return config.COLOR_LIST[color_index]
+        // return Color.YELLOW
+    }
+
     Shiny(){
         this.img_select.active = true;
         this.img_select.getComponent(UITransform).setContentSize(this.node.getComponent(UITransform).contentSize)