kingBook

导航

CocosCreator 动态设置属性在Properties面板显示/隐藏

Test.ts

const{ccclass,property}=cc._decorator;

var KEY=cc.Enum({});
Object.assign(KEY,cc.macro.KEY);

@ccclass
export default class Test extends cc.Component{

	@property({type:KEY,visible:true})
	private _leftKey:cc.macro.KEY=cc.macro.KEY.a;
	
	@property({visible:true,})
	private _enableSecondKey:boolean=false;
	
	@property({type:KEY, visible(){return this._enableSecondKey;} })
	private _leftKey2:cc.macro.KEY=cc.macro.KEY.left;
}

posted on 2020-07-07 17:07  kingBook  阅读(1807)  评论(0编辑  收藏  举报