import { _decorator, Component, Label, Node } from 'cc'; import { car_item_data } from '../../data'; const { ccclass, property } = _decorator; @ccclass('car_info_shuxing') export class car_info_shuxing extends Component { @property(Node) node_chongci:Node = null @property(Node) lab_chongci:Node = null @property(Node) node_qiyou:Node = null @property(Node) lab_qiyou:Node = null @property(Node) node_dunpai:Node = null @property(Node) lab_dunpai:Node = null @property(Node) node_xingxing:Node = null @property(Node) lab_xingxing:Node = null @property(Node) node_citie:Node = null @property(Node) lab_citie:Node = null @property(Node) lab_no_shuxing:Node = null initView(data:car_item_data) { let count = 0 if(data.attribute.k_sprint_cd<=0) { this.node_chongci.active = false } else { count+=1 this.lab_chongci.getComponent(Label).string = `+${data.attribute.k_sprint_cd}秒` } if(data.attribute.k_oil_number<=0) { this.node_qiyou.active = false } else { count+=1 this.lab_qiyou.getComponent(Label).string = `+${data.attribute.k_oil_number}桶` } if(data.attribute.n_shield_cd==0) { this.node_dunpai.active = false } else { count+=1 this.lab_dunpai.getComponent(Label).string = `+${data.attribute.n_shield_cd}秒` } if(data.attribute.n_star_cd==0) { this.node_xingxing.active = false } else { count+=1 this.lab_xingxing.getComponent(Label).string = `+${data.attribute.n_star_cd}秒` } if(data.attribute.n_magnet_cd==0) { this.node_citie.active = false } else { count+=1 this.lab_citie.getComponent(Label).string = `+${data.attribute.n_magnet_cd}秒` } if(count==0) { this.lab_no_shuxing.active = true } else { this.lab_no_shuxing.active = false } } }