You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
785 B
29 lines
785 B
import { CCClass } from "cc";
|
|
|
|
export class editorConstValue {
|
|
|
|
static getEnumList(value:any){
|
|
let list: { name: string, value: number }[] = [];
|
|
for (const key in value) {
|
|
const element = value[key];
|
|
if (/^[0-9]+$/.test(key)) {
|
|
|
|
} else {
|
|
list.push({
|
|
name: key,
|
|
value: element,
|
|
})
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
static reSetEnumArr(target, attName: string,value:any, key: string = "enumList") {
|
|
CCClass.Attr.setClassAttr(target, attName, key,this.getEnumList(value));
|
|
}
|
|
|
|
static reSetKeyValueArr(target, attName: string, key: string, value) {
|
|
CCClass.Attr.setClassAttr(target, attName, key,value);
|
|
}
|
|
|
|
}
|