Skip to content

Commit

Permalink
Merge pull request #56 from snipercup/Inventory-list
Browse files Browse the repository at this point in the history
Inventory list initial version
  • Loading branch information
snipercup authored Mar 5, 2024
2 parents c2ab4f8 + 79d1ade commit 1a84ea9
Show file tree
Hide file tree
Showing 10 changed files with 773 additions and 17 deletions.
1 change: 0 additions & 1 deletion Scenes/ContentManager/Mapeditor/Scripts/GridContainer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,5 @@ func rotate_level_clockwise():
var furniture_rotation = int(new_level_data[new_index].get("furniture").get("rotation", 0))
new_level_data[new_index]["furniture"]["rotation"] = (furniture_rotation + 90) % 360


# Update the current level data
currentLevelData = new_level_data
3 changes: 1 addition & 2 deletions Scenes/ContentManager/Mapeditor/mapeditor.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ theme_override_icons/unchecked = ExtResource("2_bib5l")

[node name="RotateMap" type="CheckBox" parent="HSplitContainer/MapeditorContainer/Toolbar"]
layout_mode = 2
tooltip_text = "Rotate the brush to paint with rotation"
tooltip_text = "Rotate the map and all levels in it by 90 degrees clockwise. Tiles and furniture will be rotated"
theme_override_icons/checked = ExtResource("3_8q2iq")
theme_override_icons/unchecked = ExtResource("3_8q2iq")
shortcut = SubResource("Shortcut_1tryc")
text = "0"

[node name="ZoomScroller" parent="HSplitContainer/MapeditorContainer/Toolbar" instance=ExtResource("1_0ytmu")]
layout_mode = 2
Expand Down
24 changes: 15 additions & 9 deletions Scenes/InventoryWindow.tscn
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[gd_scene load_steps=14 format=3 uid="uid://e0ebcv1n8jnq"]
[gd_scene load_steps=15 format=3 uid="uid://e0ebcv1n8jnq"]

[ext_resource type="Script" path="res://Scripts/InventoryWindow.gd" id="1_7kqbx"]
[ext_resource type="PackedScene" uid="uid://crck2fhgayxhn" path="res://Scenes/InventoryContainerListItem.tscn" id="2_xfgb3"]
[ext_resource type="Script" path="res://addons/gloot/core/inventory_stacked.gd" id="3_l8xgt"]
[ext_resource type="Resource" uid="uid://clehtt4tyqvdy" path="res://ItemProtosets.tres" id="3_sqsc0"]
[ext_resource type="Resource" uid="uid://cr7u5aveonr7t" path="res://ItemProtosets.tres" id="3_sqsc0"]
[ext_resource type="Script" path="res://addons/gloot/core/inventory_item.gd" id="5_qidb6"]
[ext_resource type="FontFile" uid="uid://chm7lbcdeyo0h" path="res://Roboto-Bold.ttf" id="6_xpf2l"]
[ext_resource type="Script" path="res://addons/gloot/ui/ctrl_item_slot_ex.gd" id="7_kcmi5"]
[ext_resource type="Texture2D" uid="uid://dfmrlie57qrbo" path="res://Mods/Core/Items/9mm.png" id="8_0yr0i"]
[ext_resource type="PackedScene" uid="uid://y2iul2r3nysx" path="res://Scenes/UI/CtrlInventoryStackedCustom.tscn" id="8_f75fl"]
[ext_resource type="Script" path="res://addons/gloot/ui/ctrl_inventory_stacked.gd" id="9_8a8sx"]
[ext_resource type="Texture2D" uid="uid://df2n5aculnj82" path="res://addons/gloot/images/icon_inventory.svg" id="10_6ygdg"]
[ext_resource type="Script" path="res://addons/gloot/core/item_ref_slot.gd" id="11_nqptt"]
Expand Down Expand Up @@ -60,22 +61,22 @@ script = ExtResource("5_qidb6")
protoset = ExtResource("3_sqsc0")
prototype_id = "bullet_9mm"

[node name="_Node_23288" type="Node" parent="InventoryStacked"]
[node name="_Node_211767" type="Node" parent="InventoryStacked"]
script = ExtResource("5_qidb6")
protoset = ExtResource("3_sqsc0")
prototype_id = "pistol_magazine"
prototype_id = "rifle_m4a1"

[node name="_Node_23298" type="Node" parent="InventoryStacked"]
[node name="_Node_23006" type="Node" parent="InventoryStacked"]
script = ExtResource("5_qidb6")
protoset = ExtResource("3_sqsc0")
prototype_id = "rifle_m4a1"
prototype_id = "pistol_9mm"

[node name="_Node_23311" type="Node" parent="InventoryStacked"]
[node name="_Node_23025" type="Node" parent="InventoryStacked"]
script = ExtResource("5_qidb6")
protoset = ExtResource("3_sqsc0")
prototype_id = "pistol_9mm"
prototype_id = "pistol_magazine"

[node name="_Node_65384" type="Node" parent="InventoryStacked"]
[node name="_Node_23044" type="Node" parent="InventoryStacked"]
script = ExtResource("5_qidb6")
protoset = ExtResource("3_sqsc0")
prototype_id = "pistol_9mm"
Expand Down Expand Up @@ -126,13 +127,18 @@ layout_mode = 2
text = "<-"

[node name="CtrlInventoryStacked" type="Control" parent="HBoxContainer"]
visible = false
custom_minimum_size = Vector2(300, 400)
layout_mode = 2
size_flags_horizontal = 3
script = ExtResource("9_8a8sx")
inventory_path = NodePath("../../InventoryStacked")
default_item_icon = ExtResource("10_6ygdg")

[node name="CtrlInventoryStackedCustom" parent="HBoxContainer" node_paths=PackedStringArray("myInventory") instance=ExtResource("8_f75fl")]
layout_mode = 2
myInventory = NodePath("../../InventoryStacked")

[node name="EquipmentSlotList" type="VBoxContainer" parent="HBoxContainer"]
custom_minimum_size = Vector2(64, 0)
layout_mode = 2
Expand Down
84 changes: 84 additions & 0 deletions Scenes/UI/CtrlInventoryStackedCustom.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[gd_scene load_steps=4 format=3 uid="uid://y2iul2r3nysx"]

[ext_resource type="Script" path="res://Scripts/CtrlInventoryStackedCustom.gd" id="1_1pahw"]
[ext_resource type="PackedScene" uid="uid://bgnxsnv6ltej8" path="res://Scenes/UI/CtrlInventoryStackedListItem.tscn" id="2_woew4"]
[ext_resource type="PackedScene" uid="uid://dxgl4vkc313we" path="res://Scenes/UI/CtrlInventoryStackedlistHeaderItem.tscn" id="3_svicc"]

[node name="CtrlInventoryStackedCustom" type="Control" node_paths=PackedStringArray("inventoryGrid", "WeightBar", "VolumeBar", "context_menu")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("1_1pahw")
inventoryGrid = NodePath("VBoxContainer/InventoryGrid")
WeightBar = NodePath("VBoxContainer/HBoxContainer/WeightBar")
VolumeBar = NodePath("VBoxContainer/HBoxContainer/VolumeBar")
listItemContainer = ExtResource("2_woew4")
listHeaderContainer = ExtResource("3_svicc")
context_menu = NodePath("ContextMenu")

[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.278431, 0.278431, 0.278431, 1)

[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[node name="InventoryGrid" type="GridContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
size_flags_stretch_ratio = 0.95
theme_override_constants/h_separation = 0
theme_override_constants/v_separation = 0
columns = 5

[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
size_flags_stretch_ratio = 0.05

[node name="WeightLabel" type="Label" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Weight:"

[node name="WeightBar" type="ProgressBar" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3

[node name="VolumeLabel" type="Label" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Volume:"

[node name="VolumeBar" type="ProgressBar" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3

[node name="ContextMenu" type="PopupMenu" parent="."]
size = Vector2i(112, 100)
item_count = 5
item_0/text = "Equip (left)"
item_0/id = 0
item_1/text = "Equip (right)"
item_1/id = 1
item_2/text = "Drop"
item_2/id = 2
item_3/text = "Wear"
item_3/id = 3
item_4/text = "Disassemble"
item_4/id = 4

[connection signal="id_pressed" from="ContextMenu" to="." method="_on_context_menu_item_selected"]
44 changes: 44 additions & 0 deletions Scenes/UI/CtrlInventoryStackedListItem.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[gd_scene load_steps=2 format=3 uid="uid://bgnxsnv6ltej8"]

[ext_resource type="Script" path="res://Scripts/CtrlInventoryStackedListItem.gd" id="1_1qim3"]

[node name="CtrlInventoryStackedListItem" type="Control" node_paths=PackedStringArray("myBackgroundRect", "myLabel", "myIcon")]
custom_minimum_size = Vector2(50, 24)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_1qim3")
myBackgroundRect = NodePath("ColorRect")
myLabel = NodePath("HBoxContainer/Label")
myIcon = NodePath("HBoxContainer/TextureRect")

[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.454902, 0.454902, 0.454902, 1)

[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[node name="TextureRect" type="TextureRect" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
expand_mode = 2

[node name="Label" type="Label" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3

[connection signal="gui_input" from="." to="." method="_on_gui_input"]
36 changes: 36 additions & 0 deletions Scenes/UI/CtrlInventoryStackedlistHeaderItem.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[gd_scene load_steps=2 format=3 uid="uid://dxgl4vkc313we"]

[ext_resource type="Script" path="res://Scripts/CtrlInventoryStackedlistHeaderItem.gd" id="1_obkif"]

[node name="CtrlInventoryStackedHeaderItem" type="Control" node_paths=PackedStringArray("myBackgroundRect", "myLabel")]
custom_minimum_size = Vector2(50, 24)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_obkif")
myBackgroundRect = NodePath("ColorRect")
myLabel = NodePath("Label")

[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.454902, 0.454902, 0.454902, 1)

[node name="Label" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
text = "wadawd"

[connection signal="gui_input" from="ColorRect" to="." method="_on_gui_input"]
Loading

0 comments on commit 1a84ea9

Please sign in to comment.