future пре 1 година
родитељ
комит
ebc6e949fc

+ 1 - 0
assets/data/data.ts

@@ -6,6 +6,7 @@ export class attributes_data{
     public img_dir = config.widget_scale_dir.normal;
     public id:number = 1;
     public name:string = "";
+    public remark:string = "";
     public type:number = 0;
     public widget_type:number = 0;
     public x:number = 0;

Разлика између датотеке није приказан због своје велике величине
+ 625 - 84
assets/edit_game.scene


+ 1 - 0
assets/script/config.ts

@@ -168,6 +168,7 @@ export class config {
         dir:"dir",
         show:"show",
         scene_rule_tips:"scene_rule_tips",
+        remark:"remark",
     }
 
     static last_id:number = 0;

+ 18 - 0
assets/script/edit/Attributes.ts

@@ -24,12 +24,14 @@ import { attributes_z_index } from './attributes/attributes_z_index';
 import { attributes_dir } from './attributes/attributes_dir';
 import { attributes_show } from './attributes/attributes_show';
 import { attributes_scene_setting } from './attributes/attributes_scene_setting';
+import { attributes_remark } from './attributes/attributes_remark';
 const { ccclass, property } = _decorator;
 
 @ccclass('Attributes')
 export class Attributes extends Component {
     private attributes_map:Map<string,Node> = new Map
     @property(Node) attributes_name:Node = null;
+    @property(Node) attributes_remark:Node = null;
     @property(Node) attributes_x_y:Node = null;
     @property(Node) attributes_w_h:Node = null;
     @property(Node) attributes_res:Node = null;
@@ -59,6 +61,7 @@ export class Attributes extends Component {
         ClientEvent.on(config.Event.UpdateAttributes,this.UpdateAttributes,this)
         ClientEvent.on(config.Event.ShowWidgetList,this.ShowWidgetList,this)
         this.attributes_map.set("name",this.attributes_name)
+        this.attributes_map.set("remark",this.attributes_remark)
         this.attributes_map.set("pos",this.attributes_x_y)
         this.attributes_map.set("size",this.attributes_w_h)
         this.attributes_map.set("url",this.attributes_res)
@@ -79,6 +82,7 @@ export class Attributes extends Component {
         this.attributes_map.set("dir",this.attributes_dir)
         this.attributes_map.set("show",this.attributes_show)
         this.attributes_map.set("scene_set",this.attributes_scene_setting)
+        this.attributes_remark.getComponent(attributes_remark).initView(this.onChangeRemark.bind(this))
         this.attributes_scene_setting.getComponent(attributes_scene_setting).initView(this.onChangSceneTipsRuleStatus.bind(this))
         this.attributes_show.getComponent(attributes_show).initView(this.onChangShowStatus.bind(this))
         this.attributes_dir.getComponent(attributes_dir).initView(this.onChangeDir.bind(this))
@@ -100,6 +104,11 @@ export class Attributes extends Component {
         this.hideAllAtt()
     }
 
+    onChangeRemark(text: string) {
+        this.cur_att_data.remark = text
+        ClientEvent.dispatchEvent(config.Event.UpdateAttributesToView,this.cur_att_data,config.attributes_list_type.remark)
+    }
+
     onChangSceneTipsRuleStatus(data:scene_tips_rule_data){
         this.cur_att_data.scene_rule_tips_data = data;
         ClientEvent.dispatchEvent(config.Event.UpdateAttributesToView,this.cur_att_data,config.attributes_list_type.scene_rule_tips)
@@ -207,6 +216,7 @@ export class Attributes extends Component {
             this.showAllAtt()
             this.attributes_map.get("scene_set").active = false;
             if(data.type===config.attributes_type.widget){
+                this.attributes_map.get("remark").active = true;
                 this.attributes_map.get("drop").active = false;
                 this.attributes_map.get("click").active = false;
                 this.attributes_map.get("slide").active = false;
@@ -256,6 +266,7 @@ export class Attributes extends Component {
             }else if(data.type===config.attributes_type.scene){
                 this.hideAllAtt()
                 this.attributes_map.get("name").active = true;
+                this.attributes_map.get("remark").active = false;
                 this.attributes_map.get("size").active = true;
                 this.attributes_map.get("url").active = true;
                 this.attributes_map.get("animation").active = true;
@@ -275,6 +286,9 @@ export class Attributes extends Component {
             let name = this.getNameCom()
             name.update_att(`${this.cur_att_data.name}-id:${this.cur_att_data.id}`)
 
+            let remark = this.getRemarkCom()
+            remark.update_att(this.cur_att_data.remark)
+
             let pos = this.getPosCom()
             pos.update_att(this.cur_att_data.x,this.cur_att_data.y,this.cur_att_data.z)
 
@@ -380,6 +394,10 @@ export class Attributes extends Component {
         return this.attributes_map.get("name").getComponent(attributes_name);
     }
 
+    getRemarkCom(){
+        return this.attributes_map.get("remark").getComponent(attributes_remark);
+    }
+
     getPosCom(){
         return this.attributes_map.get("pos").getComponent(attributes_x_y);
     }

+ 23 - 0
assets/script/edit/attributes/attributes_remark.ts

@@ -0,0 +1,23 @@
+import { _decorator, Component, EditBox, Node } from 'cc';
+const { ccclass, property } = _decorator;
+
+@ccclass('attributes_remark')
+export class attributes_remark extends Component {
+    @property(Node) editBox:Node = null;
+    private m_callback: Function = null;
+    initView(callback:Function) {
+        this.m_callback = callback
+    }
+
+    public update_att(remark:string){
+        if(remark==undefined||remark==null){ remark = ''}
+        this.editBox.getComponent(EditBox).string = remark
+    }
+
+    public editBoxEditingDidEnded(editBox: EditBox) {
+        if(this.m_callback != null) {
+            this.m_callback(editBox.string)
+        }
+    }
+}
+

+ 9 - 0
assets/script/edit/attributes/attributes_remark.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "baafbfdb-af6c-4e59-b8ab-fd392115c174",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 16 - 1
assets/script/edit/widget_item.ts

@@ -268,13 +268,27 @@ export class widget_item extends Component {
                 this.x_len =  0;
                 this.y_len = 0;
             })
-            this.node.on(Node.EventType.TOUCH_END,()=>{
+            this.node.on(Node.EventType.TOUCH_END,(et:EventTouch)=>{
                 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;
+
+                // mac电脑浏览器
+                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())
             })
           
         }
@@ -476,6 +490,7 @@ export class widget_item extends Component {
     
     public getWidgetAtt(){
         this.m_att.name = this.m_data.name!=""?this.m_data.name:"普通控件";
+        this.m_att.remark = this.m_att.remark;
         this.m_att.height = this.spr.getComponent(UITransform).contentSize.height;
         this.m_att.width = this.spr.getComponent(UITransform).contentSize.width;
         this.m_att.x = this.node.position.x;

Неке датотеке нису приказане због велике количине промена