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

@ccclass('check_open')
export class check_open extends Component {
    @property(Node) btn_back:Node = null;
    @property(Node) btn_ok:Node = null;
    private m_call_back = null;
    public show(call){
        this.node.active = true;
        this.m_call_back = call;
        this.btn_back.off(Node.EventType.TOUCH_END)
        this.btn_back.on(Node.EventType.TOUCH_END,()=>{
            this.close()
            gameManager.Singleton.sys_click_button_music()
        })
        this.btn_ok.off(Node.EventType.TOUCH_END)
        this.btn_ok.on(Node.EventType.TOUCH_END,()=>{
            if(this.m_call_back!=null){
                this.m_call_back()
            }
            gameManager.Singleton.sys_click_button_music()
            this.close()
        })
    }

    close(){
        this.node.active = false;
    }
}


