mirror of
https://gitee.com/nomat/lcc-ui-sorting-group-demo.git
synced 2024-12-25 03:08:28 +00:00
3.6.3获取UITransfrom问题
This commit is contained in:
parent
b27ec37d0c
commit
774a649bcd
@ -23,7 +23,7 @@ export class SortingGroup extends Component {
|
||||
}
|
||||
set sortingLayer(value:SortingLayer){
|
||||
this._sortingLayer = value;
|
||||
this._uiTransform.sortingPriority = Math.sign(this._sortingLayer) * (Math.abs(this._sortingLayer) * ORDER_IN_LAYER_MAX + this._orderInLayer);
|
||||
this.uiTransform.sortingPriority = Math.sign(this._sortingLayer) * (Math.abs(this._sortingLayer) * ORDER_IN_LAYER_MAX + this._orderInLayer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,22 +41,31 @@ export class SortingGroup extends Component {
|
||||
}
|
||||
set orderInLayer(value:number){
|
||||
this._orderInLayer = value;
|
||||
this._uiTransform.sortingPriority = Math.sign(this._sortingLayer) * (Math.abs(this._sortingLayer) * ORDER_IN_LAYER_MAX + this._orderInLayer);
|
||||
this.uiTransform.sortingPriority = Math.sign(this._sortingLayer) * (Math.abs(this._sortingLayer) * ORDER_IN_LAYER_MAX + this._orderInLayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* UITransform
|
||||
*/
|
||||
private _uiTransform:UITransform = null;
|
||||
|
||||
onLoad(){
|
||||
/**
|
||||
* UITransform
|
||||
*/
|
||||
get uiTransform(){
|
||||
if(this._uiTransform == null){
|
||||
this._uiTransform = this.getComponent(UITransform);
|
||||
}
|
||||
return this._uiTransform;
|
||||
}
|
||||
|
||||
onEnable(){
|
||||
this._uiTransform.sortingPriority = Math.sign(this._sortingLayer) * (Math.abs(this._sortingLayer) * ORDER_IN_LAYER_MAX + this._orderInLayer);
|
||||
this._uiTransform.sortingEnabled = true;
|
||||
this.uiTransform.sortingPriority = Math.sign(this._sortingLayer) * (Math.abs(this._sortingLayer) * ORDER_IN_LAYER_MAX + this._orderInLayer);
|
||||
this.uiTransform.sortingEnabled = true;
|
||||
}
|
||||
|
||||
onDisable(){
|
||||
this._uiTransform.sortingPriority = 0;
|
||||
this._uiTransform.sortingEnabled = false;
|
||||
this.uiTransform.sortingPriority = 0;
|
||||
this.uiTransform.sortingEnabled = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user