有没有人觉得3.0访问x,y,width,height,color,opacity比较繁琐

有没有人觉得3.0访问x,y,width,height,color,opacity比较繁琐…

2.0是
this.node.x
this.node.y
this.node.width
this.node.height
this.node.color
this.node.opacity

3.0是
this.node.position.x
this.node.position.y
this.node.getComponent(UITransform).width
this.node.getComponent(UITransform).height
this.node.getComponent(Sprite).color
this.node.getCOmponent(UIOpacity).opacity

调用链长了 但是结构更合理啊 而且这个可以封装以下 this. uitransform是不是就满足你需求了

干脆弄个CCNode把设置和调用都封装起来…
CCNode{

set x(){
     this.node.setPosition(x, this.node.postion.y, this.node.position.z);
}

get x(){
return this.node.position.x
}

set width(){
}

get width(){
}
}