cc.Class({
    extends: cc.Component,

    properties: {
    },

    start () {
        const BtnExit = cc.find('BtnFrame/BtnExit', this.node);
        BtnExit.on('click', ()=>{
            const middleLayer = cc.find('middleLayer');
            if(middleLayer) {
                cc.game.removePersistRootNode(middleLayer);
            }
            cc.director.getScene().destroy();
            cc.audioEngine.stopAll();
            if (window.courseware) {
                window.courseware.freeAllOcMethod();
            }
            
            cc.director.loadScene("debug_shell", null, null, (err, scene) => {

            });
        });
        const BtnPlayAgain = cc.find('BtnFrame/BtnPlayAgain', this.node);
        BtnPlayAgain.on('click', ()=>{
            const sceneName = cc.director.getScene().name;
            cc.director.getScene().destroy();
            cc.audioEngine.stopAll();
            if (window.courseware) {
                window.courseware.freeAllOcMethod();
            }

            cc.director.loadScene(sceneName, null, null, (err, scene) => {

            });
        });
    },
});
