future 11 maanden geleden
bovenliggende
commit
c646b10e67
1 gewijzigde bestanden met toevoegingen van 14 en 6 verwijderingen
  1. 14 6
      assets/script/run/widget/widget_base.ts

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

@@ -76,7 +76,6 @@ export class widget_base extends Component {
         // ClientEvent.on(config.EventRun.NOTICE_EVENT,this.beActive.bind(this),this)
         // ClientEvent.on(config.EventRun.WIDGET_HIDE,this.hide.bind(this),this)
     };
-
     updateDir(){
         switch (this.mData.att.img_dir) {
             case config.widget_scale_dir.left:
@@ -171,7 +170,6 @@ export class widget_base extends Component {
                             tools.loadUrl(att_res,this.icon.getComponent(Sprite))
                         }
                     }
-
                 break;
                 case config.event_type.show_new_item: //显示自己同时被激活
                     
@@ -243,14 +241,16 @@ 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==undefined?0.5:up_frame.anchor_point_x
-        this.bindTarget.anchorPointY = up_frame.anchor_point_y==undefined?0.5:up_frame.anchor_point_y
         up_frame.scale_x = up_frame.scale_x==undefined?1:up_frame.scale_x
         up_frame.scale_y = up_frame.scale_y==undefined?1:up_frame.scale_y
-        this.bindTarget.scale = new Vec3(up_frame.scale_x,up_frame.scale_y)
+        
         frame.scale_x = frame.scale_x==undefined?1:frame.scale_x
         frame.scale_y = frame.scale_y==undefined?1:frame.scale_y
 
+        this.bindTarget.scale = new Vec3(up_frame.scale_x,up_frame.scale_y)
+        this.bindTarget.anchorPointX = up_frame.anchor_point_x==undefined?0.5:up_frame.anchor_point_x
+        this.bindTarget.anchorPointY = up_frame.anchor_point_y==undefined?0.5:up_frame.anchor_point_y
+
         let color_opactiy_tw_size = tween(this.bindTarget)
         .to( tweenDuration, { scale:new Vec3(frame.scale_x,frame.scale_y),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){
@@ -280,11 +280,18 @@ export class widget_base extends Component {
         return this.mIsShow;
     }
     public getScenePage():scene_page {
-        if(this.node.parent.name=="content"){
+        let name = this.node.parent.name
+        let parent_name = this.node.parent.parent.name
+        if(name=="content"){
             let parent = this.node.parent.parent.parent.parent
             let c_scene_page = parent.getComponent(scene_page)
             return c_scene_page                   
         }
+        if(parent_name=="content"){
+            let parent = this.node.parent.parent.parent.parent.parent
+            let c_scene_page = parent.getComponent(scene_page)
+            return c_scene_page                   
+        }
         return null
     }
     protected registeredEvent(){
@@ -315,6 +322,7 @@ export class widget_base extends Component {
         this.isInit = is_init;
         this.initWidget(data)
     };
+    
     public getData(){
         return  this.mData
     }