diff --git a/addons/escoria-ui-return-monkey-island/game.gd b/addons/escoria-ui-return-monkey-island/game.gd index dd8c527a..1c8fd567 100644 --- a/addons/escoria-ui-return-monkey-island/game.gd +++ b/addons/escoria-ui-return-monkey-island/game.gd @@ -376,19 +376,16 @@ func close_inventory(): pass func hide_ui(): - #inventory_ui.hide_ui() - #inventory_ui.hide() - #$game_layer.hide() - $game_layer.visible = false - #$dialog_layer.hide() + $game_layer/ui_layer.hide() + $game_layer/dialog_layer.hide() + $game_layer/tooltip_layer.hide() func show_ui(): if escoria.room_manager.GLOBAL_CURRENT_SCENE != "turno_cocina_creditos": - #inventory_ui.show() - #inventory_ui.show_ui() - #$ui_layer/game_ui.show() - #$dialog_layer.show() - $game_layer.show() + $game_layer/ui_layer.show() + $game_layer/dialog_layer.show() + $game_layer/tooltip_layer.show() + func hide_main_menu(): diff --git a/addons/escoria-ui-return-monkey-island/game.tscn b/addons/escoria-ui-return-monkey-island/game.tscn index 4c6c4cbe..efd9727d 100644 --- a/addons/escoria-ui-return-monkey-island/game.tscn +++ b/addons/escoria-ui-return-monkey-island/game.tscn @@ -97,16 +97,14 @@ texture_hover = ExtResource("14_parhr") [node name="Inventory" parent="game_layer/ui_layer" instance=ExtResource("1")] anchors_preset = 7 -anchor_left = 0.5 anchor_top = 1.0 -anchor_right = 0.5 anchor_bottom = 1.0 offset_left = -640.0 -offset_top = -120.0 +offset_top = -166.0 offset_right = 640.0 offset_bottom = 0.0 -grow_horizontal = 2 grow_vertical = 0 +pivot_offset = Vector2(845, 116) [node name="menu_layer" type="CanvasLayer" parent="."] layer = 2 diff --git a/addons/escoria-ui-return-monkey-island/inventory/esc_inventory_button.gd b/addons/escoria-ui-return-monkey-island/inventory/esc_inventory_button.gd deleted file mode 100644 index 884d988d..00000000 --- a/addons/escoria-ui-return-monkey-island/inventory/esc_inventory_button.gd +++ /dev/null @@ -1,5 +0,0 @@ -# The inventory representation of an ESC item if pickable (only used by -# the inventory components) -extends ESCInventoryButton -class_name RTMIInventoryButton - diff --git a/addons/escoria-ui-return-monkey-island/inventory/inventory_container.gd b/addons/escoria-ui-return-monkey-island/inventory/inventory_container.gd index 7b47c4f2..195f3bb4 100644 --- a/addons/escoria-ui-return-monkey-island/inventory/inventory_container.gd +++ b/addons/escoria-ui-return-monkey-island/inventory/inventory_container.gd @@ -3,3 +3,15 @@ extends ESCInventoryContainer class_name RTMIInventoryContainer +# Add a new item into the container and return the control generated for it +# so its events can be handled by the inputs manager +# +# #### Parameters +# - inventory_item: Item to add +# **Returns** The button generated for the item +func add_item(inventory_item: ESCInventoryItem) -> ESCInventoryButton: + var button = RTMIInventoryButton.new(inventory_item) + button.inventory_item_focused.connect(_on_inventory_item_focused) + button.inventory_item_unfocused.connect(_on_inventory_item_unfocused) + add_child(button) + return button diff --git a/addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn b/addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn index ac6f54d8..75aed6a0 100644 --- a/addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn +++ b/addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn @@ -2,22 +2,37 @@ [ext_resource type="Script" uid="uid://1hedqas3odoy" path="res://addons/escoria-ui-return-monkey-island/inventory/inventory_ui.gd" id="1"] [ext_resource type="Theme" uid="uid://23n73qci0qc3" path="res://addons/escoria-ui-return-monkey-island/theme/inventory_ui.tres" id="1_a1nc4"] -[ext_resource type="Script" uid="uid://c4syt26p7mg66" path="res://addons/escoria-core/ui_library/inventory/esc_inventory_container.gd" id="3"] +[ext_resource type="Script" uid="uid://245b34c8nyex" path="res://addons/escoria-ui-return-monkey-island/inventory/inventory_container.gd" id="3_a1nc4"] [node name="Inventory" type="PanelContainer"] -offset_right = 1280.0 -offset_bottom = 120.0 +custom_minimum_size = Vector2(1280, 160) +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -1265.0 +offset_top = -360.0 +offset_right = 15.0 +offset_bottom = -194.0 +grow_horizontal = 2 +grow_vertical = 2 +pivot_offset = Vector2(1726, 214) +size_flags_horizontal = 4 theme = ExtResource("1_a1nc4") script = ExtResource("1") inventory_ui_container = NodePath("MarginContainer/ScrollContainer/container") [node name="MarginContainer" type="MarginContainer" parent="."] layout_mode = 2 +size_flags_vertical = 4 [node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"] +clip_contents = false layout_mode = 2 +size_flags_vertical = 4 vertical_scroll_mode = 0 [node name="container" type="HBoxContainer" parent="MarginContainer/ScrollContainer"] layout_mode = 2 -script = ExtResource("3") +script = ExtResource("3_a1nc4") diff --git a/addons/escoria-ui-return-monkey-island/inventory/rtmi_inventory_button.gd b/addons/escoria-ui-return-monkey-island/inventory/rtmi_inventory_button.gd new file mode 100644 index 00000000..9f61ba7f --- /dev/null +++ b/addons/escoria-ui-return-monkey-island/inventory/rtmi_inventory_button.gd @@ -0,0 +1,41 @@ +# The inventory representation of an ESC item if pickable (only used by +# the inventory components) +extends ESCInventoryButton +class_name RTMIInventoryButton + +const RESIZE_RATIO: float = 0.9 + + +var shaderMaterial = preload("res://addons/escoria-ui-return-monkey-island/shaders/shadermaterial_outline_green5px.tres") + +func _init(p_item: ESCInventoryItem) -> void: + super(p_item) + var image_normal = texture_normal.get_image() + image_normal.resize(image_normal.get_width() * RESIZE_RATIO, image_normal.get_height() * RESIZE_RATIO) + + var image_hover = texture_hover.get_image() + image_hover.resize(image_hover.get_width() * RESIZE_RATIO, image_hover.get_height() * RESIZE_RATIO) + + +func _enter_tree(): + #var twee + pivot_offset = size / 2 + scale = Vector2(0.5,0.5) + modulate = Color(1, 1, 1, 0.5) + + var tween: Tween = create_tween().set_loops(1) + #tween.tween_property(self,"scale",Vector2(0.9,0.9),0.1).set_trans(Tween.TRANS_SINE) + tween.tween_property(self,"scale",Vector2.ONE,0.2).set_trans(Tween.TRANS_SPRING).from(Vector2(0.9,0.9)) + tween.parallel().tween_property(self, "modulate:a",1.0,0.3).set_trans(Tween.TRANS_SINE) + + pass + +# Handle mouse entering the item and send the respecitve signal +func _on_inventory_item_mouse_enter(): + super._on_inventory_item_mouse_enter() + self.material = shaderMaterial + +# Handle mouse leaving the item and send the respecitve signal +func _on_inventory_item_mouse_exit(): + super._on_inventory_item_mouse_exit() + self.material = null diff --git a/addons/escoria-ui-return-monkey-island/inventory/rtmi_inventory_button.gd.uid b/addons/escoria-ui-return-monkey-island/inventory/rtmi_inventory_button.gd.uid new file mode 100644 index 00000000..45d24b79 --- /dev/null +++ b/addons/escoria-ui-return-monkey-island/inventory/rtmi_inventory_button.gd.uid @@ -0,0 +1 @@ +uid://dt4yojwyhfrov diff --git a/addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.tscn b/addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.tscn index a75e98d4..63dbdda7 100644 --- a/addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.tscn +++ b/addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.tscn @@ -18,24 +18,29 @@ grow_vertical = 2 theme = ExtResource("1_6gi1c") script = ExtResource("1") +[node name="Panel" type="Panel" parent="."] +layout_mode = 0 +anchor_right = 1.0 +anchor_bottom = 1.0 + [node name="load_game" parent="." instance=ExtResource("5")] visible = false layout_mode = 1 [node name="options" parent="." instance=ExtResource("4")] -visible = false -anchors_preset = 0 +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 [node name="main" type="Control" parent="."] +visible = false anchors_preset = 0 anchor_right = 1.0 anchor_bottom = 1.0 -[node name="Panel" type="Panel" parent="main"] -layout_mode = 0 -anchor_right = 1.0 -anchor_bottom = 1.0 - [node name="main" type="VBoxContainer" parent="main"] layout_mode = 0 anchor_left = 0.5 diff --git a/addons/escoria-ui-return-monkey-island/menus/options/options.gd b/addons/escoria-ui-return-monkey-island/menus/options/options.gd index 57b98bc3..5e1d8dfa 100644 --- a/addons/escoria-ui-return-monkey-island/menus/options/options.gd +++ b/addons/escoria-ui-return-monkey-island/menus/options/options.gd @@ -21,29 +21,6 @@ var _loaded_languages: Array = [] # The settings changed @onready var changed = false - -# Initialize the flags -func _ready() -> void: - var _flags_container: HBoxContainer = \ - $VBoxContainer/MarginContainer/options/flags - for child in _flags_container.get_children(): - _flags_container.remove_child(child) - child.queue_free() - - _loaded_languages = [] - - for lang in TranslationServer.get_loaded_locales(): - if not lang in _loaded_languages: - _loaded_languages.append(lang) - var _lang = TextureRect.new() - _lang.texture = load( - "res://addons/escoria-core/ui_library" + \ - "/menus/options/flags/%s.png" % lang - ) - _flags_container.add_child(_lang) - _lang.connect("gui_input", Callable(self, "_on_language_input").bind(lang)) - - # Show the options func show(): backup_settings = escoria.settings_manager.get_settings() @@ -61,9 +38,9 @@ func initialize_options(p_settings): _options.get_node("sound_volume").value = p_settings["sfx_volume"] _options.get_node("music_volume").value = p_settings["music_volume"] _options.get_node("speech_volume").value = p_settings["speech_volume"] - _options.get_node("speech_speed").value = p_settings["custom_settings"][SPEECH_SPEED_SETTING] _options.get_node("fullscreen").set_pressed_no_signal(p_settings["fullscreen"]) + #_options.get_node("click_to_continue").set_pressed_no_signal(p_settings["click_to_continue"]) # The language was changed @@ -149,13 +126,13 @@ func _on_speech_volume_value_changed(value: float) -> void: # # #### Parameters # - button_pressed: Fullscreen (true) or windowed (false) -func _on_fullscreen_toggled(button_pressed: bool) -> void: +func _on_fullscreen_toggled(toggle_pressed: bool) -> void: if ESCProjectSettingsManager.get_setting( ESCProjectSettingsManager.FULLSCREEN - ) != button_pressed: + ) != toggle_pressed: ESCProjectSettingsManager.set_setting( ESCProjectSettingsManager.FULLSCREEN, - button_pressed + toggle_pressed ) escoria.settings_manager.apply_settings() changed = true @@ -178,13 +155,13 @@ func _on_back_pressed(): emit_signal("back_button_pressed") -func _on_speech_speed_value_changed(value): - if ProjectSettings.get_setting( - RTMISimpleDialogSettings.READING_SPEED_IN_WPM - ) != value: - ProjectSettings.set_setting( - RTMISimpleDialogSettings.READING_SPEED_IN_WPM, - value +func _on_click_to_continue_toggled(toggle_pressed: bool) -> void: + if ESCProjectSettingsManager.get_setting( + RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY + ) != toggle_pressed: + ESCProjectSettingsManager.set_setting( + RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY, + toggle_pressed ) escoria.settings_manager.apply_settings() changed = true diff --git a/addons/escoria-ui-return-monkey-island/menus/options/options.tscn b/addons/escoria-ui-return-monkey-island/menus/options/options.tscn index 43d000dd..04da281c 100644 --- a/addons/escoria-ui-return-monkey-island/menus/options/options.tscn +++ b/addons/escoria-ui-return-monkey-island/menus/options/options.tscn @@ -1,6 +1,5 @@ -[gd_scene load_steps=4 format=3 uid="uid://csxvnrljbqkr8"] +[gd_scene load_steps=3 format=3 uid="uid://csxvnrljbqkr8"] -[ext_resource type="Texture2D" uid="uid://yckfhmbqy4gy" path="res://addons/escoria-ui-return-monkey-island/menus/options/flags/de.png" id="1"] [ext_resource type="Theme" uid="uid://djtwqnfbbt5t8" path="res://addons/escoria-ui-return-monkey-island/theme/menu.tres" id="1_h0rhj"] [ext_resource type="Script" uid="uid://bjl2eag8hh30h" path="res://addons/escoria-ui-return-monkey-island/menus/options/options.gd" id="4"] @@ -9,6 +8,8 @@ layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 theme = ExtResource("1_h0rhj") script = ExtResource("4") @@ -16,11 +17,21 @@ script = ExtResource("4") layout_mode = 0 anchor_right = 1.0 anchor_bottom = 1.0 +theme = ExtResource("1_h0rhj") [node name="VBoxContainer" type="VBoxContainer" parent="."] -layout_mode = 0 -anchor_right = 1.0 -anchor_bottom = 1.0 +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -170.0 +offset_top = -120.0 +offset_right = 170.0 +offset_bottom = 120.0 +grow_horizontal = 2 +grow_vertical = 2 alignment = 1 [node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"] @@ -32,29 +43,12 @@ theme_override_constants/margin_right = 20 theme_override_constants/margin_bottom = 20 [node name="options" type="GridContainer" parent="VBoxContainer/MarginContainer"] +custom_minimum_size = Vector2(300, 0) layout_mode = 2 size_flags_vertical = 6 theme_override_constants/h_separation = 40 columns = 2 -[node name="label" type="Label" parent="VBoxContainer/MarginContainer/options"] -layout_mode = 2 -text = "OPTIONS_LANGUAGE" - -[node name="flags" type="HBoxContainer" parent="VBoxContainer/MarginContainer/options"] -layout_mode = 2 -size_flags_vertical = 3 -theme_override_constants/separation = 30 -alignment = 1 - -[node name="TextureRect2" type="TextureRect" parent="VBoxContainer/MarginContainer/options/flags"] -layout_mode = 2 -texture = ExtResource("1") - -[node name="TextureRect3" type="TextureRect" parent="VBoxContainer/MarginContainer/options/flags"] -layout_mode = 2 -texture = ExtResource("1") - [node name="label2" type="Label" parent="VBoxContainer/MarginContainer/options"] layout_mode = 2 text = "GENERAL_VOLUME" @@ -99,31 +93,28 @@ step = 0.001 layout_mode = 2 text = "FULLSCREEN" -[node name="fullscreen" type="CheckBox" parent="VBoxContainer/MarginContainer/options"] +[node name="fullscreen" type="CheckButton" parent="VBoxContainer/MarginContainer/options"] layout_mode = 2 -[node name="label7" type="Label" parent="VBoxContainer/MarginContainer/options"] +[node name="Label" type="Label" parent="VBoxContainer/MarginContainer/options"] layout_mode = 2 -text = "SPEECH_SPEED" +text = "CLICK_TO_CONTINUE" -[node name="speech_speed" type="HSlider" parent="VBoxContainer/MarginContainer/options"] +[node name="click_to_continue" type="CheckButton" parent="VBoxContainer/MarginContainer/options"] layout_mode = 2 -size_flags_horizontal = 3 -min_value = 10.0 -max_value = 400.0 -step = 10.0 -value = 200.0 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 -theme_override_constants/separation = 20 +theme_override_constants/separation = 36 alignment = 1 [node name="back" type="Button" parent="VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(150, 40) layout_mode = 2 text = "OPTIONS_BACK" [node name="apply" type="Button" parent="VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(150, 40) layout_mode = 2 text = "APPLY" @@ -132,6 +123,6 @@ text = "APPLY" [connection signal="value_changed" from="VBoxContainer/MarginContainer/options/music_volume" to="." method="_on_music_volume_changed"] [connection signal="value_changed" from="VBoxContainer/MarginContainer/options/speech_volume" to="." method="_on_speech_volume_value_changed"] [connection signal="toggled" from="VBoxContainer/MarginContainer/options/fullscreen" to="." method="_on_fullscreen_toggled"] -[connection signal="value_changed" from="VBoxContainer/MarginContainer/options/speech_speed" to="." method="_on_speech_speed_value_changed"] +[connection signal="toggled" from="VBoxContainer/MarginContainer/options/click_to_continue" to="." method="_on_click_to_continue_toggled"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/back" to="." method="_on_back_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/apply" to="." method="_on_apply_pressed"] diff --git a/addons/escoria-ui-return-monkey-island/shaders/shadermaterial_outline_green5px.tres b/addons/escoria-ui-return-monkey-island/shaders/shadermaterial_outline_green5px.tres index 990819cb..32d4fbd5 100644 --- a/addons/escoria-ui-return-monkey-island/shaders/shadermaterial_outline_green5px.tres +++ b/addons/escoria-ui-return-monkey-island/shaders/shadermaterial_outline_green5px.tres @@ -4,8 +4,8 @@ [resource] shader = ExtResource("1_2bktm") -shader_parameter/color = Color(0, 1, 0, 1) -shader_parameter/width = 5.0 +shader_parameter/color = Color(1, 1, 1, 1) +shader_parameter/width = 2.0 shader_parameter/pattern = 0 shader_parameter/inside = false shader_parameter/add_margins = true diff --git a/addons/escoria-ui-return-monkey-island/theme/inventory_ui.tres b/addons/escoria-ui-return-monkey-island/theme/inventory_ui.tres index 91d59002..f4212f51 100644 --- a/addons/escoria-ui-return-monkey-island/theme/inventory_ui.tres +++ b/addons/escoria-ui-return-monkey-island/theme/inventory_ui.tres @@ -4,8 +4,8 @@ bg_color = Color(0.173269, 0.0886366, 0, 1) [resource] -MarginContainer/constants/margin_bottom = 15 -MarginContainer/constants/margin_left = 15 -MarginContainer/constants/margin_right = 15 -MarginContainer/constants/margin_top = 15 +MarginContainer/constants/margin_bottom = 8 +MarginContainer/constants/margin_left = 16 +MarginContainer/constants/margin_right = 16 +MarginContainer/constants/margin_top = 8 PanelContainer/styles/panel = SubResource("StyleBoxFlat_3hnbv") diff --git a/addons/escoria-ui-return-monkey-island/theme/menu.tres b/addons/escoria-ui-return-monkey-island/theme/menu.tres index b54e4198..1714a144 100644 --- a/addons/escoria-ui-return-monkey-island/theme/menu.tres +++ b/addons/escoria-ui-return-monkey-island/theme/menu.tres @@ -1,9 +1,14 @@ -[gd_resource type="Theme" load_steps=7 format=3 uid="uid://djtwqnfbbt5t8"] +[gd_resource type="Theme" load_steps=12 format=3 uid="uid://djtwqnfbbt5t8"] [ext_resource type="FontFile" uid="uid://vqqxktsw0f34" path="res://addons/escoria-ui-return-monkey-island/fonts/determination.ttf" id="1_p03cv"] [sub_resource type="StyleBoxFlat" id="1"] bg_color = Color(0.14902, 0.14902, 0.14902, 0.784314) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 +expand_margin_bottom = 5.0 [sub_resource type="StyleBoxFlat" id="2"] bg_color = Color(0.285156, 0.285156, 0.285156, 0.784314) @@ -15,6 +20,16 @@ expand_margin_top = 2.0 expand_margin_right = 2.0 expand_margin_bottom = 2.0 +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3bqa2"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_gwd03"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6jmhn"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ktabe"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4rhik"] + [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_p03cv"] bg_color = Color(0.219501, 0.219501, 0.219501, 1) @@ -22,10 +37,17 @@ bg_color = Color(0.219501, 0.219501, 0.219501, 1) [resource] Button/fonts/font = ExtResource("1_p03cv") +Button/styles/disabled = null Button/styles/focus = SubResource("1") Button/styles/hover = SubResource("2") Button/styles/normal = SubResource("1") Button/styles/pressed = SubResource("3") +CheckButton/styles/focus = SubResource("StyleBoxEmpty_3bqa2") +CheckButton/styles/hover = SubResource("StyleBoxEmpty_gwd03") +CheckButton/styles/hover_pressed = SubResource("StyleBoxEmpty_6jmhn") +CheckButton/styles/normal = SubResource("StyleBoxEmpty_ktabe") +CheckButton/styles/pressed = SubResource("StyleBoxEmpty_4rhik") +Label/fonts/font = ExtResource("1_p03cv") MarginContainer/constants/margin_bottom = 5 MarginContainer/constants/margin_left = 5 MarginContainer/constants/margin_right = 5