Author | SHA1 | Message | Date |
---|---|---|---|
|
796b623f89 | chore: Bump version 0.1.2 -> 0.2.0 | 3 weeks ago |
|
207932d643 |
Inventory and Quickslots Rework (#24)
* Rework InventoryManager and UI * Tie Quickslots into InventoryManager * Moved Quickslots UI to bottom of screen * Repositioned held block visual * Updated placing and throwing blocks to utilize inventory and quickslots Co-Authored-By: Ryan Reed <ryanreed@noreply.gitea.ryanreed.net> Co-Committed-By: Ryan Reed <ryanreed@noreply.gitea.ryanreed.net> |
3 weeks ago |
@ -1,20 +1,197 @@ | |||||
extends Node | extends Node | ||||
signal item_dropped(item: DBItemResource) | |||||
signal item_picked_up(item: DBItemResource) | |||||
#region Inventory Specific | |||||
signal add_to_inventory(item_id: String, amount: int) | |||||
signal clear_inventory ## Remove all items in inventory | |||||
signal item_added(item_id: String, amount: int) | |||||
signal item_removed(item_id: String, amount: int) | |||||
signal inventory_closed | |||||
signal inventory_opened | |||||
signal inventory_slot_updated(slot_index: int) | |||||
signal remove_from_inventory(item_id: String, amount: int) | |||||
signal remove_from_quickslot(amount: int) | |||||
signal remove_from_slot(slot_index: int, amount: int) | |||||
#endregion | |||||
#region Quickslots | |||||
signal next_quick_slot | signal next_quick_slot | ||||
signal previous_quick_slot | signal previous_quick_slot | ||||
signal quick_slot_selected(slot_index: int) | |||||
signal select_quick_slot(slot_index: int) | signal select_quick_slot(slot_index: int) | ||||
signal quick_slot_item_changed(item_id: String) | |||||
signal item_picked_up(item: DBItemResource) | |||||
signal item_dropped(item: DBItemResource) | |||||
signal inventory_opened | |||||
signal inventory_closed | |||||
#endregion | |||||
var quick_slot_item_id: String = "001" | |||||
var max_inventory_items: int = 40 # 4 rows of 10 | |||||
var quick_slot_count: int = 10 | |||||
var selected_quick_slot: int = 0 | |||||
var inventory: Array[DBItemResource] = [] ## To ensure inventory is automatically sorted, "empty" inventory cells will be replaced with null to keep positions | |||||
var _inventory_cache: Dictionary[String, Dictionary] = {} ## Used for caching certain information | |||||
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_dropped.connect(_on_item_dropped) | |||||
self.add_to_inventory.connect(_on_add_to_inventory) | |||||
self.clear_inventory.connect(_on_clear_inventory) | |||||
self.quick_slot_selected.connect(_on_quick_slot_selected) | |||||
self.remove_from_inventory.connect(_on_remove_from_inventory) | |||||
self.remove_from_quickslot.connect(_on_remove_from_quickslot) | |||||
self.remove_from_slot.connect(_on_remove_from_slot) | |||||
func available_space(item_id: String) -> int: | |||||
var full_stacks: int = floor(_inventory_cache[item_id].total / DBItems.data[item_id].max_stack_size) | |||||
var space_in_stacks: int = ( | |||||
DBItems.data[item_id].max_stack_size - abs( | |||||
_inventory_cache[item_id].total - (DBItems.data[item_id].max_stack_size * full_stacks) | |||||
) | |||||
) | |||||
# This is a bit of a hack because I'm a math/logic noob | |||||
if space_in_stacks == DBItems.data[item_id].max_stack_size: | |||||
space_in_stacks = 0 | |||||
var open_stack_amount: int = (max_inventory_items - inventory.size()) * DBItems.data[item_id].max_stack_size | |||||
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: | |||||
return item_resource != null and item_resource.id == item_id | |||||
## Find the stack where at least one item can be added | |||||
func _find_stacks_with_space(item_resource: DBItemResource, item_id: String) -> bool: | |||||
return ( | |||||
item_resource == null or ( | |||||
item_resource.id == item_id and | |||||
item_resource.amount < item_resource.max_stack_size | |||||
) | |||||
) | |||||
## Removes an amount of items from a specific slot | |||||
## If the amount exceeds the amount of the slot, will NOT remove from other stacks | |||||
func _remove_from_slot(slot_index: int, amount: int) -> void: | |||||
if slot_index >= max_inventory_items: | |||||
printerr("Slot Index ", slot_index, " out of inventory range") | |||||
return | |||||
inventory[slot_index].amount -= amount | |||||
if inventory[slot_index].amount <= 0: | |||||
inventory[slot_index] = null | |||||
inventory_slot_updated.emit(slot_index) | |||||
func _update_cache_total(item_id: String, amount: int) -> void: | |||||
if not _inventory_cache.get(item_id): | |||||
_inventory_cache[item_id] = {"total": 0} | |||||
_inventory_cache[item_id].total += amount | |||||
func _on_add_to_inventory(item_id: String, amount: int = 1) -> void: | |||||
if not DBItems.data.get(item_id): | |||||
printerr("Cannot add item, ", item_id, ", to inventory. Could not find item within DBItems.data.") | |||||
return | |||||
if amount < 1: | |||||
printerr("Cannot add item, ", item_id, ", to inventory. Amount to add cannot be less then 1.") | |||||
return | |||||
var item_resource: DBItemResource = DBItems.data[item_id] | |||||
# This logic seems overly complicated and is a mess. | |||||
# Should look into fixing/simplifying this in the future | |||||
var amount_remaining: int = amount | |||||
while amount_remaining > 0: | |||||
var first_stack_index: int = inventory.find_custom(_find_stacks_with_space.bind(item_id)) | |||||
var stack_resource: DBItemResource | |||||
if first_stack_index == -1 and inventory.size() < max_inventory_items: # No existing stack and empty slots available | |||||
stack_resource = item_resource.duplicate() | |||||
inventory.append(stack_resource) | |||||
if amount_remaining <= stack_resource.max_stack_size: | |||||
_update_cache_total(item_id, amount_remaining) | |||||
inventory[-1].amount += amount_remaining | |||||
amount_remaining = 0 | |||||
else: | |||||
_update_cache_total(item_id, stack_resource.max_stack_size) | |||||
inventory[-1].amount = stack_resource.max_stack_size | |||||
amount_remaining -= stack_resource.max_stack_size | |||||
inventory_slot_updated.emit(inventory.size() - 1) | |||||
elif first_stack_index > -1: | |||||
if inventory[first_stack_index] == null: # Empty slot | |||||
inventory[first_stack_index] = item_resource.duplicate() | |||||
stack_resource = inventory[first_stack_index] | |||||
var current_amount: int = stack_resource.amount | |||||
var total_amount: int = current_amount + amount_remaining | |||||
if total_amount < stack_resource.max_stack_size: # Stack not full and has space | |||||
_update_cache_total(item_id, amount_remaining) | |||||
inventory[first_stack_index].amount = total_amount | |||||
amount_remaining = 0 | |||||
else: | |||||
_update_cache_total(item_id, stack_resource.max_stack_size - current_amount) | |||||
inventory[first_stack_index].amount = 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) | |||||
func _on_remove_from_inventory(item_id: String, amount: int = 1) -> void: | |||||
var amount_remaining: int = amount | |||||
while amount_remaining > 0: | |||||
var last_stack_index: int = inventory.rfind_custom(_find_stacks_by_id.bind(item_id)) | |||||
if last_stack_index > -1: | |||||
var stack_resource: DBItemResource = inventory[last_stack_index] | |||||
var current_stack_amount: int = stack_resource.amount | |||||
var total_amount: int = current_stack_amount - amount_remaining | |||||
if total_amount > 0: # Stack will not be empty after removing | |||||
_update_cache_total(item_id, -amount_remaining) | |||||
inventory[last_stack_index].amount -= amount_remaining | |||||
amount_remaining = 0 | |||||
else: | |||||
var to_remove: int = stack_resource.max_stack_size - current_stack_amount | |||||
_update_cache_total(item_id, -amount_remaining) | |||||
inventory[last_stack_index] = null | |||||
amount_remaining -= to_remove | |||||
inventory_slot_updated.emit(last_stack_index) | |||||
else: # Received more to remove than we have stacks for | |||||
amount_remaining = 0 | |||||
item_removed.emit(item_id, amount - amount_remaining) | |||||
func _on_clear_inventory() -> void: | |||||
inventory.clear() | |||||
_inventory_cache.clear() | |||||
func _on_item_dropped(item: DBItemResource) -> void: | |||||
_on_remove_from_inventory(item.id, 1) | |||||
func _on_item_picked_up(item: DBItemResource) -> void: | |||||
_on_add_to_inventory(item.id, 1) | |||||
func _on_quick_slot_selected(slot_index: int) -> void: | |||||
selected_quick_slot = slot_index | |||||
func _on_remove_from_slot(slot_index: int, amount: int) -> void: | |||||
_remove_from_slot(slot_index, amount) | |||||
func _on_quick_slot_item_changed(item_id: String) -> void: | |||||
quick_slot_item_id = item_id | |||||
func _on_remove_from_quickslot(amount: int) -> void: | |||||
_remove_from_slot(selected_quick_slot, amount) |
@ -0,0 +1,5 @@ | |||||
class_name ItemResource | |||||
extends DBItemResource | |||||
@export var resource_scene: PackedScene = null |
@ -0,0 +1 @@ | |||||
uid://m32ytcig5ha5 |
@ -0,0 +1,14 @@ | |||||
[gd_resource type="Resource" script_class="ItemResource" load_steps=3 format=3 uid="uid://dqkdgxdjb8sk5"] | |||||
[ext_resource type="PackedScene" uid="uid://ccky0w7brcf1l" path="res://scenes/items/torch.tscn" id="1_7h82o"] | |||||
[ext_resource type="Script" uid="uid://m32ytcig5ha5" path="res://resources/item_resource.gd" id="2_e6rfx"] | |||||
[resource] | |||||
script = ExtResource("2_e6rfx") | |||||
resource_scene = ExtResource("1_7h82o") | |||||
id = "007" | |||||
name = "Torch" | |||||
amount = 1 | |||||
description = "A torch to light the way" | |||||
item_texture = "uid://dknv7amroftm8" | |||||
metadata/_custom_type_script = "uid://m32ytcig5ha5" |
@ -0,0 +1,23 @@ | |||||
[gd_scene load_steps=4 format=3 uid="uid://ccky0w7brcf1l"] | |||||
[sub_resource type="BoxMesh" id="BoxMesh_ctvck"] | |||||
size = Vector3(0.1, 0.1, 0.1) | |||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ctvck"] | |||||
emission_enabled = true | |||||
emission = Color(0.846334, 0.776792, 0.275847, 1) | |||||
emission_energy_multiplier = 8.23 | |||||
[sub_resource type="BoxMesh" id="BoxMesh_vkm4o"] | |||||
size = Vector3(0.1, 0.4, 0.1) | |||||
[node name="Torch" type="Node3D"] | |||||
[node name="Head" type="MeshInstance3D" parent="."] | |||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.449571, 0) | |||||
mesh = SubResource("BoxMesh_ctvck") | |||||
surface_material_override/0 = SubResource("StandardMaterial3D_ctvck") | |||||
[node name="Base" type="MeshInstance3D" parent="."] | |||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.19988, 0) | |||||
mesh = SubResource("BoxMesh_vkm4o") |
@ -1,157 +0,0 @@ | |||||
[gd_scene load_steps=9 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="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="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"] | |||||
[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 | |||||
theme_override_constants/margin_left = 8 | |||||
theme_override_constants/margin_top = 8 | |||||
theme_override_constants/margin_right = 8 | |||||
theme_override_constants/margin_bottom = 8 | |||||
script = ExtResource("1_cqw2g") | |||||
highlight_theme = ExtResource("2_ps55n") | |||||
[node name="GridContainer" type="GridContainer" parent="."] | |||||
layout_mode = 2 | |||||
theme_override_constants/h_separation = 8 | |||||
theme_override_constants/v_separation = 8 | |||||
[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) | |||||
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 | |||||
layout_mode = 2 | |||||
texture = ExtResource("3_yyyxx") | |||||
[node name="Slot3" type="Panel" parent="GridContainer"] | |||||
custom_minimum_size = Vector2(64, 64) | |||||
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 | |||||
layout_mode = 2 | |||||
texture = ExtResource("3_cqw2g") | |||||
[node name="Slot4" type="Panel" parent="GridContainer"] | |||||
custom_minimum_size = Vector2(64, 64) | |||||
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 | |||||
layout_mode = 2 | |||||
texture = ExtResource("4_yyyxx") | |||||
[node name="Slot5" type="Panel" parent="GridContainer"] | |||||
custom_minimum_size = Vector2(64, 64) | |||||
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 | |||||
layout_mode = 2 | |||||
texture = ExtResource("5_ps55n") | |||||
[node name="Slot6" type="Panel" parent="GridContainer"] | |||||
custom_minimum_size = Vector2(64, 64) | |||||
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 | |||||
layout_mode = 2 | |||||
texture = ExtResource("8_bup65") |
@ -0,0 +1,63 @@ | |||||
[gd_scene load_steps=4 format=3 uid="uid://cbiygbgpfk220"] | |||||
[ext_resource type="Script" uid="uid://bcq6vexsmyeol" path="res://scenes/ui/quickslots/quick_slots.gd" id="1_cqw2g"] | |||||
[ext_resource type="StyleBox" uid="uid://dlaswvta2mvim" path="res://resources/inventory/quickslot-panel-highlight-stylebox.tres" id="2_ps55n"] | |||||
[ext_resource type="PackedScene" uid="uid://c40k8ey6e54v1" path="res://scenes/ui/quickslots/quickslots_slot.tscn" id="3_bup65"] | |||||
[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_top = 8 | |||||
theme_override_constants/margin_right = 8 | |||||
theme_override_constants/margin_bottom = 8 | |||||
script = ExtResource("1_cqw2g") | |||||
highlight_theme = ExtResource("2_ps55n") | |||||
slots_container = NodePath("SlotsContainer") | |||||
quickslots_slot = ExtResource("3_bup65") | |||||
[node name="SlotsContainer" type="GridContainer" parent="."] | |||||
layout_mode = 2 | |||||
size_flags_horizontal = 4 | |||||
size_flags_vertical = 4 | |||||
theme_override_constants/h_separation = 8 | |||||
theme_override_constants/v_separation = 8 | |||||
columns = 10 | |||||
[node name="Slot0" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 | |||||
[node name="Slot1" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 | |||||
[node name="Slot2" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 | |||||
[node name="Slot3" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 | |||||
[node name="Slot4" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 | |||||
[node name="Slot5" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 | |||||
[node name="Slot6" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 | |||||
[node name="Slot7" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 | |||||
[node name="Slot8" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 | |||||
[node name="Slot9" parent="SlotsContainer" instance=ExtResource("3_bup65")] | |||||
layout_mode = 2 |
@ -0,0 +1,40 @@ | |||||
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() |
@ -0,0 +1 @@ | |||||
uid://cq3yb4beq5f4s |
@ -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/quickslots/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") |