future 1 年之前
父節點
當前提交
027c90030f

+ 1 - 0
assets/data/data.ts

@@ -14,6 +14,7 @@ export class attributes_data{
     public z:number = 0;
     public width:number = 0;
     public height:number = 0;
+    public rotation:number = 0;
     public src:string = "";
     public src_name:string = "";
     public ani:string = "";

文件差異過大導致無法顯示
+ 303 - 410
assets/edit_game.scene


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

@@ -2571,7 +2571,7 @@
       "b": 0,
       "a": 255
     },
-    "_string": "备注",
+    "_string": "",
     "_horizontalAlign": 1,
     "_verticalAlign": 1,
     "_actualFontSize": 21,

+ 1 - 0
assets/script/config.ts

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

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

@@ -25,6 +25,7 @@ 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';
+import { attributes_rotation } from './attributes/attributes_rotation';
 const { ccclass, property } = _decorator;
 
 @ccclass('Attributes')
@@ -34,6 +35,7 @@ export class Attributes extends Component {
     @property(Node) attributes_remark:Node = null;
     @property(Node) attributes_x_y:Node = null;
     @property(Node) attributes_w_h:Node = null;
+    @property(Node) attributes_rotation:Node = null;
     @property(Node) attributes_res:Node = null;
     @property(Node) attributes_origin:Node = null;
     @property(Node) attributes_be_event:Node = null; //被动事件
@@ -64,6 +66,7 @@ export class Attributes extends Component {
         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("rotation",this.attributes_rotation)
         this.attributes_map.set("url",this.attributes_res)
         this.attributes_map.set("origin",this.attributes_origin)
         // this.attributes_map.set("be_event",this.attributes_be_event)
@@ -100,6 +103,7 @@ export class Attributes extends Component {
         this.attributes_delete.getComponent(attributes_delete).initView(this.onDelete.bind(this))
         this.attributes_w_h.getComponent(attributes_w_h).initView(this.onChangeSize.bind(this))
         this.attributes_x_y.getComponent(attributes_x_y).initView(this.onChangePos.bind(this))
+        this.attributes_rotation.getComponent(attributes_rotation).initView(this.onChangeRotation.bind(this))
         this.attributes_origin.getComponent(attributes_origin).initView(this.onChangeOrigin.bind(this))
         this.hideAllAtt()
     }
@@ -109,6 +113,11 @@ export class Attributes extends Component {
         ClientEvent.dispatchEvent(config.Event.UpdateAttributesToView,this.cur_att_data,config.attributes_list_type.remark)
     }
 
+    onChangeRotation(rotation: number) {
+        this.cur_att_data.rotation = rotation
+        ClientEvent.dispatchEvent(config.Event.UpdateAttributesToView,this.cur_att_data,config.attributes_list_type.rotation)
+    }
+
     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)
@@ -225,6 +234,7 @@ export class Attributes extends Component {
                 this.attributes_map.get("text_sound").active = false;
                 this.attributes_map.get("count_down").active = false;
                 this.attributes_map.get("z_index").active = false;
+                this.attributes_map.get("rotation").active = true;
                 if(data.widget_type===config.Widget_Type_List.DRAG_TYPE){
                     this.attributes_map.get("drop").active = true;
                 }else if(data.widget_type===config.Widget_Type_List.CLICK_TYPE){
@@ -246,7 +256,8 @@ export class Attributes extends Component {
                     this.attributes_map.get("url").active = false;
                     this.attributes_map.get("pos").active = false;
                     this.attributes_map.get("size").active = false;
-                    this.attributes_map.get("text_sound").active = true;
+                    this.attributes_map.get("rotation").active = false;
+                    this.attributes_map.get("rotation").active = false;
                 }else if(data.widget_type===config.Widget_Type_List.QUESTION_SELECT){
                     this.attributes_map.get("animation").active = false;
                     this.attributes_map.get("origin").active = false;
@@ -255,6 +266,7 @@ export class Attributes extends Component {
                     this.attributes_map.get("size").active = false;
                     this.attributes_map.get("pos").active = true;
                     this.attributes_map.get("question_select").active = true;
+                    this.attributes_map.get("rotation").active = false;
                 }else if(data.widget_type===config.Widget_Type_List.COUNT_DOWN){
                     this.attributes_map.get("animation").active = false;
                     this.attributes_map.get("origin").active = false;
@@ -262,6 +274,7 @@ export class Attributes extends Component {
                     this.attributes_map.get("pos").active = true;
                     this.attributes_map.get("size").active = false;
                     this.attributes_map.get("count_down").active = true;
+                    this.attributes_map.get("rotation").active = false;
                 }
             }else if(data.type===config.attributes_type.scene){
                 this.hideAllAtt()
@@ -271,6 +284,7 @@ export class Attributes extends Component {
                 this.attributes_map.get("url").active = true;
                 this.attributes_map.get("animation").active = true;
                 this.attributes_map.get("scene_set").active = true;
+                this.attributes_map.get("rotation").active = false;
             }
             this.scheduleOnce(()=>{
                 this.updateAttInfo()
@@ -295,6 +309,9 @@ export class Attributes extends Component {
             let size = this.getSizeCom()
             size.update_att(this.cur_att_data.width,this.cur_att_data.height)
 
+            let rotation = this.getRotationCom()
+            rotation.update_att(this.cur_att_data.rotation)
+
             let url = this.getUrlCom()
             url.update_att(this.cur_att_data.src_name)
 
@@ -406,6 +423,10 @@ export class Attributes extends Component {
         return this.attributes_map.get("size").getComponent(attributes_w_h);
     }
 
+    getRotationCom(){
+        return this.attributes_map.get("rotation").getComponent(attributes_rotation);
+    }
+
     getEditActiveCom(){
         return this.attributes_map.get("active").getComponent(attributes_active);
     }

+ 26 - 0
assets/script/edit/attributes/attributes_rotation.ts

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

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

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "bac185c8-2c77-4cfa-95bc-d32aad69f11d",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 5 - 0
assets/script/edit/scroll_scene.ts

@@ -37,6 +37,10 @@ export class scroll_scene extends Component {
                     this.m_att.height = data.height;
                     this.getBg().getComponent(UITransform).contentSize = new Size(data.width,data.height)
                     break;
+                case config.attributes_list_type.rotation:
+                    this.m_att.rotation = data.rotation;
+                    this.getBg().angle = data.rotation;
+                    break;
                 case config.attributes_list_type.url:
                     this.m_att.src = data.src
                     this.m_att.src_name = data.src_name
@@ -152,6 +156,7 @@ export class scroll_scene extends Component {
         this.m_att.name = this.m_data.name!=""?this.m_data.name:"场景";
         this.m_att.height = this.getBg().getComponent(UITransform).contentSize.height;
         this.m_att.width = this.getBg().getComponent(UITransform).contentSize.width;
+        this.m_att.rotation = this.getBg().angle;
         this.m_att.type = config.attributes_type.scene;
         this.m_att.src_name = this.m_att.src.length>0? this.m_att.src_name:"空";
         return this.m_att;

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

@@ -353,6 +353,10 @@ export class widget_item extends Component {
                     this.spr.getComponent(UITransform).contentSize = new Size(data.width,data.height)
                     this.node.getComponent(UITransform).contentSize  = this.spr.getComponent(UITransform).contentSize
                     break;
+                case config.attributes_list_type.rotation:
+                    this.m_att.rotation = data.rotation;
+                    this.node.angle = data.rotation;
+                    break
                 case config.attributes_list_type.url:
                     this.m_att.src = data.src
                     this.m_att.src_name = data.src_name
@@ -524,6 +528,7 @@ export class widget_item extends Component {
         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.rotation = this.m_att.rotation;
         this.m_att.x = this.node.position.x;
         this.m_att.widget_type = this.m_data.type;
         this.m_att.y = this.node.position.y;
@@ -543,6 +548,7 @@ export class widget_item extends Component {
         if(this.call_back==null){
             this.node.position =  new Vec3(this.m_att.x,this.m_att.y)
             this.node.getComponent(UITransform).setContentSize(new Size( this.m_att.width,this.m_att.height))
+            this.node.angle = this.m_att.rotation
             if(this.m_att.drag_data!=null){
                 this.drag.position =  new Vec3(this.m_att.drag_data.drag_pos_x,this.m_att.drag_data.drag_pos_y)
                 this.drag.getComponent(UITransform).setContentSize(new Size(this.m_att.drag_data.drag_size_width ,this.m_att.drag_data.drag_size_height ))

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

@@ -30,6 +30,7 @@ export class widget_base extends Component {
         this.mData = data;
         this.icon.getComponent(UITransform).contentSize = new Size(this.mData.att.width,this.mData.att.height)
         this.icon.position = new Vec3(this.mData.att.x,this.mData.att.y)
+        this.icon.angle = this.mData.att.rotation
         if(this.icon.getComponent(UIOpacity)===null){
             this.icon.addComponent(UIOpacity)
         }

部分文件因文件數量過多而無法顯示