future 1 rok temu
rodzic
commit
aa56d5bfad

+ 1 - 0
assets/data/data.ts

@@ -465,6 +465,7 @@ export class event_start_event_item extends base_event_item{ // 开始的事件
 }
 export class event_active_event_item extends base_event_item{ // 激活控件的事件
     public binding_widget_id:number = -1; //绑定事件
+    public binding_widget_list_id:number[] = [] //绑定事件列表
 }
 export class event_stop_active_event_item extends base_event_item{ // 不激活控件的事件,停用交互
     public binding_widget_id:number = -1; //绑定事件

Plik diff jest za duży
+ 786 - 253
assets/resources/prefab/edit_event.prefab


+ 595 - 0
assets/resources/prefab/edit_event_more_item.prefab

@@ -0,0 +1,595 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "edit_event_more_item",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "persistent": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "edit_event_more_item",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      },
+      {
+        "__id__": 8
+      },
+      {
+        "__id__": 14
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 20
+      },
+      {
+        "__id__": 22
+      },
+      {
+        "__id__": 24
+      }
+    ],
+    "_prefab": {
+      "__id__": 26
+    },
+    "_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": "lab_id",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      }
+    ],
+    "_prefab": {
+      "__id__": 7
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": -27,
+      "y": 20,
+      "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": 210,
+      "height": 50.4
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "9cwjrqYNJJwpgvMXk99y6w"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 6
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_string": "id:0001",
+    "_horizontalAlign": 1,
+    "_verticalAlign": 1,
+    "_actualFontSize": 41,
+    "_fontSize": 40,
+    "_fontFamily": "Arial",
+    "_lineHeight": 40,
+    "_overflow": 2,
+    "_enableWrapText": true,
+    "_font": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_isItalic": false,
+    "_isBold": false,
+    "_isUnderline": false,
+    "_underlineHeight": 2,
+    "_cacheMode": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "77idFVOIhNVoGw6+ljGrzO"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "c1yHtIoShOyZZ1gurMW9Vu",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "lab_remark",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 9
+      },
+      {
+        "__id__": 11
+      }
+    ],
+    "_prefab": {
+      "__id__": 13
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": -27,
+      "y": -25,
+      "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__": 8
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 10
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 210,
+      "height": 50.4
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "47KLPHInxLdJeL3ZqLZUpw"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 8
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 12
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_string": "",
+    "_horizontalAlign": 1,
+    "_verticalAlign": 1,
+    "_actualFontSize": 31,
+    "_fontSize": 30,
+    "_fontFamily": "Arial",
+    "_lineHeight": 40,
+    "_overflow": 2,
+    "_enableWrapText": true,
+    "_font": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_isItalic": false,
+    "_isBold": false,
+    "_isUnderline": false,
+    "_underlineHeight": 2,
+    "_cacheMode": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "b8a7nGyo1FzLLAC+Qxqw68"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "e7GUgujCxIArY8ZY6IjBdy",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "img_delete",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 15
+      },
+      {
+        "__id__": 17
+      }
+    ],
+    "_prefab": {
+      "__id__": 19
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 108,
+      "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__": 14
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 16
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 45,
+      "height": 45
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "0bbpcHi7hIirT5Un5rYakW"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 14
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 18
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "64c1f2bf-dc82-4530-bd30-7879d5a3e03e@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": "e7kaBFlg1ER6mbtmCRU1h2"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "2dcp/PeLBOf62s3wWHrF8b",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 21
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 290,
+      "height": 120
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "30JOtwL4tEo7E604YjtKxz"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 23
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 96,
+      "g": 218,
+      "b": 96,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 1,
+    "_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": "a5TScSz0tKn7PwDkI512sU"
+  },
+  {
+    "__type__": "d1ec17IjcFIyo9H9Zbfp5nW",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 25
+    },
+    "lab_id": {
+      "__id__": 2
+    },
+    "lab_remark": {
+      "__id__": 8
+    },
+    "img_delete": {
+      "__id__": 14
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "c0mMEEA2dNsZnD2fHWDjI7"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "c46/YsCPVOJYA4mWEpNYRx",
+    "instance": null,
+    "targetOverrides": null
+  }
+]

+ 13 - 0
assets/resources/prefab/edit_event_more_item.prefab.meta

@@ -0,0 +1,13 @@
+{
+  "ver": "1.1.49",
+  "importer": "prefab",
+  "imported": true,
+  "uuid": "52b2472d-fd7a-4536-a2c2-ef38abe4383a",
+  "files": [
+    ".json"
+  ],
+  "subMetas": {},
+  "userData": {
+    "syncNodeName": "edit_event_more_item"
+  }
+}

+ 23 - 0
assets/script/edit/event/edit_event_more_item.ts

@@ -0,0 +1,23 @@
+import { _decorator, Component, Label, Node } from 'cc';
+const { ccclass, property } = _decorator;
+
+@ccclass('edit_event_more_item')
+export class edit_event_more_item extends Component {
+    @property(Node) lab_id:Node = null;
+    @property(Node) lab_remark:Node = null;
+    @property(Node) img_delete:Node = null;
+    private m_delete_callback: Function = null;
+    start() {
+        this.img_delete.on(Node.EventType.TOUCH_END, ()=>{
+            if(this.m_delete_callback!=null) {
+                this.m_delete_callback()
+            }
+        },this)
+    }
+
+    initView(id:number, delete_callback:Function) {
+        this.m_delete_callback = delete_callback
+        this.lab_id.getComponent(Label).string = 'id:' + id
+    }
+}
+

+ 9 - 0
assets/script/edit/event/edit_event_more_item.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "d1ec1ec8-8dc1-48ca-8f47-f596dfa799d6",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 39 - 1
assets/script/edit/event/event_active_event.ts

@@ -1,9 +1,10 @@
-import { _decorator, Component, Label, Node } from 'cc';
+import { _decorator, Component, instantiate, Label, Node, Prefab } from 'cc';
 import { attributes_data, event_active_event_item, widget_item_data } from '../../../data/data';
 import { Attributes } from '../Attributes';
 import { config } from '../../config';
 import { tools } from '../../tools';
 import { ClientEvent } from '../../clientEvent';
+import { edit_event_more_item } from './edit_event_more_item';
 const { ccclass, property } = _decorator;
 
 @ccclass('event_active_event')
@@ -11,6 +12,26 @@ export class event_active_event extends Component {
     private m_data:event_active_event_item = null;
     @property(Node) btn_select_ui:Node = null;
     @property(Node) lab_name:Node = null;
+    @property(Node) btn_more:Node = null;
+    @property(Node) content:Node = null;
+    @property(Prefab) item_more_prefab:Prefab = null;
+    protected start(): void {
+        this.btn_more.on(Node.EventType.TOUCH_END, ()=> {
+            let list =  Attributes.Singleton.get_cur_scene_all_only_widget()
+            if(list.length<=0){
+                return tools.showToast("当前场景没有添控件!")
+            }
+            tools.show_select_widget_list(list,(item:widget_item_data)=>{
+                console.log('item.att')
+                let index = this.m_data.binding_widget_list_id.indexOf(item.att.id)
+                if(index!=-1) {
+                    this.m_data.binding_widget_list_id.splice(index,1)
+                }
+                this.m_data.binding_widget_list_id.push(item.att.id)
+                this.updateMoreListStatus()
+            })
+        },this)
+    }
     public initView(data:event_active_event_item){
         this.m_data = data;
         this.btn_select_ui.on(Node.EventType.TOUCH_END,()=>{
@@ -25,6 +46,7 @@ export class event_active_event extends Component {
           
         })
         this.updateStatus()
+        this.updateMoreListStatus()
         ClientEvent.on(config.Event.UpdateAttributesToView,this.UpdateAttributesToView,this)
     }
     protected onDestroy(): void {
@@ -32,6 +54,7 @@ export class event_active_event extends Component {
     }
     UpdateAttributesToView(data:attributes_data,update_type:string){
         if(this.m_data.binding_widget_id===data.id&&update_type===config.attributes_list_type.delete){
+            console.log('激活清空 激活清空')
             this.m_data.binding_widget_id = -1;
             this.updateStatus()
         }
@@ -39,6 +62,21 @@ export class event_active_event extends Component {
     updateStatus(){
         this.lab_name.getComponent(Label).string =  this.m_data.binding_widget_id===-1?"当前选择激活的控件":`当前选择激活的控件id:${this.m_data.binding_widget_id}`
     }
+    updateMoreListStatus() {
+        if(this.m_data.binding_widget_list_id==undefined) {
+            this.m_data.binding_widget_list_id = []
+        }
+        this.content.removeAllChildren()
+        for(let index = 0; index < this.m_data.binding_widget_list_id.length; index ++) {
+            const element = this.m_data.binding_widget_list_id[index]
+            let item = instantiate(this.item_more_prefab);
+            item.parent = this.content;
+            item.getComponent(edit_event_more_item).initView(element, ()=>{
+                this.m_data.binding_widget_list_id.splice(index,1)
+                this.updateMoreListStatus()
+            })
+        }
+    }
 }
 
 

+ 3 - 3
assets/script/edit/event/event_stop_active_event.ts

@@ -1,5 +1,5 @@
 import { _decorator, Component, Label, Node } from 'cc';
-import { attributes_data, event_active_event_item, widget_item_data } from '../../../data/data';
+import { attributes_data, event_stop_active_event_item, widget_item_data } from '../../../data/data';
 import { Attributes } from '../Attributes';
 import { tools } from '../../tools';
 import { ClientEvent } from '../../clientEvent';
@@ -8,10 +8,10 @@ const { ccclass, property } = _decorator;
 
 @ccclass('event_stop_active_event')
 export class event_stop_active_event extends Component {
-    private m_data:event_active_event_item = null;
+    private m_data:event_stop_active_event_item = null;
     @property(Node) btn_select_ui:Node = null;
     @property(Node) lab_name:Node = null;
-    public initView(data:event_active_event_item){
+    public initView(data:event_stop_active_event_item){
         this.m_data = data;
         this.btn_select_ui.on(Node.EventType.TOUCH_END,()=>{
             let list =  Attributes.Singleton.get_cur_scene_all_only_widget()

+ 3 - 0
assets/script/edit/widget_item.ts

@@ -142,6 +142,9 @@ export class widget_item extends Component {
             })
             item.getComponent(Sprite).color = this.getOtherDragListColor(index) //Color.YELLOW
             item.getChildByName('lab_drag_remark').getComponent(Label).string = element.remark
+            if(element.is_show_inTheEditor==undefined) {
+                element.is_show_inTheEditor = true
+            }
             item.active = element.is_show_inTheEditor
         }
         this.lab_drag.getComponent(Label).string = `${this.m_data.name}id:${this.m_att.id}`

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików