import { eventTarget, SHOW_ACTION_SCREEN, SHOW_START_SCREEN, START_GUILD_TAP } from "../Events";
import { Global } from "../Global";

const { ccclass, property } = cc._decorator;

@ccclass
export default class StartScreen extends cc.Component {
    @property(cc.Node)
    private selectBtnNode: cc.Node = null;

    protected onLoad(): void {
        this.selectBtnNode.on('click', this.onSelectBtnClick, this);

        eventTarget.on(SHOW_START_SCREEN, () => this.node.active = true, this);
        eventTarget.on(SHOW_ACTION_SCREEN, () => this.node.active = false, this);
    }

    private onSelectBtnClick() {
        Global.tool = 3;
        eventTarget.emit(SHOW_ACTION_SCREEN);
        eventTarget.emit(START_GUILD_TAP);
    }


}
