feat(dialog): show tip to speed up dialogs
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/dialog_tip.tres" type="DynamicFont" id=1]
|
||||
|
||||
[node name="Label" type="Label"]
|
||||
margin_left = 1057.0
|
||||
margin_top = 533.0
|
||||
margin_right = 1259.0
|
||||
margin_bottom = 551.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Haz click para acelerar el texto"
|
||||
@@ -13,6 +13,9 @@ var _preserved_type_player_type: String = ""
|
||||
# Reference to the dialog player
|
||||
var _dialog_player: Node = null
|
||||
|
||||
# Reference to the dialog hint ("click to speed up")
|
||||
var _dialog_tip: Node = null
|
||||
|
||||
# Basic state tracking
|
||||
var _is_saying: bool = false
|
||||
|
||||
@@ -67,6 +70,7 @@ func disable_preserve_dialog_box() -> void:
|
||||
if is_instance_valid(_dialog_player) and _dialog_player.get_children().has(_type_player):
|
||||
_dialog_player.remove_child(_type_player)
|
||||
_preserved_type_player_type = ""
|
||||
_dialog_player.remove_child(_dialog_tip)
|
||||
|
||||
# Output a text said by the item specified by the global id. Emit
|
||||
# `say_finished` after finishing displaying the text.
|
||||
@@ -104,6 +108,8 @@ func do_say(global_id: String, text: String) -> void:
|
||||
# before we're ready, and only if it's necessary
|
||||
if not _dialog_player.get_children().has(_type_player):
|
||||
_dialog_player.add_child(_type_player)
|
||||
if not _dialog_player.get_children().has(_dialog_tip):
|
||||
_dialog_player.add_child(_dialog_tip)
|
||||
|
||||
_type_player.say(global_id, text)
|
||||
|
||||
@@ -119,6 +125,9 @@ func _init_type_player(type: String) -> void:
|
||||
_type_player = preload(\
|
||||
"res://addons/escoria-ui-return-monkey-island-dialog-simple/types/avatar.tscn"\
|
||||
).instance()
|
||||
_dialog_tip = preload(\
|
||||
"res://addons/escoria-ui-return-monkey-island-dialog-simple/dialog_tip.tscn"\
|
||||
).instance()
|
||||
|
||||
_type_player.connect("say_finished", self, "_on_say_finished")
|
||||
_type_player.connect("say_visible", self, "_on_say_visible")
|
||||
@@ -135,6 +144,7 @@ func _initialize_say_states(global_id: String, text: String, type: String) -> vo
|
||||
func _on_say_finished():
|
||||
if not _should_preserve_dialog_box and _dialog_player.get_children().has(_type_player):
|
||||
_dialog_player.remove_child(_type_player)
|
||||
_dialog_player.remove_child(_dialog_tip)
|
||||
|
||||
_is_saying = false
|
||||
|
||||
@@ -201,6 +211,7 @@ func interrupt():
|
||||
|
||||
if not _should_preserve_dialog_box and _dialog_player.get_children().has(_type_player):
|
||||
_dialog_player.remove_child(_type_player)
|
||||
_dialog_player.remove_child(_dialog_tip)
|
||||
|
||||
emit_signal("say_finished")
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
font_data = ExtResource( 1 )
|
||||
@@ -856,7 +856,7 @@ _global_script_class_icons={
|
||||
"ESCObject": "",
|
||||
"ESCObjectManager": "",
|
||||
"ESCPlayer": "res://addons/escoria-core/design/esc_player.svg",
|
||||
"ESCPlayerWithTooltip": "",
|
||||
"ESCPlayerWithTooltip": "res://addons/escoria-core/design/esc_player.svg",
|
||||
"ESCProjectSettingsManager": "",
|
||||
"ESCResourceCache": "",
|
||||
"ESCResourceDescriptor": "",
|
||||
@@ -892,7 +892,7 @@ _global_script_class_icons={
|
||||
"InventoryAddCommand": "",
|
||||
"InventoryRemoveCommand": "",
|
||||
"ItemCountAddCommand": "",
|
||||
"ItemOutline": "res://addons/escoria-core/design/esc_item.svg",
|
||||
"ItemOutline": "",
|
||||
"PlayLibSound": "",
|
||||
"PlaySndCommand": "",
|
||||
"PlayVideoCommand": "",
|
||||
|
||||
Reference in New Issue
Block a user