future 1 year ago
parent
commit
ae7543d62e
2 changed files with 7 additions and 5 deletions
  1. 1 0
      assets/script/run/game_run.ts
  2. 6 5
      assets/script/run/widget/widget_base.ts

+ 1 - 0
assets/script/run/game_run.ts

@@ -29,6 +29,7 @@ export class game_run extends Component {
 
     protected start(): void {
         this.btn_close.on(Node.EventType.TOUCH_END,()=>{
+            this.unInit()
             this.close()
         })
     }

+ 6 - 5
assets/script/run/widget/widget_base.ts

@@ -221,17 +221,18 @@ export class widget_base extends Component {
         this.bindTarget.opacity = up_frame.transparent;
         this.bindTarget.size = new Size(up_frame.size_width,up_frame.size_height)
         this.bindTarget.pos = new Vec3(up_frame.pos_x,up_frame.pos_y)
-        this.bindTarget.anchorPointX = up_frame.anchor_point_x
-        this.bindTarget.anchorPointY = up_frame.anchor_point_y
-        
-        // anchorPointX:frame.anchor_point_x, anchorPointY:frame.anchor_point_y
-        console.log('anchorPointX=',frame.anchor_point_x,'anchorPointY=',frame.anchor_point_y)
+        let anchor_point_x = up_frame.anchor_point_x == undefined?0.5:up_frame.anchor_point_x
+        this.bindTarget.anchorPointX = anchor_point_x
+        let anchor_point_y = up_frame.anchor_point_y == undefined?0.5:up_frame.anchor_point_y
+        this.bindTarget.anchorPointY = anchor_point_y
+
         let color_opactiy_tw_size = tween(this.bindTarget)
         .to( tweenDuration, { pos:n_pos,color: _color,opacity:frame.transparent,size:new Size(frame.size_width,frame.size_height),rotation:frame.rotation, anchorPointX:frame.anchor_point_x, anchorPointY:frame.anchor_point_y}, {
             onUpdate(tar:BindTarget){
                 self.icon.getComponent(Sprite).color = tar.color; 
                 self.icon.getComponent(UIOpacity).opacity = tar.opacity;
                 self.icon.getComponent(UITransform).setContentSize(tar.size)
+                // console.log('tar.anchorPointX_Y=',tar.anchorPointX,'-',tar.anchorPointY)
                 self.icon.getComponent(UITransform).setAnchorPoint(tar.anchorPointX, tar.anchorPointY)
                 if(self.mCurAnimation.isMove){
                     self.node.position = tar.pos