diff --git a/game/scripts/game_modules/ui_window_module.gd b/game/scripts/game_modules/ui_window_module.gd index 8ef218ea..7272dadf 100644 --- a/game/scripts/game_modules/ui_window_module.gd +++ b/game/scripts/game_modules/ui_window_module.gd @@ -1,19 +1,22 @@ extends GameModule class_name UIWindowModule -export(PackedScene) var character_scene : PackedScene +export(PackedScene) var scene : PackedScene export(Texture) var opener_button_texture : Texture export(int) var index : int = -1 +export(bool) var add_button : bool = true func on_request_instance(what : int, node : Node) -> void: if what == DataManager.PLAYER_UI_INSTANCE: - var sc = character_scene.instance() + var sc = scene.instance() node.windows.add_child(sc) - var b = node.buttons.add_image_button(opener_button_texture, 0) - b.connect("toggled", sc, "_on_button_toggled") - sc.opener_button = b + if add_button: + var b = node.buttons.add_image_button(opener_button_texture, 0) + + b.connect("toggled", sc, "_on_button_toggled") + sc.opener_button = b sc.hide() diff --git a/game/ui/bags/game_module.tres b/game/ui/bags/game_module.tres index 3a53c326..3c5777c3 100644 --- a/game/ui/bags/game_module.tres +++ b/game/ui/bags/game_module.tres @@ -7,6 +7,7 @@ [resource] script = ExtResource( 2 ) enabled = true -character_scene = ExtResource( 3 ) +scene = ExtResource( 3 ) opener_button_texture = ExtResource( 1 ) index = 3 +add_button = true diff --git a/game/ui/character/game_module.tres b/game/ui/character/game_module.tres index cd07dad8..3efffa83 100644 --- a/game/ui/character/game_module.tres +++ b/game/ui/character/game_module.tres @@ -7,6 +7,7 @@ [resource] script = ExtResource( 1 ) enabled = true -character_scene = ExtResource( 2 ) +scene = ExtResource( 2 ) opener_button_texture = ExtResource( 3 ) index = 0 +add_button = true diff --git a/game/ui/crafting/game_module.tres b/game/ui/crafting/game_module.tres index d1f3b6e5..71af8a5e 100644 --- a/game/ui/crafting/game_module.tres +++ b/game/ui/crafting/game_module.tres @@ -7,6 +7,7 @@ [resource] script = ExtResource( 2 ) enabled = true -character_scene = ExtResource( 3 ) +scene = ExtResource( 3 ) opener_button_texture = ExtResource( 1 ) index = 4 +add_button = true diff --git a/game/ui/loot_window/LootWindow.gd b/game/ui/loot_window/LootWindow.gd index 56f9ebeb..7f525c2f 100644 --- a/game/ui/loot_window/LootWindow.gd +++ b/game/ui/loot_window/LootWindow.gd @@ -29,6 +29,8 @@ var player : Entity var target_bag : Bag func _ready(): + get_node("../../../").loot_window = self + container = get_node(container_path) connect("visibility_changed", self, "on_visibility_changed") diff --git a/game/ui/loot_window/LootWindow.tscn b/game/ui/loot_window/LootWindow.tscn index 980f7002..18807e4a 100644 --- a/game/ui/loot_window/LootWindow.tscn +++ b/game/ui/loot_window/LootWindow.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=2] [ext_resource path="res://ui/loot_window/LootEntry.tscn" type="PackedScene" id=3] -[node name="LootWindow" type="PanelContainer"] +[node name="LootWindow" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 mouse_filter = 2 @@ -14,37 +14,43 @@ __meta__ = { "_edit_use_anchors_": false } entry_scene = ExtResource( 3 ) -container_path = NodePath("VBoxContainer/ScrollContainer/container") +container_path = NodePath("PanelContainer/VBoxContainer/ScrollContainer/container") -[node name="VBoxContainer" type="VBoxContainer" parent="."] +[node name="PanelContainer" type="PanelContainer" parent="."] +margin_left = 82.0 +margin_top = 83.0 +margin_right = 299.0 +margin_bottom = 359.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"] margin_left = 4.0 margin_top = 4.0 -margin_right = 1020.0 -margin_bottom = 596.0 +margin_right = 213.0 +margin_bottom = 272.0 size_flags_horizontal = 3 size_flags_vertical = 3 -[node name="Label" type="Label" parent="VBoxContainer"] -margin_right = 1016.0 +[node name="Label" type="Label" parent="PanelContainer/VBoxContainer"] +margin_right = 209.0 margin_bottom = 15.0 text = "Loot" align = 1 valign = 1 -[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"] +[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/VBoxContainer"] margin_top = 23.0 -margin_right = 1016.0 -margin_bottom = 558.0 +margin_right = 209.0 +margin_bottom = 234.0 size_flags_horizontal = 3 size_flags_vertical = 3 -[node name="container" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"] -margin_right = 1016.0 +[node name="container" type="VBoxContainer" parent="PanelContainer/VBoxContainer/ScrollContainer"] +margin_right = 209.0 size_flags_horizontal = 3 -[node name="Button" type="Button" parent="VBoxContainer"] -margin_top = 566.0 -margin_right = 1016.0 -margin_bottom = 592.57 +[node name="Button" type="Button" parent="PanelContainer/VBoxContainer"] +margin_top = 242.0 +margin_right = 209.0 +margin_bottom = 268.57 text = "close" -[connection signal="pressed" from="VBoxContainer/Button" to="." method="hide"] +[connection signal="pressed" from="PanelContainer/VBoxContainer/Button" to="." method="hide"] diff --git a/game/ui/loot_window/game_module.tres b/game/ui/loot_window/game_module.tres new file mode 100644 index 00000000..8a640a31 --- /dev/null +++ b/game/ui/loot_window/game_module.tres @@ -0,0 +1,11 @@ +[gd_resource type="Resource" load_steps=3 format=2] + +[ext_resource path="res://scripts/game_modules/ui_window_module.gd" type="Script" id=2] +[ext_resource path="res://ui/loot_window/LootWindow.tscn" type="PackedScene" id=3] + +[resource] +script = ExtResource( 2 ) +enabled = true +scene = ExtResource( 3 ) +index = -1 +add_button = false diff --git a/game/ui/player_ui/player_ui.gd b/game/ui/player_ui/player_ui.gd index d7ee10c5..2752891c 100644 --- a/game/ui/player_ui/player_ui.gd +++ b/game/ui/player_ui/player_ui.gd @@ -31,7 +31,6 @@ var gui_base : Node var buttons : Node var windows : Node -export(NodePath) var loot_window_path : NodePath var loot_window : Control func _ready(): @@ -52,8 +51,7 @@ func initialize(): gui_base = get_node(gui_base_path) buttons = get_node(buttons_path) windows = get_node(windows_path) - - loot_window = get_node(loot_window_path) as Control + func _on_Player_onc_open_loot_winow_request() -> void: if loot_window != null: diff --git a/game/ui/player_ui/player_ui.tscn b/game/ui/player_ui/player_ui.tscn index be30799e..88f650eb 100644 --- a/game/ui/player_ui/player_ui.tscn +++ b/game/ui/player_ui/player_ui.tscn @@ -1,11 +1,10 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=12 format=2] [ext_resource path="res://player/GUI.gd" type="Script" id=1] [ext_resource path="res://ui/ingame_menu/IngameMenu.tscn" type="PackedScene" id=2] [ext_resource path="res://ui/theme/menu_icon.tres" type="Texture" id=6] [ext_resource path="res://ui/buttons/Buttons.gd" type="Script" id=9] [ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=10] -[ext_resource path="res://ui/loot_window/LootWindow.tscn" type="PackedScene" id=19] [ext_resource path="res://ui/theme/locked_icon.tres" type="Texture" id=25] [ext_resource path="res://ui/theme/unlocked_icon.tres" type="Texture" id=26] [ext_resource path="res://ui/player_ui/player_ui.gd" type="Script" id=28] @@ -18,7 +17,6 @@ script = ExtResource( 28 ) gui_base_path = NodePath("GUI") buttons_path = NodePath("GUI/Buttons") windows_path = NodePath("GUI/Windows") -loot_window_path = NodePath("GUI/Windows/LootWindow") [node name="GUI" type="Control" parent="."] anchor_right = 1.0 @@ -98,15 +96,6 @@ __meta__ = { [node name="Windows" type="CanvasLayer" parent="GUI"] layer = 2 -[node name="LootWindow" parent="GUI/Windows" instance=ExtResource( 19 )] -visible = false -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 39.0 -margin_top = 85.0 -margin_right = 242.0 -margin_bottom = 315.0 - [node name="TrainerWindow" parent="GUI/Windows" instance=ExtResource( 31 )] visible = false anchor_right = 0.0 diff --git a/game/ui/spellbook/game_module.tres b/game/ui/spellbook/game_module.tres index b7680aa1..9080b7e8 100644 --- a/game/ui/spellbook/game_module.tres +++ b/game/ui/spellbook/game_module.tres @@ -7,6 +7,7 @@ [resource] script = ExtResource( 3 ) enabled = true -character_scene = ExtResource( 2 ) +scene = ExtResource( 2 ) opener_button_texture = ExtResource( 1 ) index = 1 +add_button = true diff --git a/game/ui/talents/game_module.tres b/game/ui/talents/game_module.tres index 08c9afe1..c343d871 100644 --- a/game/ui/talents/game_module.tres +++ b/game/ui/talents/game_module.tres @@ -7,6 +7,7 @@ [resource] script = ExtResource( 2 ) enabled = true -character_scene = ExtResource( 3 ) +scene = ExtResource( 3 ) opener_button_texture = ExtResource( 1 ) index = 2 +add_button = true