import { _decorator, Component, Label, Node, Toggle } from 'cc';
import { PREVIEW } from 'cc/env';
import { event_item } from '../../../data/data';
const { ccclass, property } = _decorator;

@ccclass('select_collect_event_item')
export class select_collect_event_item extends Component {
    @property(Node) btn_select:Node = null;
    @property(Node) lab_name:Node = null;
    private m_data:event_item = null;
    public initView(data:event_item,isHave:boolean){
        if(isHave){
            this.btn_select.getComponent(Toggle).isChecked = true;
        }
        this.m_data = data;
        this.lab_name.getComponent(Label).string = `事件id:${this.m_data.event_id},事件名:${this.m_data.event_name}`
    }

    public getIsSelect(){
        return this.btn_select.getComponent(Toggle).isChecked;
    }

    public getData(){
        return this.m_data;
    }
}


