Improved UI textbox
This commit is contained in:
+26
-34
@@ -2,51 +2,43 @@ 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.
|
||||
# True whenever any dialogue resource is being processed by DialogueManager.
|
||||
# Driven by DialogueManager.dialogue_started / dialogue_ended signals.
|
||||
var dialogueActive:bool = false
|
||||
|
||||
var _chatBoxes:Array = []
|
||||
# True only during a CONVERSATION-mode sequence. Blocks player movement.
|
||||
var activeConversation:bool = false
|
||||
|
||||
var DEBUG_MENU:
|
||||
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 && rootUi.debugMenu:
|
||||
if rootUi:
|
||||
return rootUi.chatBoxContainer
|
||||
return null
|
||||
|
||||
var DEBUG_MENU:DebugMenu:
|
||||
get():
|
||||
if rootUi:
|
||||
return rootUi.debugMenu
|
||||
return null
|
||||
|
||||
var MAIN_CHATBOX:
|
||||
var GAME_MENU:GameMenu:
|
||||
get():
|
||||
if rootUi && rootUi.mainChatBox:
|
||||
return rootUi.mainChatBox
|
||||
return null
|
||||
|
||||
var GAME_MENU:
|
||||
get():
|
||||
if rootUi && rootUi.gameMenu:
|
||||
if rootUi:
|
||||
return rootUi.gameMenu
|
||||
return null
|
||||
|
||||
var PAUSE_MENU:
|
||||
var PAUSE_MENU:PauseMenu:
|
||||
get():
|
||||
if rootUi && rootUi.pauseMenu:
|
||||
if rootUi:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user