Added inventory background and fixes

remotes/checkIfPRContentChanged-1749884192368007736/inventory
cblech 8 months ago
parent 2ab1c38de9
commit 9a5caef52f

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3ln8aleyxgp1"
path="res://.godot/imported/UI_bag_export_01.png-849f65e7f0ae9838cbd0b40d7db0adbf.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/ui/UI/UI_bag_export_01.png"
dest_files=["res://.godot/imported/UI_bag_export_01.png-849f65e7f0ae9838cbd0b40d7db0adbf.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dcidjcsqk12p1"
path="res://.godot/imported/UI_bag_export_02.png-1d79b1aa82b484e614d86097168b3404.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/ui/UI/UI_bag_export_02.png"
dest_files=["res://.godot/imported/UI_bag_export_02.png-1d79b1aa82b484e614d86097168b3404.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

@ -1,9 +1,12 @@
[gd_scene load_steps=5 format=3 uid="uid://cgjc4wurbgimy"] [gd_scene load_steps=8 format=3 uid="uid://cgjc4wurbgimy"]
[ext_resource type="Script" uid="uid://hg7jay2kt441" path="res://scripts/CSharp/Common/Inventory/InventoryUi.cs" id="1_6wusm"] [ext_resource type="Script" uid="uid://hg7jay2kt441" path="res://scripts/CSharp/Common/Inventory/InventoryUi.cs" id="1_6wusm"]
[ext_resource type="Script" uid="uid://b2jhdxcrhtm2d" path="res://scripts/CSharp/Common/Inventory/InventoryTestScript.cs" id="3_exrk4"] [ext_resource type="Script" uid="uid://b2jhdxcrhtm2d" path="res://scripts/CSharp/Common/Inventory/InventoryTestScript.cs" id="3_exrk4"]
[ext_resource type="Texture2D" uid="uid://3ln8aleyxgp1" path="res://art/ui/UI/UI_bag_export_01.png" id="3_vvo7l"]
[ext_resource type="Resource" uid="uid://datee0flk1e84" path="res://resources/items/pickaxe.tres" id="4_5fdxq"] [ext_resource type="Resource" uid="uid://datee0flk1e84" path="res://resources/items/pickaxe.tres" id="4_5fdxq"]
[ext_resource type="Texture2D" uid="uid://dcidjcsqk12p1" path="res://art/ui/UI/UI_bag_export_02.png" id="4_df8i8"]
[ext_resource type="Texture2D" uid="uid://c7wqla0mbu3np" path="res://art/ui/babushka_ui_tmp_inventory_select.png" id="4_tiss4"] [ext_resource type="Texture2D" uid="uid://c7wqla0mbu3np" path="res://art/ui/babushka_ui_tmp_inventory_select.png" id="4_tiss4"]
[ext_resource type="PackedScene" uid="uid://c0kmdjeqkqrwv" path="res://prefabs/UI/Inventory/Slot.tscn" id="5_u7kje"]
[node name="CanvasLayer" type="CanvasLayer"] [node name="CanvasLayer" type="CanvasLayer"]
layer = 90 layer = 90
@ -13,10 +16,15 @@ layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = 174.0
offset_top = 191.0
offset_right = 174.0
offset_bottom = 191.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
scale = Vector2(0.7, 0.7)
script = ExtResource("1_6wusm") script = ExtResource("1_6wusm")
_inventoryOpenedOffset = -300.0 _inventoryOpenedOffset = -700.0
[node name="SlotsContainer" type="Control" parent="Inventory"] [node name="SlotsContainer" type="Control" parent="Inventory"]
custom_minimum_size = Vector2(500, 0) custom_minimum_size = Vector2(500, 0)
@ -29,17 +37,22 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="SlotSelectContainer" type="Control" parent="Inventory/SlotsContainer"] [node name="SlotSelectContainer" type="Control" parent="Inventory/SlotsContainer"]
custom_minimum_size = Vector2(1000, 100) custom_minimum_size = Vector2(900, 100)
layout_mode = 1 layout_mode = 1
anchors_preset = 7 anchors_preset = 7
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 1.0 anchor_top = 1.0
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = -450.0
offset_top = -115.0
offset_right = 450.0
offset_bottom = -15.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 0 grow_vertical = 0
[node name="Selector" type="TextureRect" parent="Inventory/SlotsContainer/SlotSelectContainer"] [node name="Selector" type="TextureRect" parent="Inventory/SlotsContainer/SlotSelectContainer"]
z_index = 10
custom_minimum_size = Vector2(100, 100) custom_minimum_size = Vector2(100, 100)
layout_mode = 0 layout_mode = 0
offset_left = 1.0 offset_left = 1.0
@ -49,30 +62,314 @@ texture = ExtResource("4_tiss4")
expand_mode = 1 expand_mode = 1
[node name="SlotsMover" type="Control" parent="Inventory/SlotsContainer"] [node name="SlotsMover" type="Control" parent="Inventory/SlotsContainer"]
custom_minimum_size = Vector2(900, 610)
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -200.0
offset_top = -611.0
offset_right = 200.0
offset_bottom = -1.0
grow_horizontal = 2
grow_vertical = 0
[node name="BackgroundContainer" type="Control" parent="Inventory/SlotsContainer/SlotsMover"]
layout_mode = 1
anchors_preset = 0
offset_left = 5.0
offset_top = 384.0
offset_right = 901.0
offset_bottom = 1230.0
mouse_filter = 2
[node name="TextureRect" type="TextureRect" parent="Inventory/SlotsContainer/SlotsMover/BackgroundContainer"]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = -305.0
offset_right = 303.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 2
texture = ExtResource("3_vvo7l")
expand_mode = 3
[node name="Slots" type="GridContainer" parent="Inventory/SlotsContainer/SlotsMover"] [node name="TextureRect2" type="TextureRect" parent="Inventory/SlotsContainer/SlotsMover/BackgroundContainer"]
custom_minimum_size = Vector2(1000, 300)
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = 15
anchor_left = 0.5 anchor_right = 1.0
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = -500.0
offset_top = -100.0
offset_right = 500.0
offset_bottom = 200.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 0 grow_vertical = 2
theme_override_constants/h_separation = 0 mouse_filter = 2
theme_override_constants/v_separation = 0 texture = ExtResource("3_vvo7l")
columns = 10 expand_mode = 3
flip_h = true
[node name="TextureRect3" type="TextureRect" parent="Inventory/SlotsContainer/SlotsMover/BackgroundContainer"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
texture = ExtResource("4_df8i8")
expand_mode = 3
flip_h = true
[node name="Slots" type="Control" parent="Inventory/SlotsContainer/SlotsMover"]
custom_minimum_size = Vector2(900, 610)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 496.0
offset_bottom = 496.0
grow_horizontal = 2
grow_vertical = 2
[node name="Slot" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
[node name="Slot2" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 100.0
offset_right = 200.0
[node name="Slot3" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 201.0
offset_right = 301.0
[node name="Slot4" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 301.0
offset_right = 401.0
[node name="Slot5" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 401.0
offset_right = 501.0
[node name="Slot6" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 501.0
offset_right = 601.0
[node name="Slot7" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 601.0
offset_right = 701.0
[node name="Slot8" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 702.0
offset_right = 802.0
[node name="Slot9" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 802.0
offset_right = 902.0
[node name="Slot10" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 101.0
offset_top = 212.0
offset_right = 201.0
offset_bottom = 312.0
[node name="Slot11" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 201.0
offset_top = 212.0
offset_right = 301.0
offset_bottom = 312.0
[node name="Slot12" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 301.0
offset_top = 212.0
offset_right = 401.0
offset_bottom = 312.0
[node name="Slot13" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 401.0
offset_top = 212.0
offset_right = 501.0
offset_bottom = 312.0
[node name="Slot14" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 501.0
offset_top = 212.0
offset_right = 601.0
offset_bottom = 312.0
[node name="Slot15" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 602.0
offset_top = 212.0
offset_right = 702.0
offset_bottom = 312.0
[node name="Slot16" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 702.0
offset_top = 212.0
offset_right = 802.0
offset_bottom = 312.0
[node name="Slot17" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 102.0
offset_top = 312.0
offset_right = 202.0
offset_bottom = 412.0
[node name="Slot18" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 202.0
offset_top = 312.0
offset_right = 302.0
offset_bottom = 412.0
[node name="Slot19" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 302.0
offset_top = 312.0
offset_right = 402.0
offset_bottom = 412.0
[node name="Slot20" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 402.0
offset_top = 312.0
offset_right = 502.0
offset_bottom = 412.0
[node name="Slot21" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 502.0
offset_top = 312.0
offset_right = 602.0
offset_bottom = 412.0
[node name="Slot22" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 603.0
offset_top = 312.0
offset_right = 703.0
offset_bottom = 412.0
[node name="Slot23" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 703.0
offset_top = 312.0
offset_right = 803.0
offset_bottom = 412.0
[node name="Slot24" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 102.0
offset_top = 412.0
offset_right = 202.0
offset_bottom = 512.0
[node name="Slot25" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 202.0
offset_top = 412.0
offset_right = 302.0
offset_bottom = 512.0
[node name="Slot26" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 302.0
offset_top = 412.0
offset_right = 402.0
offset_bottom = 512.0
[node name="Slot27" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 402.0
offset_top = 412.0
offset_right = 502.0
offset_bottom = 512.0
[node name="Slot28" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 502.0
offset_top = 412.0
offset_right = 602.0
offset_bottom = 512.0
[node name="Slot29" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 603.0
offset_top = 412.0
offset_right = 703.0
offset_bottom = 512.0
[node name="Slot30" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 703.0
offset_top = 412.0
offset_right = 803.0
offset_bottom = 512.0
[node name="Slot31" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 102.0
offset_top = 512.0
offset_right = 202.0
offset_bottom = 612.0
[node name="Slot32" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 202.0
offset_top = 512.0
offset_right = 302.0
offset_bottom = 612.0
[node name="Slot33" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 302.0
offset_top = 512.0
offset_right = 402.0
offset_bottom = 612.0
[node name="Slot34" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 402.0
offset_top = 512.0
offset_right = 502.0
offset_bottom = 612.0
[node name="Slot35" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 502.0
offset_top = 512.0
offset_right = 602.0
offset_bottom = 612.0
[node name="Slot36" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 603.0
offset_top = 512.0
offset_right = 703.0
offset_bottom = 612.0
[node name="Slot37" parent="Inventory/SlotsContainer/SlotsMover/Slots" instance=ExtResource("5_u7kje")]
layout_mode = 1
offset_left = 703.0
offset_top = 512.0
offset_right = 803.0
offset_bottom = 612.0
[node name="InventoryTester" type="Node" parent="Inventory"] [node name="InventoryTester" type="Node" parent="Inventory"]
script = ExtResource("3_exrk4") script = ExtResource("3_exrk4")

@ -10,12 +10,9 @@ font_color = Color(0.203922, 1, 1, 1)
[node name="Slot" type="Control"] [node name="Slot" type="Control"]
custom_minimum_size = Vector2(100, 100) custom_minimum_size = Vector2(100, 100)
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 0
anchor_right = 1.0 offset_right = 100.0
anchor_bottom = 1.0 offset_bottom = 100.0
offset_bottom = 2.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_au0l0") script = ExtResource("1_au0l0")
[node name="TextureRect" type="TextureRect" parent="."] [node name="TextureRect" type="TextureRect" parent="."]
@ -48,8 +45,8 @@ anchor_left = 1.0
anchor_top = 1.0 anchor_top = 1.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = -409.0 offset_left = -50.0
offset_top = -329.0 offset_top = -50.0
offset_right = -10.0 offset_right = -10.0
offset_bottom = -10.0 offset_bottom = -10.0
grow_horizontal = 0 grow_horizontal = 0

@ -1,4 +1,4 @@
[gd_scene load_steps=52 format=3 uid="uid://gigb28qk8t12"] [gd_scene load_steps=52 format=3 uid="uid://dee2hgv85mdak"]
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/Player2D.tscn" id="1_7wfwe"] [ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/Player2D.tscn" id="1_7wfwe"]
[ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"] [ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
@ -26,7 +26,7 @@
[ext_resource type="Texture2D" uid="uid://dg7rlugnq0t45" path="res://art/farm/farming/farmobjekte/brünnen.png" id="21_ualyd"] [ext_resource type="Texture2D" uid="uid://dg7rlugnq0t45" path="res://art/farm/farming/farmobjekte/brünnen.png" id="21_ualyd"]
[ext_resource type="Script" uid="uid://dhxtdhfqx3bte" path="res://scripts/CSharp/Common/Farming/FieldService2D.cs" id="25_0qu0h"] [ext_resource type="Script" uid="uid://dhxtdhfqx3bte" path="res://scripts/CSharp/Common/Farming/FieldService2D.cs" id="25_0qu0h"]
[ext_resource type="PackedScene" uid="uid://b1d2e7ely6hyw" path="res://prefabs/farm/base_field_2d.tscn" id="26_vbdb2"] [ext_resource type="PackedScene" uid="uid://b1d2e7ely6hyw" path="res://prefabs/farm/base_field_2d.tscn" id="26_vbdb2"]
[ext_resource type="PackedScene" uid="uid://bo6pgwyep3glx" path="res://prefabs/interaction_area_2d.tscn" id="27_klb81"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interaction_area_2d.tscn" id="27_klb81"]
[ext_resource type="PackedScene" path="res://prefabs/interactions/sprite_switcher_2d.tscn" id="28_p6n74"] [ext_resource type="PackedScene" path="res://prefabs/interactions/sprite_switcher_2d.tscn" id="28_p6n74"]
[ext_resource type="Texture2D" uid="uid://x8hr8287ff2n" path="res://art/farm/farming/farmobjekte/tools atlas.png" id="29_p6n74"] [ext_resource type="Texture2D" uid="uid://x8hr8287ff2n" path="res://art/farm/farming/farmobjekte/tools atlas.png" id="29_p6n74"]
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="30_kxdmn"] [ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="30_kxdmn"]

@ -17,7 +17,7 @@ public partial class InventoryManager : Node
public override void _Ready() public override void _Ready()
{ {
playerInventory = new InventoryInstance(); playerInventory = new InventoryInstance();
playerInventory.SlotAmount = 30; playerInventory.SlotAmount = 37;
} }
public InventoryActionResult CreateItem( public InventoryActionResult CreateItem(

@ -5,7 +5,7 @@ namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class InventoryUi : Control public partial class InventoryUi : Control
{ {
private GridContainer _slots; private Control _slots;
private Control _slotsMover; private Control _slotsMover;
private InventoryInstance _playerInventory; private InventoryInstance _playerInventory;
private Control _slotSelect; private Control _slotSelect;
@ -26,11 +26,12 @@ public partial class InventoryUi : Control
public override void _Ready() public override void _Ready()
{ {
GD.Print("Ready inventory ui"); GD.Print("Ready inventory ui");
_slots = GetNode<GridContainer>("SlotsContainer/SlotsMover/Slots"); _slots = GetNode<Control>("SlotsContainer/SlotsMover/Slots");
_slotsMover = GetNode<Control>("SlotsContainer/SlotsMover"); _slotsMover = GetNode<Control>("SlotsContainer/SlotsMover");
_playerInventory = InventoryManager.Instance.playerInventory; _playerInventory = InventoryManager.Instance.playerInventory;
_slotSelect = GetNode<Control>("SlotsContainer/SlotSelectContainer/Selector"); _slotSelect = GetNode<Control>("SlotsContainer/SlotSelectContainer/Selector");
PopulateSlots(); //PopulateSlots();
SubscribeSlots();
SetSlotContent(); SetSlotContent();
SetSlotSelectPosition(); SetSlotSelectPosition();
InventoryManager.Instance.playerInventory.InventoryContentsChanged += SetSlotContent; InventoryManager.Instance.playerInventory.InventoryContentsChanged += SetSlotContent;
@ -76,6 +77,17 @@ public partial class InventoryUi : Control
_slots.AddChild(slotInstance); _slots.AddChild(slotInstance);
} }
} }
private void SubscribeSlots()
{
for (var index = 0; index < _playerInventory.Slots.Count; index++)
{
var slotInstance = _slots.GetChild<SlotUi>(index);
slotInstance.index = index;
slotInstance.Clicked += SlotClicked;
_slots.AddChild(slotInstance);
}
}
private void UnsubscribeSlots() private void UnsubscribeSlots()
{ {

Loading…
Cancel
Save