| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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();
- }
- }
- }
|