diff --git a/game/ui/bags/InventoryGUI.gd b/game/ui/bags/InventoryGUI.gd index 17c67665..cd0ab234 100644 --- a/game/ui/bags/InventoryGUI.gd +++ b/game/ui/bags/InventoryGUI.gd @@ -124,3 +124,10 @@ func item_swapped(bag: Bag, item1_slot : int, item2_slot: int) -> void: func on_visibility_changed() -> void: refresh_bags() + + +func _on_BagButton_toggled(button_pressed): + if button_pressed: + show() + else: + hide() diff --git a/game/ui/buttons/Buttons.gd b/game/ui/buttons/Buttons.gd index a1923c99..6953681a 100644 --- a/game/ui/buttons/Buttons.gd +++ b/game/ui/buttons/Buttons.gd @@ -31,22 +31,12 @@ var lock_button var player func _ready(): - spell_book = get_node(spell_book_path) - spell_book_button = get_node(spell_book_button_path) - - spell_book_button.connect("pressed", self, "_spell_book_click") - lock_button = get_node(lock_button_path) lock_button.connect("pressed", self, "_lock_button_click") func set_player(p_player): player = p_player -func _spell_book_click(): - if spell_book.visible: - spell_book.hide() - else: - spell_book.show() func _lock_button_click(): if player == null: diff --git a/game/ui/player_ui/player_ui.tscn b/game/ui/player_ui/player_ui.tscn index 60391ff6..00458d4f 100644 --- a/game/ui/player_ui/player_ui.tscn +++ b/game/ui/player_ui/player_ui.tscn @@ -425,8 +425,8 @@ mouse_filter = 2 [node name="IngameMenu" parent="GUI" instance=ExtResource( 2 )] visible = false -[connection signal="pressed" from="GUI/Buttons/HBoxContainer/BagButton" to="GUI/Windows/Inventory" method="show"] -[connection signal="pressed" from="GUI/Buttons/HBoxContainer/TalentButton" to="GUI/Windows/TalentWindow" method="show"] -[connection signal="pressed" from="GUI/Buttons/HBoxContainer/CraftingButton" to="GUI/Windows/CraftingWindow" method="show"] -[connection signal="pressed" from="GUI/Buttons/HBoxContainer/MapButton" to="GUI/Windows/Map" method="show"] +[connection signal="toggled" from="GUI/Buttons/HBoxContainer/SpellBookButton" to="GUI/Windows/SpellBookWindow" method="_on_SpellBookButton_toggled"] +[connection signal="toggled" from="GUI/Buttons/HBoxContainer/BagButton" to="GUI/Windows/Inventory" method="_on_BagButton_toggled"] +[connection signal="toggled" from="GUI/Buttons/HBoxContainer/TalentButton" to="GUI/Windows/TalentWindow" method="_on_TalentButton_toggled"] +[connection signal="toggled" from="GUI/Buttons/HBoxContainer/CraftingButton" to="GUI/Windows/CraftingWindow" method="_on_CraftingButton_toggled"] [connection signal="pressed" from="GUI/Buttons/HBoxContainer/Menu" to="GUI/IngameMenu" method="show"] diff --git a/game/ui/windows/CraftingWindow.gd b/game/ui/windows/CraftingWindow.gd index 5da9a6a0..aad3845d 100644 --- a/game/ui/windows/CraftingWindow.gd +++ b/game/ui/windows/CraftingWindow.gd @@ -138,3 +138,10 @@ func select_recipe(recipe : CraftRecipe) -> void: _materials_container.add_child(ie) ie.owner = _materials_container ie.set_item(_player, ih) + + +func _on_CraftingButton_toggled(button_pressed): + if button_pressed: + show() + else: + hide() diff --git a/game/ui/windows/SpellBookWindow.gd b/game/ui/windows/SpellBookWindow.gd index 2a275b01..7404c805 100644 --- a/game/ui/windows/SpellBookWindow.gd +++ b/game/ui/windows/SpellBookWindow.gd @@ -187,3 +187,10 @@ class CustomSpellSorter: return true + + +func _on_SpellBookButton_toggled(button_pressed): + if button_pressed: + show() + else: + hide() diff --git a/game/ui/windows/TalentWindow.gd b/game/ui/windows/TalentWindow.gd index 13f3f603..9b09c993 100644 --- a/game/ui/windows/TalentWindow.gd +++ b/game/ui/windows/TalentWindow.gd @@ -96,3 +96,10 @@ func centity_data_changed(data: EntityData) -> void: s.set_spec(_player, spec, i) + + +func _on_TalentButton_toggled(button_pressed): + if button_pressed: + show() + else: + hide()