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

@ccclass('home_tt_sidebar')
export class home_tt_sidebar extends base_ui {
    @property(Node) btn_close:Node = null
    @property(Node) btn_lqjl:Node = null
    @property(Node) btn_go_sidebar:Node = null
    private m_go_sidebar_cb = null
    private m_lqjl_cb = null
    start() {
        this.onButtonListen(this.btn_close, ()=>{
            this.close()
        })
        this.onButtonListen(this.btn_go_sidebar, ()=>{
            if(this.m_go_sidebar_cb!=null) {
                this.m_go_sidebar_cb(this)
            }
        })
        this.onButtonListen(this.btn_lqjl,()=>{
            if(this.m_lqjl_cb!=null) {
                this.m_lqjl_cb(this)
            }
        })
    }

    show(isToEnterFromSidebar:boolean, go_sidebar_cb, lqjl_cb) {
        this.node.active = true
        this.m_go_sidebar_cb = go_sidebar_cb
        this.m_lqjl_cb = lqjl_cb
        if(isToEnterFromSidebar) {
            this.btn_lqjl.active = true
            this.btn_go_sidebar.active = false
        } else {
            this.btn_lqjl.active = false
            this.btn_go_sidebar.active = true
        }
    }

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

