import { _decorator, Component, Node, Event, Button } from 'cc';
import { InGamePanel } from './InGamePanel';

const { ccclass, property } = _decorator;

@ccclass('SettingsPanel')
export class SettingsPanel extends InGamePanel
{
    @property({type: Button})
    private restartBtn: Button;

    @property({type: Button})
    private resumeBtn: Button;

    public fn_OnResume()
    {
        this.uiManager.fn_DeactivateCurrentActivePanel();
    }

    protected onEnable(): void 
    {
        super.onEnable();    

        this.resumeBtn.node.on(Button.EventType.CLICK, () => this.fn_OnResume());
        this.restartBtn.node.on(Button.EventType.CLICK, () => this.fn_OnRestart());
    }
    
    protected onDisable(): void 
    {
        super.onDisable();    
        
        this.resumeBtn.node.off(Button.EventType.CLICK);
        this.restartBtn.node.off(Button.EventType.CLICK);
    }
}


