class_name DebugMenu extends Control

@export var btnInitial: Button = null
@export var btnOverworld: Button = null
@export var btnBattle: Button = null
@export var btnCooking: Button = null

var isClosed:bool = false:
  get():
    return !self.visible;
  set(value):
    self.visible = !value;

func _enter_tree() -> void:
  if btnInitial:
    btnInitial.pressed.connect(onInitialPressed)
  if btnOverworld:
    btnOverworld.pressed.connect(onOverworldPressed)
  if btnBattle:
    btnBattle.pressed.connect(onBattlePressed)
  if btnCooking:
    btnCooking.pressed.connect(onCookingPressed)
  isClosed = true

func _exit_tree() -> void:
  if btnInitial:
    btnInitial.pressed.disconnect(onInitialPressed)
  if btnOverworld:
    btnOverworld.pressed.disconnect(onOverworldPressed)
  if btnBattle:
    btnBattle.pressed.disconnect(onBattlePressed)
  if btnCooking:
    btnCooking.pressed.disconnect(onCookingPressed)

func onInitialPressed() -> void:
  SCENE.setScene(SCENE.SceneType.INITIAL)

func onOverworldPressed() -> void:
  SCENE.setScene(SCENE.SceneType.OVERWORLD)

func onBattlePressed() -> void:
  SCENE.setScene(SCENE.SceneType.BATTLE)

func onCookingPressed() -> void:
  SCENE.setScene(SCENE.SceneType.COOKING)
