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.
98 lines
2.8 KiB
98 lines
2.8 KiB
import { _decorator, Enum } from "cc";
|
|
import { EDITOR } from "cc/env";
|
|
import { editorConstValue } from "../Framework/Editor/editorConstValue";
|
|
import RedPointLogic from "./RedPointLogic";
|
|
import { MainRedEnum } from "./RedEnumType";
|
|
const {ccclass,menu, property,executeInEditMode,playOnFocus,executionOrder} = _decorator;
|
|
const childnum:number = 5;
|
|
@ccclass("RedEnumValue")
|
|
export default class RedEnumValue{
|
|
|
|
@property
|
|
get Reflash(): boolean {
|
|
return false;
|
|
}
|
|
set Reflash(value) {}
|
|
@property({visible:false})
|
|
_childEnum1 = 0;
|
|
@property({visible:false})
|
|
_childEnum2 = 0;
|
|
@property({visible:false})
|
|
_childEnum3 = 0;
|
|
@property({visible:false})
|
|
_childEnum4 = 0;
|
|
@property({visible:false})
|
|
_childEnum5 = 0;
|
|
@property({ type: Enum(MainRedEnum), displayName: "主类型"})
|
|
get childEnum1() {
|
|
return this._childEnum1;
|
|
};
|
|
set childEnum1(value) {
|
|
this._childEnum1 = value;
|
|
}
|
|
//MainUIRedEnum
|
|
//
|
|
@property({ type: Enum({}), displayName: "",visible: function () {
|
|
return this.setEnumPro(2);
|
|
}})
|
|
get childEnum2() {
|
|
return this._childEnum2;
|
|
};
|
|
set childEnum2(value) {
|
|
this._childEnum2 = value;
|
|
}
|
|
|
|
@property({ type: Enum({}), displayName: "",visible: function () {
|
|
return this.setEnumPro(3);
|
|
}})
|
|
get childEnum3() {
|
|
return this._childEnum3;
|
|
};
|
|
set childEnum3(value) {
|
|
this._childEnum3 = value;
|
|
}
|
|
@property({ type: Enum({}), displayName: "",visible: function () {
|
|
return this.setEnumPro(4);
|
|
} })
|
|
get childEnum4() {
|
|
return this._childEnum4;
|
|
};
|
|
set childEnum4(value) {
|
|
this._childEnum4 = value;
|
|
}
|
|
@property({ type: Enum({}), displayName: "",visible: function () {
|
|
return this.setEnumPro(5);
|
|
} })
|
|
get childEnum5() {
|
|
return this._childEnum5;
|
|
};
|
|
set childEnum5(value) {
|
|
this.childEnum5 = value;
|
|
}
|
|
|
|
setEnumPro(index:number){
|
|
let enumlist:number[] = [];
|
|
for (let i = 1; i < index; i++) {
|
|
enumlist.push(this[`_childEnum${i}`]);
|
|
}
|
|
let tenum = RedPointLogic.GetEnumKeyValue(enumlist);
|
|
let isShow:boolean = !!tenum;
|
|
if(this[`_childEnum${index-1}`] != 0 && tenum){
|
|
editorConstValue.reSetEnumArr(this, `childEnum${index}`,tenum);
|
|
}
|
|
editorConstValue.reSetKeyValueArr(this, `childEnum${index}`, `displayName`,`子类型${index}`);
|
|
this.Reflash = true;
|
|
return isShow && this[`_childEnum${index-1}`] != 0;
|
|
}
|
|
getType() {
|
|
let typelist: any[] = [];
|
|
for (let i = 1; i <= childnum; i++) {
|
|
let type = this[`childEnum${i}`];
|
|
if (!type) { break; }
|
|
typelist.push(type);
|
|
}
|
|
return typelist;
|
|
}
|
|
|
|
|
|
}
|