Files
Dawn-Godot/ui/UISingleton.gd
T
2026-06-12 09:08:13 -05:00

53 lines
1.2 KiB
GDScript

extends Node
var rootUi:RootUI = null
# True for the entire duration of a DialogueAction run, including the frames
# between lines where the textbox is momentarily closed.
var dialogueActive:bool = false
var _chatBoxes:Array = []
var DEBUG_MENU:
get():
if rootUi && rootUi.debugMenu:
return rootUi.debugMenu
return null
var MAIN_CHATBOX:
get():
if rootUi && rootUi.mainChatBox:
return rootUi.mainChatBox
return null
var GAME_MENU:
get():
if rootUi && rootUi.gameMenu:
return rootUi.gameMenu
return null
var PAUSE_MENU:
get():
if rootUi && rootUi.pauseMenu:
return rootUi.pauseMenu
return null
func addChatBox(box:WorldChatBox) -> void:
_chatBoxes.append(box)
func removeChatBox(box:WorldChatBox) -> void:
_chatBoxes.erase(box)
func hasAdvanceableChatBox() -> bool:
for box in _chatBoxes:
if box.mode == WorldChatBox.Mode.ADVANCEABLE:
return true
return false
func spawnWorldChatBox(target:Node3D = null) -> WorldChatBox:
assert(rootUi != null)
var chatbox:WorldChatBox = WorldChatBox.SCENE.instantiate()
rootUi.chatBoxContainer.add_child(chatbox)
chatbox.worldTarget = target
return chatbox