import { eventTarget, SHOW_ACTION_SCREEN, SHOW_SELECT_POPUP } from "../Events";


const { ccclass, property } = cc._decorator;

@ccclass
export default class SelectPopup extends cc.Component {

    private _okBtnNode: cc.Node = null;

    onLoad() {
        this._okBtnNode = this.getComponentInChildren(cc.Button).node;
        this.node.active = false;
        this.node.position = cc.v3();
        eventTarget.on(SHOW_SELECT_POPUP, this.showPopup, this);
        this._okBtnNode.on('click', this.onOkBtnClick, this);
    }


    private showPopup() {
        this.node.active = true;
    }
    private onOkBtnClick() {
        this.node.active = false;
        eventTarget.emit(SHOW_ACTION_SCREEN);
    }

}
