| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 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;
- private data = null;
-
- public setShowUI(data)
- {
- this.data = data;
- this.lbl_times.string = data.cashFrequency.toString();
- this.lbl_value.string = (data.money/100).toString();
- }
- 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();
- }
- }
- }
|