hide tooltips while speaking. Abstract ItemComponent, clean up, gitignore addons. Default font. Fixes #138 #130

This commit is contained in:
2025-09-21 02:55:22 +02:00
parent 6c8d542e53
commit a88b015faa
11 changed files with 35 additions and 71 deletions

4
.gitignore vendored
View File

@@ -12,3 +12,7 @@ bin
addons/escoria-core/default_bus_layout.tres addons/escoria-core/default_bus_layout.tres
.idea/ .idea/
# Optional Addons per environment.
addons/godot-plugin-refresher/
addons/script-ide/

View File

@@ -36,7 +36,7 @@ func _ready() -> void:
# - type: required type # - type: required type
# *Returns* Whether the type is supported or not # *Returns* Whether the type is supported or not
func has_type(type: String) -> bool: func has_type(type: String) -> bool:
return true if type in ["floating"] else false return true if type == "floating" else false
# Check whether a specific chooser type is supported by the # Check whether a specific chooser type is supported by the
# dialog plugin # dialog plugin
@@ -142,11 +142,13 @@ func _on_say_finished():
_is_saying = false _is_saying = false
say_finished.emit() _dialog_player.say_finished.emit()
escoria.game_scene.show_tooltips()
func _on_say_visible(): func _on_say_visible():
say_visible.emit() escoria.game_scene.hide_tooltips()
# Present an option chooser to the player and sends the signal # Present an option chooser to the player and sends the signal
@@ -159,12 +161,15 @@ func _on_say_visible():
func choose(dialog_player: Node, dialog: ESCDialog, type: String): func choose(dialog_player: Node, dialog: ESCDialog, type: String):
_dialog_player = dialog_player _dialog_player = dialog_player
escoria.game_scene.close_inventory()
state_machine.states_map["choices"].initialize(dialog_player, self, dialog, type) state_machine.states_map["choices"].initialize(dialog_player, self, dialog, type)
state_machine._change_state("choices") state_machine._change_state("choices")
func do_choose(dialog_player: Node, dialog: ESCDialog, type: String = "simple"): func do_choose(dialog_player: Node, dialog: ESCDialog, type: String = "simple"):
escoria.game_scene.hide_tooltips()
var chooser var chooser
if type == "simple" or type == "": if type == "simple" or type == "":
@@ -178,11 +183,14 @@ func do_choose(dialog_player: Node, dialog: ESCDialog, type: String = "simple"):
var option = await chooser.option_chosen var option = await chooser.option_chosen
dialog_player.remove_child(chooser) dialog_player.remove_child(chooser)
# MODIFIED FOR RETURN TO MONKEY UI # MODIFIED FOR RETURN TO MONKEY UI
if option is ESCDialogOption: if option is ESCDialogOption:
escoria.globals_manager.set_global("ESC_DIALOG_CHOSEN_OPTION", option.option) escoria.globals_manager.set_global("ESC_DIALOG_CHOSEN_OPTION", option.option)
# END MODIFIED FOR RETURN TO MONKEY UI # END MODIFIED FOR RETURN TO MONKEY UI
option_chosen.emit(option) option_chosen.emit(option)
escoria.game_scene.hide_tooltips()
# Trigger running the dialogue faster # Trigger running the dialogue faster
func speedup(): func speedup():

View File

@@ -1,6 +1,4 @@
[gd_resource type="Theme" load_steps=5 format=3 uid="uid://dlo07cyfhpilq"] [gd_resource type="Theme" load_steps=4 format=3 uid="uid://dlo07cyfhpilq"]
[ext_resource type="FontFile" uid="uid://dfs4e42nd215" path="res://addons/escoria-ui-return-monkey-island/fonts/determination.ttf" id="1_yc5i3"]
[sub_resource type="StyleBoxFlat" id="1"] [sub_resource type="StyleBoxFlat" id="1"]
content_margin_left = 4.0 content_margin_left = 4.0
@@ -36,9 +34,9 @@ Label/colors/font_color = Color(1, 1, 1, 1)
Label/colors/font_color_shadow = Color(0, 0, 0, 0) Label/colors/font_color_shadow = Color(0, 0, 0, 0)
Label/colors/font_outline_modulate = Color(1, 0, 0, 1) Label/colors/font_outline_modulate = Color(1, 0, 0, 1)
Label/colors/label_box_bg = Color(0, 0, 0, 0.745098) Label/colors/label_box_bg = Color(0, 0, 0, 0.745098)
Label/fonts/font = ExtResource("1_yc5i3") Label/fonts/font = null
Label/styles/normal = SubResource("1") Label/styles/normal = SubResource("1")
RichTextLabel/font_sizes/font_size = 20 RichTextLabel/font_sizes/font_size = 20
RichTextLabel/fonts/normal_font = ExtResource("1_yc5i3") RichTextLabel/fonts/normal_font = null
RichTextLabel/styles/focus = SubResource("2") RichTextLabel/styles/focus = SubResource("2")
RichTextLabel/styles/normal = SubResource("3") RichTextLabel/styles/normal = SubResource("3")

View File

@@ -121,6 +121,7 @@ func say(character: String, line: String) :
_current_line = line _current_line = line
show() show()
say_visible.emit()
_is_speeding_up = false _is_speeding_up = false
@@ -215,8 +216,6 @@ func _on_dialog_line_typed(object, key):
$Timer.start(time_to_disappear) $Timer.start(time_to_disappear)
$Timer.timeout.connect(_on_dialog_finished) $Timer.timeout.connect(_on_dialog_finished)
say_visible.emit()
func _calculate_time_to_disappear() -> float: func _calculate_time_to_disappear() -> float:
return (_get_number_of_words() / _reading_speed_in_wpm as float) * 60 return (_get_number_of_words() / _reading_speed_in_wpm as float) * 60

View File

@@ -1,11 +0,0 @@
[gd_resource type="FontFile" load_steps=2 format=3 uid="uid://cne31d6e0513y"]
[ext_resource type="FontFile" uid="uid://dbuthr0652qv7" path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.ttf" id="1"]
[resource]
fallbacks = Array[Font]([ExtResource("1")])
cache/0/16/0/ascent = 0.0
cache/0/16/0/descent = 0.0
cache/0/16/0/underline_position = 0.0
cache/0/16/0/underline_thickness = 0.0
cache/0/16/0/scale = 1.0

View File

@@ -1,36 +1,13 @@
extends ESCInventory extends ESCInventory
# Whether the inventory is visible currently
var inventory_visible: bool = false
func _ready() -> void:
super._ready()
#$FloatingInventory/panel.position.x = ProjectSettings.get_setting("display/window/size/viewport_width") - $FloatingInventory/panel.size.x
func show_inventory():
#$FloatingInventory/panel.show()
self.show()
inventory_visible = true
func hide_inventory():
#$FloatingInventory/panel.hide()
self.hide()
inventory_visible = false
func show_ui(): func show_ui():
#$FloatingInventory/inventory_bg.show()
#$FloatingInventory/panel/MarginContainer/ScrollContainer/container.show()
self.show() self.show()
inventory_visible = true
func hide_ui(): func hide_ui():
self.hide() self.hide()
#$FloatingInventory/inventory_bg.hide()
#$FloatingInventory/panel/MarginContainer/ScrollContainer/container.hide() func show_inventory():
inventory_visible = false show_ui()
func hide_inventory():
hide_ui()

View File

@@ -1,13 +1,12 @@
extends Node @abstract class_name ESCItemComponent extends Node
class_name ESCItemComponent
var _custom_data: Dictionary var _custom_data: Dictionary
func get_global_id(): @abstract
return self.get_parent().global_id func get_component_type() -> String
func get_component_type(): func register(custom_data: Dictionary) -> void:
pass pass
func register(custom_data: Dictionary): func get_global_id() -> String:
pass return self.get_parent().global_id

View File

@@ -1,6 +1,4 @@
[gd_resource type="Theme" load_steps=12 format=3 uid="uid://djtwqnfbbt5t8"] [gd_resource type="Theme" load_steps=11 format=3 uid="uid://djtwqnfbbt5t8"]
[ext_resource type="FontFile" uid="uid://dfs4e42nd215" path="res://addons/escoria-ui-return-monkey-island/fonts/determination.ttf" id="1_p03cv"]
[sub_resource type="StyleBoxFlat" id="1"] [sub_resource type="StyleBoxFlat" id="1"]
bg_color = Color(0.14902, 0.14902, 0.14902, 0.784314) bg_color = Color(0.14902, 0.14902, 0.14902, 0.784314)
@@ -36,7 +34,6 @@ bg_color = Color(0.219501, 0.219501, 0.219501, 1)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_p03cv"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_p03cv"]
[resource] [resource]
Button/fonts/font = ExtResource("1_p03cv")
Button/styles/disabled = null Button/styles/disabled = null
Button/styles/focus = SubResource("1") Button/styles/focus = SubResource("1")
Button/styles/hover = SubResource("2") Button/styles/hover = SubResource("2")
@@ -47,7 +44,6 @@ CheckButton/styles/hover = SubResource("StyleBoxEmpty_gwd03")
CheckButton/styles/hover_pressed = SubResource("StyleBoxEmpty_6jmhn") CheckButton/styles/hover_pressed = SubResource("StyleBoxEmpty_6jmhn")
CheckButton/styles/normal = SubResource("StyleBoxEmpty_ktabe") CheckButton/styles/normal = SubResource("StyleBoxEmpty_ktabe")
CheckButton/styles/pressed = SubResource("StyleBoxEmpty_4rhik") CheckButton/styles/pressed = SubResource("StyleBoxEmpty_4rhik")
Label/fonts/font = ExtResource("1_p03cv")
MarginContainer/constants/margin_bottom = 5 MarginContainer/constants/margin_bottom = 5
MarginContainer/constants/margin_left = 5 MarginContainer/constants/margin_left = 5
MarginContainer/constants/margin_right = 5 MarginContainer/constants/margin_right = 5

View File

@@ -1,6 +1,4 @@
[gd_resource type="Theme" load_steps=7 format=3 uid="uid://bf2eet52fueam"] [gd_resource type="Theme" load_steps=6 format=3 uid="uid://bf2eet52fueam"]
[ext_resource type="FontFile" uid="uid://dfs4e42nd215" path="res://addons/escoria-ui-return-monkey-island/fonts/determination.ttf" id="1_6h504"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6h504"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6h504"]
@@ -35,20 +33,16 @@ expand_margin_right = 5.0
expand_margin_bottom = 5.0 expand_margin_bottom = 5.0
[resource] [resource]
Button/fonts/font = ExtResource("1_6h504")
Button/styles/hover = SubResource("StyleBoxFlat_6h504") Button/styles/hover = SubResource("StyleBoxFlat_6h504")
Label/colors/font_color = Color(1, 1, 1, 1) Label/colors/font_color = Color(1, 1, 1, 1)
Label/colors/font_color_shadow = Color(0, 0, 0, 0) Label/colors/font_color_shadow = Color(0, 0, 0, 0)
Label/colors/font_outline_modulate = Color(1, 0, 0, 1) Label/colors/font_outline_modulate = Color(1, 0, 0, 1)
Label/colors/label_box_bg = Color(0, 0, 0, 0.745098) Label/colors/label_box_bg = Color(0, 0, 0, 0.745098)
Label/fonts/font = ExtResource("1_6h504")
Label/styles/normal = SubResource("1") Label/styles/normal = SubResource("1")
MarginContainer/constants/margin_bottom = 5 MarginContainer/constants/margin_bottom = 5
MarginContainer/constants/margin_left = 5 MarginContainer/constants/margin_left = 5
MarginContainer/constants/margin_right = 5 MarginContainer/constants/margin_right = 5
MarginContainer/constants/margin_top = 5 MarginContainer/constants/margin_top = 5
PanelContainer/styles/panel = SubResource("StyleBoxEmpty_6h504") PanelContainer/styles/panel = SubResource("StyleBoxEmpty_6h504")
RichTextLabel/fonts/mono_font = ExtResource("1_6h504")
RichTextLabel/fonts/normal_font = ExtResource("1_6h504")
RichTextLabel/styles/focus = SubResource("2") RichTextLabel/styles/focus = SubResource("2")
RichTextLabel/styles/normal = SubResource("3") RichTextLabel/styles/normal = SubResource("3")