extends Node

var rootUi:RootUI = null

# True whenever any dialogue resource is being processed by DialogueManager.
# Driven by DialogueManager.dialogue_started / dialogue_ended signals.
var dialogueActive:bool = false

# True only during a CONVERSATION-mode sequence. Blocks player movement.
var activeConversation:bool = false

func _ready() -> void:
  DialogueManager.dialogue_started.connect(_onDialogueStarted)
  DialogueManager.dialogue_ended.connect(_onDialogueEnded)

func _onDialogueStarted(_resource:DialogueResource) -> void:
  dialogueActive = true

func _onDialogueEnded(_resource:DialogueResource) -> void:
  dialogueActive = false

var chatBoxContainer:Control:
  get():
    if rootUi:
      return rootUi.chatBoxContainer
    return null

var DEBUG_MENU:DebugMenu:
  get():
    if rootUi:
      return rootUi.debugMenu
    return null

var GAME_MENU:GameMenu:
  get():
    if rootUi:
      return rootUi.gameMenu
    return null

var PAUSE_MENU:PauseMenu:
  get():
    if rootUi:
      return rootUi.pauseMenu
    return null
