import { _decorator, Component, Label, Node } from 'cc';
import { config } from '../config';
const { ccclass, property } = _decorator;

@ccclass('slide_dir_select_item')
export class slide_dir_select_item extends Component {
    @property(Node) lab_name:Node = null;
    private call_back = null;
    private m_dir:number = 0;
    public initView(dir:number,call){
        this.call_back = call;
        this.m_dir = dir;
        this.lab_name.getComponent(Label).string = config.slide_type_map.get(dir)
        this.node.on(Node.EventType.TOUCH_END,()=>{
            if(this.call_back!=null){
                this.call_back(this.m_dir)
            }
        })
    }

    public initTipView(type:number,name:string,call){
        this.call_back = call;
        this.m_dir = type;
        this.lab_name.getComponent(Label).string = name;
        this.node.on(Node.EventType.TOUCH_END,()=>{
            if(this.call_back!=null){
                this.call_back(this.m_dir)
            }
        })
    }
}


