mirror of
https://gitee.com/nomat/lcc-ui-sorting-group-demo.git
synced 2025-01-14 07:01:03 +00:00
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import { UITransform } from "cc";
|
|
import { JSB } from "cc/env";
|
|
|
|
declare module 'cc' {
|
|
interface UITransform {
|
|
|
|
/**
|
|
* 排序优先级 - private
|
|
*/
|
|
_sortingPriority:number;
|
|
|
|
/**
|
|
* 排序优先级
|
|
*/
|
|
sortingPriority:number;
|
|
|
|
/**
|
|
* 排序优使能 - private
|
|
*/
|
|
_sortingEnabled:boolean;
|
|
|
|
/**
|
|
* 排序优使能
|
|
*/
|
|
sortingEnabled:boolean;
|
|
}
|
|
}
|
|
|
|
if(!('sortingPriority' in UITransform.prototype)){
|
|
Object.defineProperty(UITransform.prototype, 'sortingPriority', {
|
|
get: function() {
|
|
return this._sortingPriority;
|
|
},
|
|
set: function(value) {
|
|
this._sortingPriority = value;
|
|
if(JSB){
|
|
this.node.uiSortingPriority = value;
|
|
}
|
|
},
|
|
enumerable: true
|
|
});
|
|
|
|
Object.defineProperty(UITransform.prototype, 'sortingEnabled', {
|
|
get: function() {
|
|
return this._sortingEnabled;
|
|
},
|
|
set: function(value) {
|
|
this._sortingEnabled = value;
|
|
if(JSB){
|
|
this.node.uiSortingEnabled = value;
|
|
}
|
|
},
|
|
enumerable: true
|
|
});
|
|
}
|