
import { _decorator, Component, Node, director } from 'cc';
import BasePanel from '../../../core/component/BasePanel';
import Data from '../../../core/manager/Data';
import { Main } from '../Main';
import { constants } from 'db://assets/data/constants';
import audioManager from 'db://assets/manager/audioManager';
const { ccclass, property } = _decorator;

@ccclass('FailLayer')
export class FailLayer extends BasePanel {

    onBtnClicked(event: any, customEventData: any) {
        audioManager.playOneShot(constants.audios.btnclick);
        var btnName = event.target.name;
        switch (btnName) {
            case "btn_hall":
                Data.user.life--;
                Data.user.life_cost_time = Date.now();
                this.close();
                Main.Instance().backHall();
                break;
            case "btn_replay":
                this.close();
                Main.Instance().play();
                break;
        }
    }

}
