Now the windows are properly togglable.

This commit is contained in:
Relintai 2020-02-27 12:27:55 +01:00
parent 67d412abfb
commit f4da6f0dd4
6 changed files with 32 additions and 14 deletions

View File

@ -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()

View File

@ -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:

View File

@ -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"]

View File

@ -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()

View File

@ -187,3 +187,10 @@ class CustomSpellSorter:
return true
func _on_SpellBookButton_toggled(button_pressed):
if button_pressed:
show()
else:
hide()

View File

@ -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()