mirror of
https://gitee.com/nomat/lcc-ui-sorting-group-demo.git
synced 2024-12-25 19:28:26 +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){
|
set sortingLayer(value:SortingLayer){
|
||||||
this._sortingLayer = value;
|
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){
|
set orderInLayer(value:number){
|
||||||
this._orderInLayer = value;
|
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;
|
private _uiTransform:UITransform = null;
|
||||||
|
|
||||||
onLoad(){
|
/**
|
||||||
this._uiTransform = this.getComponent(UITransform);
|
* UITransform
|
||||||
|
*/
|
||||||
|
get uiTransform(){
|
||||||
|
if(this._uiTransform == null){
|
||||||
|
this._uiTransform = this.getComponent(UITransform);
|
||||||
|
}
|
||||||
|
return this._uiTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
onEnable(){
|
onEnable(){
|
||||||
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);
|
||||||
this._uiTransform.sortingEnabled = true;
|
this.uiTransform.sortingEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onDisable(){
|
onDisable(){
|
||||||
this._uiTransform.sortingPriority = 0;
|
this.uiTransform.sortingPriority = 0;
|
||||||
this._uiTransform.sortingEnabled = false;
|
this.uiTransform.sortingEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user