import SetGray from "../../component/SetGray"; const { ccclass, property } = cc._decorator; @ccclass export default class Turnable extends cc.Component { @property({displayName: '选中节点', type: cc.Node}) private node_choose: cc.Node = null; @property({displayName: '未选中节点', type: cc.Node}) private node_noChoose: cc.Node = null; @property({displayName: '显示次数', type: cc.Label}) private lbl_times: cc.Label = null; @property({displayName: '显示金额', type: cc.Label}) private lbl_value: cc.Label = null; private isCanNotChoose: boolean = false; public setShowUI(data) { } public setIsChoose(isChoose: boolean) { if(this.isCanNotChoose) { return; } this.node_choose.active = isChoose; this.node_noChoose.active = !isChoose; } public setIsCanNotChoose() { this.isCanNotChoose = true; this.node_choose.active = true; this.node_noChoose.active = false; let com = this.node_choose.getComponent(SetGray); com.setGray(true); } public getIsCanNotChoose() { return this.isCanNotChoose; } public setRemaineTimes(times: number) { this.lbl_times.string = times.toString(); if(times <= 0) { this.setIsCanNotChoose(); } } }