future 1 gadu atpakaļ
vecāks
revīzija
9b1e7581ba

+ 22 - 22
assets/edit_game.scene

@@ -122,8 +122,8 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 960,
-      "y": 960,
+      "x": 960.0000000000001,
+      "y": 960.0000000000002,
       "z": 0
     },
     "_lrot": {
@@ -212,8 +212,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1920,
-      "height": 1920
+      "width": 1920.0000000000002,
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -350,7 +350,7 @@
     "_priority": 0,
     "_fov": 45,
     "_fovAxis": 0,
-    "_orthoHeight": 960,
+    "_orthoHeight": 960.0000000000001,
     "_near": 0,
     "_far": 1000,
     "_color": {
@@ -539,8 +539,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 840,
-      "height": 1920
+      "width": 840.0000000000001,
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -7339,7 +7339,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -510,
+      "y": -510.0000000000001,
       "z": 0
     },
     "_lrot": {
@@ -7396,7 +7396,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 420,
+      "x": 420.00000000000006,
       "y": 0,
       "z": 0
     },
@@ -7796,7 +7796,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 800,
+      "width": 800.0000000000001,
       "height": 860
     },
     "_anchorPoint": {
@@ -7914,7 +7914,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": -285,
+      "x": -285.00000000000006,
       "y": -105,
       "z": 0
     },
@@ -8197,7 +8197,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 800,
+      "width": 800.0000000000001,
       "height": 210
     },
     "_anchorPoint": {
@@ -8281,7 +8281,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 840,
+      "width": 840.0000000000001,
       "height": 900
     },
     "_anchorPoint": {
@@ -19662,8 +19662,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 840,
-      "height": 1920
+      "width": 840.0000000000001,
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -21557,7 +21557,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 750.1330000000002,
+      "x": 750.133,
       "y": 0,
       "z": 0
     },
@@ -182798,8 +182798,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 419.9999999999998,
-      "height": 1870
+      "width": 419.9999999999999,
+      "height": 1870.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -183023,8 +183023,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 419.9999999999998,
-      "height": 1920
+      "width": 419.9999999999999,
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -188942,8 +188942,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1920,
-      "height": 1920
+      "width": 1920.0000000000002,
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 4 - 4
assets/resources/prefab/add_animation.prefab

@@ -139,8 +139,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1920,
-      "height": 1920
+      "width": 1920.0000000000002,
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -22298,8 +22298,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1920,
-      "height": 1920
+      "width": 1920.0000000000002,
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 14 - 2
assets/script/edit/Attributes.ts

@@ -1,4 +1,4 @@
-import { _decorator, Component, Director, director, instantiate, Node, Size, Vec2, Vec3 } from 'cc';
+import { _decorator, Component, Director, director, instantiate, Node, Size, SpriteFrame, Vec2, Vec3 } from 'cc';
 import { ClientEvent } from '../clientEvent';
 import { config } from '../config';
 import { att_ani_data, att_click_data, att_count_down, att_drag_data, att_question_select, att_text_sound_data, att_top_data, attributes_data, scene_tips_rule_data, widget_item_data } from '../../data/data';
@@ -214,7 +214,19 @@ export class Attributes extends Component {
     }
 
     onChangeOrigin(){
-        ClientEvent.dispatchEvent(config.Event.UpdateAttributesToView,this.cur_att_data,config.attributes_list_type.origin)
+        let call_back = (()=>{
+            ClientEvent.dispatchEvent(config.Event.UpdateAttributesToView,this.cur_att_data,config.attributes_list_type.origin)
+        })
+        if(this.cur_att_data.src) {
+            tools.loadUrl(this.cur_att_data.src,null,(sf:SpriteFrame)=>{
+                // console.log('sf=',sf.originalSize)
+                this.cur_att_data.width = sf.originalSize.width
+                this.cur_att_data.height = sf.originalSize.height
+                call_back()
+            })
+        } else {
+            call_back()
+        }
     }
 
     onChangePos(pos:Vec3){

+ 14 - 10
assets/script/edit/widget_item.ts

@@ -399,16 +399,20 @@ export class widget_item extends Component {
                     break;
                 case config.attributes_list_type.origin:
                     if(this.m_att.src.length>0){
-                        this.spr.getComponent(Sprite).sizeMode = Sprite.SizeMode.RAW;
-                        director.once(Director.EVENT_AFTER_DRAW,()=>{
-                            console.log("Director.EVENT_AFTER_DRAW")
-                            this.m_att.width =  this.spr.getComponent(UITransform).contentSize.width;
-                            this.m_att.height =  this.spr.getComponent(UITransform).contentSize.height;
-                            director.once(Director.EVENT_AFTER_DRAW,()=>{
-                                this.node.getComponent(UITransform).contentSize  = this.spr.getComponent(UITransform).contentSize
-                            })
-                            ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
-                        })
+                        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
+                        ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
+
+                        // this.spr.getComponent(Sprite).sizeMode = Sprite.SizeMode.RAW;
+                        // director.once(Director.EVENT_AFTER_DRAW,()=>{
+                        //     console.log("Director.EVENT_AFTER_DRAW")
+                        //     this.m_att.width =  this.spr.getComponent(UITransform).contentSize.width;
+                        //     this.m_att.height =  this.spr.getComponent(UITransform).contentSize.height;
+                        //     director.once(Director.EVENT_AFTER_DRAW,()=>{
+                        //         this.node.getComponent(UITransform).contentSize  = this.spr.getComponent(UITransform).contentSize
+                        //     })
+                        //     ClientEvent.dispatchEvent(config.Event.UpdateAttributes,this.getWidgetAtt())
+                        // })
                     }
                     break;
                 case config.attributes_list_type.delete:

+ 2 - 6
assets/script/tools.ts

@@ -316,13 +316,9 @@ export class tools  {
                 if(spr!=null) {
                     spr.spriteFrame = spFrame2;
                 }
-                if(call!=null) {
-                    call(spFrame2)
-                }
+                call && call(spFrame2)
             } else {
-                if(call!=null) {
-                    call(null)
-                }
+                call && call(null)
             }
         }); 
     }