Browse Source

wip: Reworked Quickslots and wired up inventory

pull/24/head
Ryan Reed 3 weeks ago
parent
commit
34a56a09db
11 changed files with 191 additions and 184 deletions
  1. +26
    -13
      autoloads/inventory_manager.gd
  2. +2
    -16
      resources/inventory/player_inventory_testing.tres
  3. +24
    -8
      scenes/player/player.gd
  4. +1
    -1
      scenes/player/player.tscn
  5. +1
    -1
      scenes/player/ray_cast_look.gd
  6. +39
    -0
      scenes/ui/inventory/quickslots_slot.gd
  7. +1
    -0
      scenes/ui/inventory/quickslots_slot.gd.uid
  8. +36
    -0
      scenes/ui/inventory/quickslots_slot.tscn
  9. +27
    -21
      scenes/ui/quick_slots.gd
  10. +29
    -123
      scenes/ui/quick_slots.tscn
  11. +5
    -1
      scenes/ui/ui.tscn

+ 26
- 13
autoloads/inventory_manager.gd View File

@ -3,7 +3,7 @@ extends Node
signal next_quick_slot signal next_quick_slot
signal previous_quick_slot signal previous_quick_slot
signal select_quick_slot(slot_index: int) signal select_quick_slot(slot_index: int)
signal quick_slot_item_changed(item_id: String)
signal quick_slot_selected(slot_index: int)
signal item_picked_up(item: DBItemResource) signal item_picked_up(item: DBItemResource)
signal item_dropped(item: DBItemResource) signal item_dropped(item: DBItemResource)
signal inventory_opened signal inventory_opened
@ -14,11 +14,11 @@ signal add_to_inventory(item_id: String, amount: int)
signal remove_from_inventory(item_id: String, amount: int) signal remove_from_inventory(item_id: String, amount: int)
signal item_added(item_id: String, amount: int) signal item_added(item_id: String, amount: int)
signal item_removed(item_id: String, amount: int) signal item_removed(item_id: String, amount: int)
signal inventory_slot_cleared(slot_index: int)
signal inventory_slot_updated(slot_index: int)
var quick_slot_item_id: String = "001"
var quick_slot_count: int = 10
var selected_quick_slot: int = 0
var max_inventory_items: int = 40 # 4 rows of 10 var max_inventory_items: int = 40 # 4 rows of 10
var inventory: Array[DBItemResource] = [] ## To ensure inventory is automatically sorted, "empty" inventory cells will be replaced with null to keep positions var inventory: Array[DBItemResource] = [] ## To ensure inventory is automatically sorted, "empty" inventory cells will be replaced with null to keep positions
@ -26,13 +26,14 @@ var _inventory_cache: Dictionary[String, Dictionary] = {} ## Used for caching ce
func _ready() -> void: func _ready() -> void:
self.quick_slot_item_changed.connect(_on_quick_slot_item_changed)
self.item_picked_up.connect(_on_item_picked_up) self.item_picked_up.connect(_on_item_picked_up)
self.item_dropped.connect(_on_item_dropped) self.item_dropped.connect(_on_item_dropped)
self.add_to_inventory.connect(_on_add_to_inventory) self.add_to_inventory.connect(_on_add_to_inventory)
self.remove_from_inventory.connect(_on_remove_from_inventory) self.remove_from_inventory.connect(_on_remove_from_inventory)
self.clear_inventory.connect(_on_clear_inventory) self.clear_inventory.connect(_on_clear_inventory)
self.quick_slot_selected.connect(_on_quick_slot_selected)
func available_space(item_id: String) -> int: func available_space(item_id: String) -> int:
@ -50,6 +51,13 @@ func available_space(item_id: String) -> int:
var open_stack_amount: int = (max_inventory_items - inventory.size()) * DBItems.data[item_id].max_stack_size var open_stack_amount: int = (max_inventory_items - inventory.size()) * DBItems.data[item_id].max_stack_size
return open_stack_amount + space_in_stacks return open_stack_amount + space_in_stacks
func get_inventory_item(item_slot: int = selected_quick_slot) -> DBItemResource:
if item_slot >= inventory.size() or item_slot < 0:
return null
return inventory.get(item_slot)
func get_quick_slot_item_id(item_slot: int = selected_quick_slot) -> String:
return inventory[item_slot].id
func _find_stacks_by_id(item_resource: DBItemResource, item_id: String) -> bool: func _find_stacks_by_id(item_resource: DBItemResource, item_id: String) -> bool:
return item_resource != null and item_resource.id == item_id return item_resource != null and item_resource.id == item_id
@ -98,6 +106,8 @@ func _on_add_to_inventory(item_id: String, amount: int = 1) -> void:
_update_cache_total(item_id, stack_resource.max_stack_size) _update_cache_total(item_id, stack_resource.max_stack_size)
inventory[-1].amount = stack_resource.max_stack_size inventory[-1].amount = stack_resource.max_stack_size
amount_remaining -= stack_resource.max_stack_size amount_remaining -= stack_resource.max_stack_size
inventory_slot_updated.emit(inventory.size() - 1)
elif first_stack_index > -1: elif first_stack_index > -1:
if inventory[first_stack_index] == null: # Empty slot if inventory[first_stack_index] == null: # Empty slot
inventory[first_stack_index] = item_resource.duplicate() inventory[first_stack_index] = item_resource.duplicate()
@ -114,6 +124,8 @@ func _on_add_to_inventory(item_id: String, amount: int = 1) -> void:
inventory[first_stack_index].amount = stack_resource.max_stack_size inventory[first_stack_index].amount = stack_resource.max_stack_size
amount_remaining -= stack_resource.max_stack_size amount_remaining -= stack_resource.max_stack_size
inventory_slot_updated.emit(first_stack_index)
item_added.emit(item_id, amount - amount_remaining) item_added.emit(item_id, amount - amount_remaining)
func _on_remove_from_inventory(item_id: String, amount: int = 1) -> void: func _on_remove_from_inventory(item_id: String, amount: int = 1) -> void:
@ -135,8 +147,9 @@ func _on_remove_from_inventory(item_id: String, amount: int = 1) -> void:
_update_cache_total(item_id, -amount_remaining) _update_cache_total(item_id, -amount_remaining)
inventory[last_stack_index] = null inventory[last_stack_index] = null
amount_remaining -= to_remove amount_remaining -= to_remove
inventory_slot_cleared.emit(last_stack_index)
else: # Received more to remove than we had stacks of
inventory_slot_updated.emit(last_stack_index)
else: # Received more to remove than we have stacks for
amount_remaining = 0 amount_remaining = 0
item_removed.emit(item_id, amount - amount_remaining) item_removed.emit(item_id, amount - amount_remaining)
@ -145,11 +158,11 @@ func _on_clear_inventory() -> void:
inventory.clear() inventory.clear()
_inventory_cache.clear() _inventory_cache.clear()
func _on_item_dropped(item_id: String) -> void:
_on_remove_from_inventory(item_id, 1)
func _on_item_dropped(item: DBItemResource) -> void:
_on_remove_from_inventory(item.id, 1)
func _on_item_picked_up(item_id: String) -> void:
_on_add_to_inventory(item_id, 1)
func _on_item_picked_up(item: DBItemResource) -> void:
_on_add_to_inventory(item.id, 1)
func _on_quick_slot_item_changed(item_id: String) -> void:
quick_slot_item_id = item_id
func _on_quick_slot_selected(slot_index: int) -> void:
selected_quick_slot = slot_index

+ 2
- 16
resources/inventory/player_inventory_testing.tres View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="InventoryResource" load_steps=19 format=3 uid="uid://blfp6tiir282o"]
[gd_resource type="Resource" script_class="InventoryResource" load_steps=16 format=3 uid="uid://blfp6tiir282o"]
[ext_resource type="Script" uid="uid://becun6dj78v8d" path="res://resources/inventory_resource.gd" id="1_4v6mg"] [ext_resource type="Script" uid="uid://becun6dj78v8d" path="res://resources/inventory_resource.gd" id="1_4v6mg"]
[ext_resource type="Script" uid="uid://bdx4q355l5ugl" path="res://resources/db_item_resource.gd" id="1_gg8jx"] [ext_resource type="Script" uid="uid://bdx4q355l5ugl" path="res://resources/db_item_resource.gd" id="1_gg8jx"]
@ -9,8 +9,6 @@
[ext_resource type="Material" uid="uid://b4wrf3quiaa1b" path="res://assets/materials/grass.tres" id="7_vgvac"] [ext_resource type="Material" uid="uid://b4wrf3quiaa1b" path="res://assets/materials/grass.tres" id="7_vgvac"]
[ext_resource type="Material" uid="uid://d15n1p3spu3jg" path="res://assets/materials/leaves.tres" id="7_xd1nd"] [ext_resource type="Material" uid="uid://d15n1p3spu3jg" path="res://assets/materials/leaves.tres" id="7_xd1nd"]
[ext_resource type="Material" uid="uid://b2w5ybx51vuwf" path="res://assets/materials/glass.tres" id="8_7yuhn"] [ext_resource type="Material" uid="uid://b2w5ybx51vuwf" path="res://assets/materials/glass.tres" id="8_7yuhn"]
[ext_resource type="PackedScene" uid="uid://ccky0w7brcf1l" path="res://scenes/items/torch.tscn" id="9_viap3"]
[ext_resource type="Script" uid="uid://m32ytcig5ha5" path="res://resources/item_resource.gd" id="10_wqat2"]
[sub_resource type="Resource" id="Resource_jaam2"] [sub_resource type="Resource" id="Resource_jaam2"]
script = ExtResource("3_vgvac") script = ExtResource("3_vgvac")
@ -84,19 +82,7 @@ description = "Glass block"
item_texture = "uid://cpllegyqnfnrh" item_texture = "uid://cpllegyqnfnrh"
metadata/_custom_type_script = "uid://dwrmy4mx0mw18" metadata/_custom_type_script = "uid://dwrmy4mx0mw18"
[sub_resource type="Resource" id="Resource_xd1nd"]
script = ExtResource("10_wqat2")
resource_scene = ExtResource("9_viap3")
id = "007"
name = "Torch"
amount = 999
max_stack_size = 999
max_number_stacks = 0
description = "A torch to light the way"
item_texture = "uid://dknv7amroftm8"
metadata/_custom_type_script = "uid://m32ytcig5ha5"
[resource] [resource]
script = ExtResource("1_4v6mg") script = ExtResource("1_4v6mg")
inventory = Array[ExtResource("1_gg8jx")]([SubResource("Resource_jaam2"), SubResource("Resource_4kby3"), SubResource("Resource_byct5"), SubResource("Resource_qycqj"), SubResource("Resource_viap3"), SubResource("Resource_wqat2"), SubResource("Resource_xd1nd")])
inventory = Array[ExtResource("1_gg8jx")]([SubResource("Resource_jaam2"), SubResource("Resource_4kby3"), SubResource("Resource_byct5"), SubResource("Resource_qycqj"), SubResource("Resource_viap3"), SubResource("Resource_wqat2")])
metadata/_custom_type_script = "uid://becun6dj78v8d" metadata/_custom_type_script = "uid://becun6dj78v8d"

+ 24
- 8
scenes/player/player.gd View File

@ -37,7 +37,9 @@ func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
_handle_mouse_movement(event.relative) _handle_mouse_movement(event.relative)
elif event.is_action_pressed("throw_item"): # TODO: Move to state? elif event.is_action_pressed("throw_item"): # TODO: Move to state?
EntityManager.drop_block.emit(InventoryManager.quick_slot_item_id, head.global_position, -head.global_basis.z, throw_velocity)
if InventoryManager.get_inventory_item() != null:
EntityManager.drop_block.emit(InventoryManager.get_quick_slot_item_id(), head.global_position, -head.global_basis.z, throw_velocity)
InventoryManager.remove_from_inventory.emit(InventoryManager.get_quick_slot_item_id(), 1)
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
is_crouching = Input.is_action_pressed("crouch") or ray_cast_crouch.is_colliding() is_crouching = Input.is_action_pressed("crouch") or ray_cast_crouch.is_colliding()
@ -56,14 +58,15 @@ func _physics_process(delta: float) -> void:
func _ready() -> void: func _ready() -> void:
GameSettingsManager.graphics_fov_changed.connect(_on_graphics_fov_changed) GameSettingsManager.graphics_fov_changed.connect(_on_graphics_fov_changed)
GameSettingsManager.game_options_held_block_ui_changed.connect(_on_game_options_held_block_ui_changed) GameSettingsManager.game_options_held_block_ui_changed.connect(_on_game_options_held_block_ui_changed)
InventoryManager.quick_slot_item_changed.connect(_on_quick_slot_item_changed)
InventoryManager.quick_slot_selected.connect(_on_quick_slot_selected)
InventoryManager.add_to_inventory.connect(_on_add_to_inventory)
InventoryManager.remove_from_inventory.connect(_on_remove_from_inventory)
InventoryManager.item_picked_up.connect(_on_item_picked_up)
SignalManager.resume_game.connect(_on_resume_game) SignalManager.resume_game.connect(_on_resume_game)
SignalManager.open_pause_menu.connect(_on_open_pause_menu) SignalManager.open_pause_menu.connect(_on_open_pause_menu)
SignalManager.hide_ui.connect(_on_hide_ui) SignalManager.hide_ui.connect(_on_hide_ui)
SignalManager.show_ui.connect(_on_show_ui) SignalManager.show_ui.connect(_on_show_ui)
_update_held_block_mesh(InventoryManager.quick_slot_item_id)
func _apply_gravity(delta: float) -> void: func _apply_gravity(delta: float) -> void:
if is_on_floor(): return if is_on_floor(): return
@ -133,10 +136,15 @@ func _set_is_sprinting() -> void:
else: else:
is_sprinting = Input.is_action_pressed("run") is_sprinting = Input.is_action_pressed("run")
func _update_held_block_mesh(item_id: String) -> void:
func _update_held_block_mesh() -> void:
var current_item: DBItemResource = InventoryManager.get_inventory_item()
if current_item == null:
block_mesh.visible = false
return
block_mesh.visible = GameSettingsManager.settings.game_options.enable_held_block block_mesh.visible = GameSettingsManager.settings.game_options.enable_held_block
if GameSettingsManager.settings.game_options.enable_held_block: if GameSettingsManager.settings.game_options.enable_held_block:
block_mesh.apply_material(DBItems.data[item_id].material_texture)
block_mesh.apply_material(current_item.material_texture)
func _on_game_options_held_block_ui_changed(toggled: bool) -> void: func _on_game_options_held_block_ui_changed(toggled: bool) -> void:
@ -145,8 +153,8 @@ func _on_game_options_held_block_ui_changed(toggled: bool) -> void:
func _on_graphics_fov_changed(fov: int) -> void: func _on_graphics_fov_changed(fov: int) -> void:
camera.fov = fov camera.fov = fov
func _on_quick_slot_item_changed(item_id: String) -> void:
_update_held_block_mesh(item_id)
func _on_quick_slot_selected(_slot_index: int) -> void:
_update_held_block_mesh()
func _on_open_pause_menu() -> void: func _on_open_pause_menu() -> void:
block_mesh.visible = false block_mesh.visible = false
@ -154,6 +162,14 @@ func _on_open_pause_menu() -> void:
func _on_resume_game() -> void: func _on_resume_game() -> void:
block_mesh.visible = GameSettingsManager.settings.game_options.enable_held_block block_mesh.visible = GameSettingsManager.settings.game_options.enable_held_block
func _on_add_to_inventory(_item_id: String, _amount: int) -> void:
_update_held_block_mesh()
func _on_item_picked_up(_item: DBItemResource) -> void:
_update_held_block_mesh()
func _on_remove_from_inventory(_item_id: String, _amount: int) -> void:
_update_held_block_mesh()
func _on_hide_ui() -> void: func _on_hide_ui() -> void:
block_mesh.visible = false block_mesh.visible = false


+ 1
- 1
scenes/player/player.tscn View File

@ -35,7 +35,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.8, 0)
[node name="Camera3D" type="Camera3D" parent="Head"] [node name="Camera3D" type="Camera3D" parent="Head"]
[node name="BlockMesh" parent="Head/Camera3D" instance=ExtResource("2_p47bc")] [node name="BlockMesh" parent="Head/Camera3D" instance=ExtResource("2_p47bc")]
transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 0, -0.680035, -1.7196)
transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 1.15474, -0.680035, -1.35803)
[node name="RayCastLook" type="RayCast3D" parent="Head" node_paths=PackedStringArray("player")] [node name="RayCastLook" type="RayCast3D" parent="Head" node_paths=PackedStringArray("player")]
target_position = Vector3(0, 0, -10) target_position = Vector3(0, 0, -10)


+ 1
- 1
scenes/player/ray_cast_look.gd View File

@ -17,7 +17,7 @@ func _process(_delta: float) -> void:
if !is_valid_placement_target(block_pos): if !is_valid_placement_target(block_pos):
return return
EntityManager.create_block.emit(InventoryManager.quick_slot_item_id, block_pos)
EntityManager.create_block.emit(InventoryManager.get_quick_slot_item_id(), block_pos)
if Waila.ref.get_target() == collider: if Waila.ref.get_target() == collider:
return return


+ 39
- 0
scenes/ui/inventory/quickslots_slot.gd View File

@ -0,0 +1,39 @@
class_name QuickSlotsSlot
extends Panel
@export var amount_label: Label
@export var slot_texture: TextureRect
var slot_index: int = 0
func _ready() -> void:
InventoryManager.inventory_slot_updated.connect(_on_inventory_slot_updated)
func init(_slot_index: int) -> void:
slot_index = _slot_index
refresh()
func clear() -> void:
slot_texture.texture = null
amount_label.text = ""
slot_texture.tooltip_text = ""
func refresh() -> void:
if InventoryManager.inventory.size() < 1:
return clear()
elif not InventoryManager.inventory.get(slot_index):
return clear()
elif InventoryManager.inventory[slot_index] == null:
return clear()
slot_texture.texture = load(InventoryManager.inventory[slot_index].item_texture)
amount_label.text = "x" + str(InventoryManager.inventory[slot_index].amount)
slot_texture.tooltip_text = InventoryManager.inventory[slot_index].name + "\n" + InventoryManager.inventory[slot_index].description
func _on_inventory_slot_updated(_slot_index: int) -> void:
if _slot_index != slot_index: return
refresh()

+ 1
- 0
scenes/ui/inventory/quickslots_slot.gd.uid View File

@ -0,0 +1 @@
uid://cq3yb4beq5f4s

+ 36
- 0
scenes/ui/inventory/quickslots_slot.tscn View File

@ -0,0 +1,36 @@
[gd_scene load_steps=3 format=3 uid="uid://c40k8ey6e54v1"]
[ext_resource type="Script" uid="uid://cq3yb4beq5f4s" path="res://scenes/ui/inventory/quickslots_slot.gd" id="1_l6jhe"]
[sub_resource type="LabelSettings" id="LabelSettings_7oxdy"]
outline_size = 3
outline_color = Color(0, 0, 0, 1)
[node name="Slot" type="Panel" node_paths=PackedStringArray("amount_label", "slot_texture")]
custom_minimum_size = Vector2(64, 64)
script = ExtResource("1_l6jhe")
amount_label = NodePath("MarginContainer/AmountLabel")
slot_texture = NodePath("MarginContainer/TextureRect")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="TextureRect" type="TextureRect" parent="MarginContainer"]
texture_filter = 1
layout_mode = 2
expand_mode = 2
[node name="AmountLabel" type="Label" parent="MarginContainer"]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 8
label_settings = SubResource("LabelSettings_7oxdy")

+ 27
- 21
scenes/ui/quick_slots.gd View File

@ -3,28 +3,29 @@ extends Node
@export var highlight_theme: Resource @export var highlight_theme: Resource
@export var slots_container: GridContainer
@export var quickslots_slot: PackedScene
@onready var slots_container: GridContainer = $GridContainer
var _items: Array[String] = ["001", "005", "002", "003", "004", "006"]
var _previous_selected_item: int = 0 var _previous_selected_item: int = 0
var _selected_item: int = 0 : var _selected_item: int = 0 :
set(new_item_index): set(new_item_index):
if new_item_index < 0: if new_item_index < 0:
new_item_index = _items.size() - 1
elif new_item_index >= _items.size():
new_item_index = InventoryManager.quick_slot_count - 1
elif new_item_index >= InventoryManager.quick_slot_count:
new_item_index = 0 new_item_index = 0
_previous_selected_item = _selected_item _previous_selected_item = _selected_item
_selected_item = new_item_index _selected_item = new_item_index
func _init() -> void: func _init() -> void:
InventoryManager.next_quick_slot.connect(select_next_item) InventoryManager.next_quick_slot.connect(select_next_item)
InventoryManager.previous_quick_slot.connect(select_previous_item) InventoryManager.previous_quick_slot.connect(select_previous_item)
InventoryManager.select_quick_slot.connect(select_quick_slot) InventoryManager.select_quick_slot.connect(select_quick_slot)
func _ready() -> void: func _ready() -> void:
var current_slot: Panel = slots_container.get_child(_selected_item)
current_slot.set("theme_override_styles/panel", highlight_theme)
clear_slots()
generate_quick_slots()
update_highlighted_slot()
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("quickslot1"): if event.is_action_pressed("quickslot1"):
@ -53,26 +54,31 @@ func _unhandled_input(event: InputEvent) -> void:
select_previous_item() select_previous_item()
func get_quickslot_index() -> int:
return _selected_item
func clear_slots() -> void:
for slot: QuickSlotsSlot in slots_container.get_children():
slot.queue_free()
func get_selected_item() -> String:
return _items[_selected_item]
func select_quick_slot(slot_index: int) -> void:
_selected_item = slot_index
update_highlighted_slot()
InventoryManager.quick_slot_item_changed.emit(get_selected_item())
func generate_quick_slots() -> void:
for slot_index: int in range(InventoryManager.quick_slot_count):
var slot: QuickSlotsSlot = quickslots_slot.instantiate()
slots_container.add_child(slot)
slot.init(slot_index)
func select_previous_item() -> void: func select_previous_item() -> void:
select_quick_slot(_selected_item + 1)
select_quick_slot(_selected_item - 1)
func select_next_item() -> void: func select_next_item() -> void:
select_quick_slot(_selected_item - 1)
select_quick_slot(_selected_item + 1)
func select_quick_slot(slot_index: int) -> void:
_selected_item = slot_index
InventoryManager.quick_slot_selected.emit(slot_index)
update_highlighted_slot()
func update_highlighted_slot() -> void: func update_highlighted_slot() -> void:
var previous_slot: Panel = slots_container.get_child(_previous_selected_item)
var current_slot: Panel = slots_container.get_child(_selected_item)
if _previous_selected_item != _selected_item:
var previous_slot: Panel = slots_container.get_child(_previous_selected_item)
previous_slot.set("theme_override_styles/panel", null)
previous_slot.set("theme_override_styles/panel", null)
var current_slot: Panel = slots_container.get_child(_selected_item)
current_slot.set("theme_override_styles/panel", highlight_theme) current_slot.set("theme_override_styles/panel", highlight_theme)

+ 29
- 123
scenes/ui/quick_slots.tscn View File

@ -1,157 +1,63 @@
[gd_scene load_steps=9 format=3 uid="uid://cbiygbgpfk220"]
[gd_scene load_steps=4 format=3 uid="uid://cbiygbgpfk220"]
[ext_resource type="Script" uid="uid://bcq6vexsmyeol" path="res://scenes/ui/quick_slots.gd" id="1_cqw2g"] [ext_resource type="Script" uid="uid://bcq6vexsmyeol" path="res://scenes/ui/quick_slots.gd" id="1_cqw2g"]
[ext_resource type="Texture2D" uid="uid://li36txj7oweq" path="res://assets/textures/dirt.png" id="2_kotkb"]
[ext_resource type="StyleBox" uid="uid://dlaswvta2mvim" path="res://resources/inventory/quickslot-panel-highlight-stylebox.tres" id="2_ps55n"] [ext_resource type="StyleBox" uid="uid://dlaswvta2mvim" path="res://resources/inventory/quickslot-panel-highlight-stylebox.tres" id="2_ps55n"]
[ext_resource type="Texture2D" uid="uid://ct1iawpfkdf5l" path="res://assets/textures/stone.png" id="3_cqw2g"]
[ext_resource type="Texture2D" uid="uid://bgo4mb3atmbot" path="res://assets/textures/grass.png" id="3_yyyxx"]
[ext_resource type="Texture2D" uid="uid://0mw651622h01" path="res://assets/textures/wood.png" id="4_yyyxx"]
[ext_resource type="Texture2D" uid="uid://goygbpyqhych" path="res://assets/textures/leaves.png" id="5_ps55n"]
[ext_resource type="Texture2D" uid="uid://cpllegyqnfnrh" path="res://assets/textures/glass.png" id="8_bup65"]
[ext_resource type="PackedScene" uid="uid://c40k8ey6e54v1" path="res://scenes/ui/inventory/quickslots_slot.tscn" id="3_bup65"]
[node name="QuickSlots" type="MarginContainer"]
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_top = -220.0
offset_right = 80.0
offset_bottom = 220.0
grow_vertical = 2
size_flags_horizontal = 0
[node name="QuickSlots" type="MarginContainer" node_paths=PackedStringArray("slots_container")]
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -364.0
offset_top = -80.0
offset_right = 364.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_left = 8 theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8 theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8 theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8 theme_override_constants/margin_bottom = 8
script = ExtResource("1_cqw2g") script = ExtResource("1_cqw2g")
highlight_theme = ExtResource("2_ps55n") highlight_theme = ExtResource("2_ps55n")
slots_container = NodePath("SlotsContainer")
quickslots_slot = ExtResource("3_bup65")
[node name="GridContainer" type="GridContainer" parent="."]
[node name="SlotsContainer" type="GridContainer" parent="."]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_constants/h_separation = 8 theme_override_constants/h_separation = 8
theme_override_constants/v_separation = 8 theme_override_constants/v_separation = 8
columns = 10
[node name="Slot0" type="Panel" parent="GridContainer"]
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="GridContainer/Slot0"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="TextureRect" type="TextureRect" parent="GridContainer/Slot0/MarginContainer"]
texture_filter = 1
layout_mode = 2
texture = ExtResource("2_kotkb")
[node name="Slot1" type="Panel" parent="GridContainer"]
custom_minimum_size = Vector2(64, 64)
[node name="Slot0" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="GridContainer/Slot1"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="TextureRect" type="TextureRect" parent="GridContainer/Slot1/MarginContainer"]
texture_filter = 1
[node name="Slot1" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
texture = ExtResource("3_yyyxx")
[node name="Slot3" type="Panel" parent="GridContainer"]
custom_minimum_size = Vector2(64, 64)
[node name="Slot2" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="GridContainer/Slot3"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="TextureRect" type="TextureRect" parent="GridContainer/Slot3/MarginContainer"]
texture_filter = 1
[node name="Slot3" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
texture = ExtResource("3_cqw2g")
[node name="Slot4" type="Panel" parent="GridContainer"]
custom_minimum_size = Vector2(64, 64)
[node name="Slot4" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="GridContainer/Slot4"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="TextureRect" type="TextureRect" parent="GridContainer/Slot4/MarginContainer"]
texture_filter = 1
[node name="Slot5" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
texture = ExtResource("4_yyyxx")
[node name="Slot5" type="Panel" parent="GridContainer"]
custom_minimum_size = Vector2(64, 64)
[node name="Slot6" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="GridContainer/Slot5"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="TextureRect" type="TextureRect" parent="GridContainer/Slot5/MarginContainer"]
texture_filter = 1
[node name="Slot7" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
texture = ExtResource("5_ps55n")
[node name="Slot6" type="Panel" parent="GridContainer"]
custom_minimum_size = Vector2(64, 64)
[node name="Slot8" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="GridContainer/Slot6"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="TextureRect" type="TextureRect" parent="GridContainer/Slot6/MarginContainer"]
texture_filter = 1
[node name="Slot9" parent="SlotsContainer" instance=ExtResource("3_bup65")]
layout_mode = 2 layout_mode = 2
texture = ExtResource("8_bup65")

+ 5
- 1
scenes/ui/ui.tscn View File

@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://c7fj7wla8bd70"]
[gd_scene load_steps=7 format=3 uid="uid://c7fj7wla8bd70"]
[ext_resource type="Script" uid="uid://bslimr2y4lnvq" path="res://scenes/ui/ui.gd" id="1_aac20"] [ext_resource type="Script" uid="uid://bslimr2y4lnvq" path="res://scenes/ui/ui.gd" id="1_aac20"]
[ext_resource type="PackedScene" uid="uid://dvogu3djluqsn" path="res://scenes/ui/waila.tscn" id="1_u7n8c"] [ext_resource type="PackedScene" uid="uid://dvogu3djluqsn" path="res://scenes/ui/waila.tscn" id="1_u7n8c"]
[ext_resource type="PackedScene" uid="uid://cbiygbgpfk220" path="res://scenes/ui/quick_slots.tscn" id="4_g5kmx"] [ext_resource type="PackedScene" uid="uid://cbiygbgpfk220" path="res://scenes/ui/quick_slots.tscn" id="4_g5kmx"]
[ext_resource type="PackedScene" uid="uid://by0gd600mbcr5" path="res://scenes/ui/pause_menu/pause_menu.tscn" id="5_0dwhk"] [ext_resource type="PackedScene" uid="uid://by0gd600mbcr5" path="res://scenes/ui/pause_menu/pause_menu.tscn" id="5_0dwhk"]
[ext_resource type="PackedScene" uid="uid://dcr25y1lw4wjp" path="res://scenes/ui/inventory/inventory.tscn" id="6_pfayw"]
[ext_resource type="PackedScene" uid="uid://rfknvv8b0d4i" path="res://scenes/ui/autosave_notification.tscn" id="7_jcn1r"] [ext_resource type="PackedScene" uid="uid://rfknvv8b0d4i" path="res://scenes/ui/autosave_notification.tscn" id="7_jcn1r"]
[node name="UI" type="CanvasLayer"] [node name="UI" type="CanvasLayer"]
@ -35,3 +36,6 @@ visible = false
[node name="PauseMenu" parent="." instance=ExtResource("5_0dwhk")] [node name="PauseMenu" parent="." instance=ExtResource("5_0dwhk")]
visible = false visible = false
[node name="Inventory" parent="." instance=ExtResource("6_pfayw")]
visible = false

Loading…
Cancel
Save