import { _decorator, Color, Component, Label, Node, Sprite } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('edit_event_view_select_btn')
export class edit_event_view_select_btn extends Component {
    @property(Node) lab_name:Node = null;
    private m_type:number = 0;
    private m_call_back = null;
    public initView(type:number,name:string,call){
        this.m_type = type;
        this.m_call_back = call;
        this.lab_name.getComponent(Label).string = name;
        this.node.off(Node.EventType.TOUCH_END)
        this.node.on(Node.EventType.TOUCH_END,()=>{
            if(this.m_call_back!=null){
                this.m_call_back(this)
            }
        })
        this.unselectStatus()
    }

    public selectStatus(){
        this.node.getComponent(Sprite).color = Color.YELLOW;
    }
    public unselectStatus(){
        this.node.getComponent(Sprite).color = Color.GRAY;
    }

    public getType(){
        return this.m_type;
    }
}


