
import { _decorator, Component, Node, director } from 'cc';

import BasePanel from '../core/component/BasePanel';
import { audioMgr } from '../core/manager/AudioManager';
import Data from '../core/manager/Data';
import { Main } from '../game/Main';
import { GameConst } from '../core/common/GameConst';
const { ccclass, property } = _decorator;

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

    onBtnClicked(event: any, customEventData: any) {
       audioMgr.playOneShot(GameConst.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.I.backHall();
                break;
            case "btn_replay":
                this.close();
                Main.I.play();
                break;
        }
    }

}
