First commit 🎉
This commit is contained in:
commit
43ea213f9b
728 changed files with 37080 additions and 0 deletions
39
game/gui/components/hover_text/hover_text.gd
Normal file
39
game/gui/components/hover_text/hover_text.gd
Normal file
|
@ -0,0 +1,39 @@
|
|||
extends Control
|
||||
class_name GUIHoverText
|
||||
|
||||
@export var hide_during_dialogs := false
|
||||
|
||||
@onready var label: RichTextLabel = $RichTextLabel
|
||||
|
||||
|
||||
#region Godot ######################################################################################
|
||||
func _ready() -> void:
|
||||
label.text = ""
|
||||
|
||||
# Connect to autoloads' signals
|
||||
PopochiuUtils.g.hover_text_shown.connect(_show_text)
|
||||
PopochiuUtils.g.dialog_line_started.connect(_on_dialog_line_started)
|
||||
PopochiuUtils.g.dialog_line_finished.connect(_on_dialog_line_finished)
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Virtual ####################################################################################
|
||||
func _show_text(txt := "") -> void:
|
||||
label.text = "[center]%s[/center]" % txt
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private ####################################################################################
|
||||
func _on_dialog_line_started() -> void:
|
||||
if hide_during_dialogs:
|
||||
hide()
|
||||
|
||||
|
||||
func _on_dialog_line_finished() -> void:
|
||||
if hide_during_dialogs:
|
||||
show()
|
||||
|
||||
|
||||
#endregion
|
Loading…
Add table
Add a link
Reference in a new issue