Compare commits

...

14 Commits

Author SHA1 Message Date
kziolkowski c200098f0c WIP reworking the field behaviour to implement watering. Broken state. 2025-04-14 00:08:19 +02:00
kziolkowski 0e775309fb Scene changes 2025-04-13 15:01:49 +02:00
kziolkowski 5db71adf03 Fields spawn on a grid 2025-04-13 14:56:25 +02:00
kziolkowski ce5d2b65d3 Separated farming controls from vesna behvaiour and adjusted the setup 2025-04-13 14:35:14 +02:00
kziolkowski 6016f1cf38 Removed Debug.Log 2025-04-09 18:18:19 +02:00
kziolkowski b5dcad5614 Vesna walking and idle animations work for all movement directions. 2025-04-09 18:14:05 +02:00
cblech 64f039ba19 Removed Lock files 2025-04-07 22:19:38 +02:00
cblech 8c1822557c Added Inventory into babushka farming scene 2025-04-07 19:59:55 +02:00
cblech dacf48b9fd Merge remote-tracking branch 'origin/c_sharp_setup' into inventory 2025-04-07 18:44:38 +02:00
cblech daa53e4aef Added slot select 2025-04-07 18:43:56 +02:00
cblech 77591425cb removed unused slots script 2025-04-07 02:56:08 +02:00
cblech 667ef6fb9b Added open close inventory 2025-04-07 02:52:57 +02:00
cblech c90687939c Move items 2025-04-07 02:11:08 +02:00
cblech 959ab68b4d Added basic inventory system 2025-03-25 19:39:06 +01:00
45 changed files with 1008 additions and 55 deletions
+3 -1
View File
@@ -1,7 +1,9 @@
# Godot 4+ specific ignores
.godot/
/android/
/builds/
# temporary files
**/*.tmp
**/*.translation
**/*.translation
**/*~lock~
@@ -3,25 +3,27 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://c3gm7cog1gjrf"
path="res://.godot/imported/house_prototypelayout.png-3dc0e35913507541b740c33ed9c45e44.ctex"
path.s3tc="res://.godot/imported/house_prototypelayout.png-3dc0e35913507541b740c33ed9c45e44.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={}
[deps]
source_file="res://art/mockups/3d/textures/house_prototypelayout.png"
dest_files=["res://.godot/imported/house_prototypelayout.png-3dc0e35913507541b740c33ed9c45e44.ctex"]
dest_files=["res://.godot/imported/house_prototypelayout.png-3dc0e35913507541b740c33ed9c45e44.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
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/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@@ -31,4 +33,4 @@ 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
detect_3d/compress_to=0
+69
View File
@@ -0,0 +1,69 @@
[preset.0]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="builds/Babushka.exe"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
application/export_d3d12=0
application/d3d12_agility_sdk_multiarch=true
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"
dotnet/include_scripts_content=false
dotnet/include_debug_symbols=true
dotnet/embed_build_outputs=false
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c2dbd0q02x2h"
path="res://.godot/imported/babushka_ui_inventory_slot.png-cd1973aa1d3922af7e3271aeaf56cc88.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/ui/babushka_ui_inventory_slot.png"
dest_files=["res://.godot/imported/babushka_ui_inventory_slot.png-cd1973aa1d3922af7e3271aeaf56cc88.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: 18 KiB

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c7wqla0mbu3np"
path="res://.godot/imported/babushka_ui_tmp_inventory_select.png-b544ba0ded36dd6bd66bd197fb76d424.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/ui/babushka_ui_tmp_inventory_select.png"
dest_files=["res://.godot/imported/babushka_ui_tmp_inventory_select.png-b544ba0ded36dd6bd66bd197fb76d424.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.
+26 -10
View File
@@ -1,11 +1,12 @@
[gd_scene load_steps=302 format=3 uid="uid://dbd1niu3tp8y5"]
[gd_scene load_steps=303 format=3 uid="uid://dbd1niu3tp8y5"]
[ext_resource type="Script" uid="uid://b4ugrget2x6lb" path="res://scripts/CSharp/Common/CharacterControls/Player3D.cs" id="1_3trg2"]
[ext_resource type="Script" uid="uid://bblprbhnbyv77" path="res://scripts/CSharp/Common/CharacterControls/VesnaBehaviour.cs" id="1_pkl5l"]
[ext_resource type="Texture2D" uid="uid://duaideiajsu8r" path="res://art/characters/Vesna/babushka concept art vesna.png" id="2_3trg2"]
[ext_resource type="PackedScene" uid="uid://biwd3jj65qrlh" path="res://prefabs/farming/base_field.tscn" id="2_oq5hi"]
[ext_resource type="Script" uid="uid://r5tahuqvbucy" path="res://scripts/CSharp/Common/Camera/CameraPivot.cs" id="3_3trg2"]
[ext_resource type="Texture2D" uid="uid://c4ggew55w0icj" path="res://art/farm/farming/farmobjekte/harke.png" id="4_kngqo"]
[ext_resource type="Script" uid="uid://b1sscdr4ptec8" path="res://scripts/CSharp/Common/Farming/FarmingControls.cs" id="4_q5t2e"]
[ext_resource type="Texture2D" uid="uid://x8hr8287ff2n" path="res://art/farm/farming/farmobjekte/tools atlas.png" id="5_pkl5l"]
[ext_resource type="Texture2D" uid="uid://dygkh117flcou" path="res://art/animation/vesna/Front/F01-Idle/0001.png" id="7_okmao"]
[ext_resource type="Texture2D" uid="uid://rwqptk0hk53" path="res://art/animation/vesna/Front/F01-Idle/0002.png" id="8_ctpgn"]
[ext_resource type="Texture2D" uid="uid://c5om11bu7mtvh" path="res://art/animation/vesna/Front/F01-Idle/0003.png" id="9_8n7il"]
@@ -1210,11 +1211,9 @@ animations = [{
"speed": 25.0
}]
[node name="Player3d" type="Node3D" node_paths=PackedStringArray("_hoeSprite", "_movingPlayer")]
script = ExtResource("4_q5t2e")
_hoeSprite = NodePath("CharacterBody3D/Farming/Hoe")
_fieldPrefab = ExtResource("2_oq5hi")
_movingPlayer = NodePath("CharacterBody3D")
[node name="Player3d" type="Node3D" node_paths=PackedStringArray("_farmingControls")]
script = ExtResource("1_pkl5l")
_farmingControls = NodePath("FarmingControls")
[node name="CharacterBody3D" type="CharacterBody3D" parent="." node_paths=PackedStringArray("_camera", "_frontSpritesAnimated", "_sideSpritesAnimated", "_backSpritesAnimated")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.000654221, 0.102765, -0.00300497)
@@ -1241,10 +1240,8 @@ region_rect = Rect2(52, 20, 648, 1175)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.119886, 0)
shape = SubResource("CapsuleShape3D_1vdrh")
[node name="CameraPivot2" type="Node3D" parent="CharacterBody3D" node_paths=PackedStringArray("_subPivot")]
[node name="CameraPivot2" type="Node3D" parent="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.159723, 0)
script = ExtResource("3_3trg2")
_subPivot = NodePath("SubPivot")
[node name="SubPivot" type="Node3D" parent="CharacterBody3D/CameraPivot2"]
@@ -1261,6 +1258,15 @@ billboard = 1
render_priority = 51
texture = ExtResource("4_kngqo")
[node name="Watering can" type="Sprite3D" parent="CharacterBody3D/Farming"]
visible = false
pixel_size = 0.002
billboard = 1
render_priority = 51
texture = ExtResource("5_pkl5l")
region_enabled = true
region_rect = Rect2(-2, 1135, 425, 291)
[node name="Front" type="Node3D" parent="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.001, 0.1, 0.003)
@@ -1330,3 +1336,13 @@ render_priority = 50
sprite_frames = SubResource("SpriteFrames_4q8ml")
autoplay = "default"
frame_progress = 0.481133
[node name="FarmingControls" type="Node3D" parent="." node_paths=PackedStringArray("_hoeSprite", "_wateringCanSprite", "_movingPlayer")]
script = ExtResource("4_q5t2e")
_hoeSprite = NodePath("../CharacterBody3D/Farming/Hoe")
_wateringCanSprite = NodePath("../CharacterBody3D/Farming/Watering can")
_fieldPrefab = ExtResource("2_oq5hi")
_movingPlayer = NodePath("../CharacterBody3D")
metadata/_custom_type_script = "uid://b1sscdr4ptec8"
[connection signal="WaterField" from="FarmingControls" to="." method="UseWateringCan"]
+68
View File
@@ -0,0 +1,68 @@
[gd_scene load_steps=5 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://b2jhdxcrhtm2d" path="res://scripts/CSharp/Common/Inventory/InventoryTestScript.cs" id="3_exrk4"]
[ext_resource type="Resource" uid="uid://datee0flk1e84" path="res://resources/items/pickaxe.tres" id="4_5fdxq"]
[ext_resource type="Texture2D" uid="uid://c7wqla0mbu3np" path="res://graphics/ui/babushka_ui_tmp_inventory_select.png" id="4_tiss4"]
[node name="Inventory" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_6wusm")
[node name="SlotsContainer" type="Control" parent="."]
custom_minimum_size = Vector2(500, 0)
layout_mode = 1
anchors_preset = 13
anchor_left = 0.5
anchor_right = 0.5
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Slots" type="GridContainer" parent="SlotsContainer"]
custom_minimum_size = Vector2(1000, 200)
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_bottom = 200.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/h_separation = 0
theme_override_constants/v_separation = 0
columns = 10
[node name="SlotSelectContainer" type="Control" parent="SlotsContainer"]
custom_minimum_size = Vector2(1000, 100)
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
[node name="Selector" type="TextureRect" parent="SlotsContainer/SlotSelectContainer"]
custom_minimum_size = Vector2(100, 100)
layout_mode = 0
offset_left = 1.0
offset_right = 101.0
offset_bottom = 100.0
texture = ExtResource("4_tiss4")
expand_mode = 1
[node name="InventoryTester" type="Node" parent="."]
script = ExtResource("3_exrk4")
_testItemToCreate = ExtResource("4_5fdxq")
[node name="BabushkaUiTmpInventorySelect" type="Sprite2D" parent="."]
position = Vector2(-648, 1020)
texture = ExtResource("4_tiss4")
+44
View File
@@ -0,0 +1,44 @@
[gd_scene load_steps=4 format=3 uid="uid://c0kmdjeqkqrwv"]
[ext_resource type="Script" uid="uid://bh6wcyxh1f0cv" path="res://scripts/CSharp/Common/Inventory/SlotUi.cs" id="1_au0l0"]
[ext_resource type="Texture2D" uid="uid://c2dbd0q02x2h" path="res://graphics/ui/babushka_ui_inventory_slot.png" id="2_7emux"]
[sub_resource type="LabelSettings" id="LabelSettings_7emux"]
font_size = 15
font_color = Color(0.203922, 1, 1, 1)
[node name="Slot" type="Control"]
custom_minimum_size = Vector2(100, 100)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_bottom = 2.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_au0l0")
[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_7emux")
expand_mode = 1
stretch_mode = 5
[node name="NameLabel" type="Label" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "asdf"
label_settings = SubResource("LabelSettings_7emux")
horizontal_alignment = 1
vertical_alignment = 1
[connection signal="gui_input" from="." to="." method="_on_gui_input"]
+1 -1
View File
@@ -19,7 +19,7 @@ _showLabel = false
shape = SubResource("SphereShape3D_u7egi")
[node name="Sprite3D" type="Sprite3D" parent="."]
transform = Transform3D(0.5, 0, 0, 0, -2.18557e-08, -0.5, 0, 0.5, -2.18557e-08, 0, 0, 0)
transform = Transform3D(0.4, 0, 0, 0, -1.74846e-08, -0.4, 0, 0.4, -1.74846e-08, 0, 0, 0)
pixel_size = 0.004
texture = ExtResource("1_2cisk")
script = ExtResource("2_u7egi")
+4 -4
View File
@@ -13,17 +13,17 @@ emission = Color(1, 1, 1, 1)
[node name="SpriteSwitcher" type="Node3D" node_paths=PackedStringArray("_trueSprite", "_falseSprite")]
script = ExtResource("1_scmhv")
_trueSprite = NodePath("Hoe on")
_falseSprite = NodePath("Hoe off")
_trueSprite = NodePath("On Sprite")
_falseSprite = NodePath("Off Sprite")
[node name="Hoe on" type="Sprite3D" parent="."]
[node name="On Sprite" type="Sprite3D" parent="."]
modulate = Color(0, 0.996078, 0, 1)
pixel_size = 0.001
billboard = 1
texture = ExtResource("2_jv400")
region_rect = Rect2(484, 143, 365, 1317)
[node name="Hoe off" type="Sprite3D" parent="."]
[node name="Off Sprite" type="Sprite3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, -8.47033e-22, 0, 8.47033e-22, 1, 0.106585, 0, 0.0173626)
visible = false
modulate = Color(1, 0, 0, 1)
+16
View File
@@ -18,6 +18,7 @@ config/icon="res://icon.svg"
[autoload]
Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd"
InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs"
[dialogic]
@@ -130,6 +131,21 @@ interact={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
]
}
ui_inventory_open_close={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":73,"key_label":0,"unicode":105,"location":0,"echo":false,"script":null)
]
}
ui_inventory_advance={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
ui_inventory_disadvance={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
[internationalization]
+9
View File
@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="ItemResource" load_steps=2 format=3 uid="uid://c7viddcd3kywp"]
[ext_resource type="Script" uid="uid://cbskymrxs6ksu" path="res://scripts/CSharp/Common/Inventory/ItemResource.cs" id="1_t485b"]
[resource]
script = ExtResource("1_t485b")
name = "Axe Deo"
color = Color(0.643898, 0.4587, 0.294335, 1)
metadata/_custom_type_script = "uid://cbskymrxs6ksu"
+9
View File
@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="ItemResource" load_steps=2 format=3 uid="uid://cndd64batns31"]
[ext_resource type="Script" uid="uid://cbskymrxs6ksu" path="res://scripts/CSharp/Common/Inventory/ItemResource.cs" id="1_8k5aa"]
[resource]
script = ExtResource("1_8k5aa")
name = "Buck the Bucket"
color = Color(0.336269, 0.489145, 0.825324, 1)
metadata/_custom_type_script = "uid://cbskymrxs6ksu"
+9
View File
@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="ItemResource" load_steps=2 format=3 uid="uid://c5yg3lx756v4v"]
[ext_resource type="Script" uid="uid://cbskymrxs6ksu" path="res://scripts/CSharp/Common/Inventory/ItemResource.cs" id="1_06nef"]
[resource]
script = ExtResource("1_06nef")
name = "Your Mom"
color = Color(0.751421, 0.329615, 0.570911, 1)
metadata/_custom_type_script = "uid://cbskymrxs6ksu"
+9
View File
@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="ItemResource" load_steps=2 format=3 uid="uid://datee0flk1e84"]
[ext_resource type="Script" uid="uid://cbskymrxs6ksu" path="res://scripts/CSharp/Common/Inventory/ItemResource.cs" id="1_07aya"]
[resource]
script = ExtResource("1_07aya")
name = "Pick Axe"
color = Color(0.589014, 0.823353, 0.998475, 1)
metadata/_custom_type_script = "uid://cbskymrxs6ksu"
+35 -4
View File
@@ -1,9 +1,12 @@
[gd_scene load_steps=9 format=3 uid="uid://br7yq757cawts"]
[gd_scene load_steps=12 format=3 uid="uid://br7yq757cawts"]
[ext_resource type="PackedScene" uid="uid://dbd1niu3tp8y5" path="res://prefabs/Player3D.tscn" id="1_b1ibi"]
[ext_resource type="PackedScene" uid="uid://biwd3jj65qrlh" path="res://prefabs/farming/base_field.tscn" id="2_72r8y"]
[ext_resource type="PackedScene" uid="uid://ob04y3syvo0e" path="res://prefabs/interaction_area.tscn" id="4_r4sre"]
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="5_obfp0"]
[ext_resource type="Texture2D" uid="uid://x8hr8287ff2n" path="res://art/farm/farming/farmobjekte/tools atlas.png" id="5_r4sre"]
[ext_resource type="PackedScene" uid="uid://cf0jpuio8tgim" path="res://prefabs/interactions/sprite_switcher.tscn" id="6_r4sre"]
[ext_resource type="Script" uid="uid://c6hh7m8wikv04" path="res://scripts/CSharp/Common/Farming/FieldService.cs" id="7_0ptl4"]
[sub_resource type="PlaneMesh" id="PlaneMesh_8yprl"]
@@ -33,13 +36,14 @@ shape = SubResource("BoxShape3D_t58di")
[node name="Player3d" parent="." node_paths=PackedStringArray("_fieldParent") instance=ExtResource("1_b1ibi")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.51633, 0.725631, 3.57249)
_fieldParent = NodePath("../FieldParent")
_fieldParent = NodePath("../FieldService")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.618408, 0.785857, 0, -0.785857, 0.618408, -0.802612, 0, 4.73262)
[node name="BaseField" parent="." instance=ExtResource("2_72r8y")]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0.001, 0)
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0.0574723, 0)
visible = false
[node name="HoePickup" parent="." instance=ExtResource("4_r4sre")]
transform = Transform3D(1, 0, 0, 0, 1, -1.06581e-14, 0, 1.06581e-14, 1, -4.327, 1.5, -3.447)
@@ -49,9 +53,36 @@ shape = SubResource("SphereShape3D_0ptl4")
[node name="SpriteSwitcher Hoe" parent="HoePickup" instance=ExtResource("6_r4sre")]
[node name="FieldParent" type="Node3D" parent="."]
[node name="Watering Can Pickup" parent="." instance=ExtResource("4_r4sre")]
transform = Transform3D(1, 0, 0, 0, 1, -1.06581e-14, 0, 1.06581e-14, 1, -2.3908, 1.5, -3.447)
[node name="CollisionShape3D" parent="Watering Can Pickup/Area3D" index="0"]
shape = SubResource("SphereShape3D_0ptl4")
[node name="SpriteSwitcher Hoe" parent="Watering Can Pickup" instance=ExtResource("6_r4sre")]
[node name="On Sprite" parent="Watering Can Pickup/SpriteSwitcher Hoe" index="0"]
texture = ExtResource("5_r4sre")
region_enabled = true
region_rect = Rect2(-3, 1141, 423, 280)
[node name="Off Sprite" parent="Watering Can Pickup/SpriteSwitcher Hoe" index="1"]
texture = ExtResource("5_r4sre")
region_enabled = true
region_rect = Rect2(-3, 1137, 424, 285)
[node name="Inventory" parent="." instance=ExtResource("5_obfp0")]
visible = false
[node name="FieldService" type="Node3D" parent="."]
script = ExtResource("7_0ptl4")
metadata/_custom_type_script = "uid://c6hh7m8wikv04"
[connection signal="Interacted" from="HoePickup" to="HoePickup/SpriteSwitcher Hoe" method="SwitchState"]
[connection signal="Switch" from="HoePickup/SpriteSwitcher Hoe" to="Player3d" method="ActivateHoe"]
[connection signal="Interacted" from="Watering Can Pickup" to="Watering Can Pickup/SpriteSwitcher Hoe" method="SwitchState"]
[connection signal="Switch" from="Watering Can Pickup/SpriteSwitcher Hoe" to="Player3d" method="ActivateWateringCan"]
[editable path="HoePickup"]
[editable path="Watering Can Pickup"]
[editable path="Watering Can Pickup/SpriteSwitcher Hoe"]
@@ -0,0 +1,47 @@
[gd_scene load_steps=3 format=3 uid="uid://mhtcm8daava5"]
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="1_5dyk0"]
[sub_resource type="BoxMesh" id="BoxMesh_5dyk0"]
[node name="BabushkaTestsInventory" type="Node3D"]
[node name="Inventory" parent="." instance=ExtResource("1_5dyk0")]
[node name="MockScene" type="Node3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="MockScene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.52591, 0, 1.26963)
mesh = SubResource("BoxMesh_5dyk0")
skeleton = NodePath("../..")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="MockScene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.48916, 0, -0.762378)
mesh = SubResource("BoxMesh_5dyk0")
skeleton = NodePath("../..")
[node name="MeshInstance3D3" type="MeshInstance3D" parent="MockScene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.58762, -2.38419e-07, -1.76688)
mesh = SubResource("BoxMesh_5dyk0")
skeleton = NodePath("../..")
[node name="MeshInstance3D4" type="MeshInstance3D" parent="MockScene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.59247, -4.76837e-07, -0.0171926)
mesh = SubResource("BoxMesh_5dyk0")
skeleton = NodePath("../..")
[node name="MeshInstance3D5" type="MeshInstance3D" parent="MockScene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.696733, -4.76837e-07, 1.49587)
mesh = SubResource("BoxMesh_5dyk0")
skeleton = NodePath("../..")
[node name="MeshInstance3D6" type="MeshInstance3D" parent="MockScene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.7007, -4.76837e-07, -1.52457)
mesh = SubResource("BoxMesh_5dyk0")
skeleton = NodePath("../..")
[node name="Camera3D" type="Camera3D" parent="MockScene"]
transform = Transform3D(1, 0, 0, 0, 0.633826, 0.773475, 0, -0.773475, 0.633826, -0.833954, 3.04237, 2.8418)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="MockScene"]
transform = Transform3D(0.255314, 0.801032, -0.541445, -0.00609746, 0.561328, 0.827571, 0.966839, -0.207989, 0.148199, -1.99366, 2.88871, 2.87262)
@@ -1,3 +1,4 @@
using System.Diagnostics;
using Godot;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
@@ -17,21 +18,25 @@ public partial class Player3D : CharacterBody3D
[Export] private AnimatedSprite3D[] _backSpritesAnimated;
private bool _sideFlipped;
private Vector2 _lastDirection;
public override void _PhysicsProcess(double delta)
{
var inputDir = Input.GetVector("move_left", "move_right", "move_up", "move_down");
var inputDir = Input.GetVector("move_left", "move_right", "move_down", "move_up");
if (inputDir == Vector2.Zero)
{
if(_lastDirection != Vector2.Zero)
SwitchIdleSprites();
return;
}
MoveOnInput(inputDir, delta);
SwitchSprites(inputDir);
SwitchMovementSprites(inputDir);
}
private void MoveOnInput(Vector2 inputDir, double delta)
{
inputDir = inputDir.Rotated(-_camera.GlobalRotation.Y);
var direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
var direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y * (-1))).Normalized();
if (direction != Vector3.Zero)
Velocity = new Vector3(direction.X * _speed * (float) delta * Scale.X, Velocity.Y, direction.Z * _speed * (float) delta * Scale.Z);
else
@@ -40,20 +45,33 @@ public partial class Player3D : CharacterBody3D
MoveAndSlide();
}
private void SwitchSprites(Vector2 inputDir)
private void SwitchIdleSprites()
{
float X = inputDir.X;
float Y = inputDir.Y;
if (X == 0.0 && Y == 0.0)
if (_lastDirection.X != 0)
{
ActivateFrontSpriteIdle(0, true, false, false);
ActivateSprite(0, false, true, false);
return;
}
if(_lastDirection.Y <= 0.0f)
ActivateSprite(0, true, false, false);
if(_lastDirection.Y > 0.0f)
ActivateSprite(0, false, false, true);
_lastDirection = Vector2.Zero;
}
private void SwitchMovementSprites(Vector2 inputDir)
{
float X = inputDir.X;
float Y = inputDir.Y;
_lastDirection = new Vector2(X, Y);
if (X != 0)
{
ActivateFrontSpriteIdle(1, false, true, false);
ActivateSprite(1, false, true, false);
if (X > 0.0f)
{
@@ -74,20 +92,19 @@ public partial class Player3D : CharacterBody3D
if (Y != 0)
{
if (Y < 0.0f)
{
ActivateFrontSpriteIdle(1, false, false, true);
}
if (Y > 0.0f)
{
ActivateFrontSpriteIdle(0, true, false, false);
ActivateSprite(1, false, false, true);
}
if (Y < 0.0f)
{
ActivateSprite(1, true, false, false);
}
}
}
private void ActivateFrontSpriteIdle(int index, bool frontActive, bool sideActive, bool backActive)
private void ActivateSprite(int index, bool frontActive, bool sideActive, bool backActive)
{
DeactivateAll();
_frontSpritesAnimated[index].Visible = frontActive;
@@ -0,0 +1,46 @@
using Babushka.scripts.CSharp.Common.Farming;
using Godot;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
public partial class VesnaBehaviour : Node
{
[ExportGroup("Farming")]
[Export] private FieldService _fieldParent;
[Export] private FarmingControls _farmingControls;
[Signal] public delegate void ToolPickupEventHandler(bool success);
public override void _Ready()
{
_farmingControls.FieldParent = _fieldParent;
}
#region Farming
public void ActivateHoe(bool activate)
{
ActivateTool(activate, 0);
}
public void ActivateWateringCan(bool activate)
{
ActivateTool(activate, 1);
}
private void ActivateTool(bool activate , int toolId)
{
bool success = false;
if (toolId == 0)
{
success = _farmingControls.ActivateHoe(activate);
}
else if (toolId == 1)
{
success = _farmingControls.ActivateWateringCan(activate);
}
EmitSignal(SignalName.ToolPickup, success);
}
#endregion
}
@@ -1,20 +1,44 @@
using System.Collections.Generic;
using Godot;
namespace Babushka.scripts.CSharp.Common.Farming;
[GlobalClass]
public partial class FarmingControls : Node3D
{
[Export] private Sprite3D _hoeSprite;
[Export] private Sprite3D _wateringCanSprite;
[Export] private PackedScene _fieldPrefab;
[Export] private Node _fieldParent;
[Export] private Node3D _movingPlayer;
public FieldService FieldParent;
private bool _hoeInHand = false;
public void ActivateHoe(bool activate)
private bool _waterCanInHand = false;
#region Tools
public bool ActivateHoe(bool activate)
{
_hoeSprite.Visible = !activate;
_hoeInHand = !activate;
bool success = ActivateTool(activate, _hoeSprite);
_hoeInHand = success;
return success;
}
public bool ActivateWateringCan(bool activate)
{
bool success = ActivateTool(activate, _wateringCanSprite);
_waterCanInHand = success;
return success;
}
private bool ActivateTool(bool activate, Sprite3D tool)
{
tool.Visible = !activate;
return !activate;
}
#endregion
public override void _Input(InputEvent @event)
{
@@ -22,22 +46,41 @@ public partial class FarmingControls : Node3D
{
MakeField();
}
if (@event.IsActionPressed("click") && _waterCanInHand)
{
WaterTheField();
}
}
private void WaterTheField()
{
}
private void MakeField()
{
if(_fieldParent == null || _fieldPrefab == null)
if(FieldParent == null || _fieldPrefab == null)
return;
Node fieldInstance = _fieldPrefab.Instantiate();
if (fieldInstance is Node3D field3d)
{
field3d.Position = _movingPlayer.GlobalPosition;
Vector3 playerPos = _movingPlayer.GlobalPosition;
playerPos = new Vector3(AdjustValue(playerPos.X), 0.1f, AdjustValue(playerPos.Z));
field3d.Position = playerPos;
Vector2I intPosition = new Vector2I((int) playerPos.X, (int) playerPos.Z);
FieldParent.AddEntry(intPosition, FieldState.Tilled);
}
_fieldParent.AddChild(fieldInstance);
FieldParent.AddChild(fieldInstance);
}
private float AdjustValue(float value)
{
return Mathf.Floor(value);
}
}
@@ -13,14 +13,22 @@ public enum FieldState
public partial class FieldBehaviour : Sprite3D
{
[Export] private Texture2D Tilled;
[Export] private Texture3D Watered;
[Export] private Texture2D Watered;
[Export] private FieldState FieldState = FieldState.Empty;
public Vector2 FieldPosition;
public override void _Ready()
{
Texture = Tilled;
base._Ready();
}
public void Water()
{
FieldState = FieldState.Watered;
Texture = Watered;
}
/// <summary>
/// Called when the player enters the field'S interaction area and presses <E>.
@@ -0,0 +1,47 @@
using Godot;
using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.Farming;
[GlobalClass]
public partial class FieldService : Node3D
{
[Export] private Dictionary<Vector2I, FieldState> fields = new Dictionary<Vector2I, FieldState>();
//Create
public void AddEntry(Vector2I key, FieldState state)
{
fields.Add(key, state);
}
// Read
public FieldState Get(Vector2I key)
{
return fields[key];
}
//Update
public void UpdateEntry(Vector2I fieldPosition, FieldState state)
{
if (fields.ContainsKey(fieldPosition))
{
fields[fieldPosition] = state;
}
else
{
AddEntry(fieldPosition, state);
}
}
//Delete
public void RemoveEntry(Vector2I fieldPosition)
{
if (fields.ContainsKey(fieldPosition))
{
fields.Remove(fieldPosition);
}
}
}
@@ -0,0 +1,10 @@
namespace Babushka.scripts.CSharp.Common.Inventory;
public enum InventoryActionResult
{
Success,
DestinationDoesNotExists,
DestinationFull,
SourceDoesNotExists,
SourceIsEmpty
}
@@ -0,0 +1 @@
uid://bxre8ecfx3xx
@@ -0,0 +1,85 @@
#nullable enable
using System;
using Godot;
using System.Collections.Generic;
namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class InventoryInstance : Node
{
private List<InventorySlot> _slots = new();
public IReadOnlyList<InventorySlot> Slots => _slots;
[Signal]
public delegate void SlotAmountChangedEventHandler();
[Signal]
public delegate void InventoryContentsChangedEventHandler();
[Export]
public int SlotAmount
{
get => _slots.Count;
set
{
if (value < _slots.Count)
{
_slots.RemoveRange(value, _slots.Count - value);
}
else if (value > _slots.Count)
{
for (var i = _slots.Count; i < value; i++)
{
_slots.Add(new InventorySlot());
}
}
EmitSignal(SignalName.SlotAmountChanged);
}
}
public InventoryActionResult AddItem(ItemInstance newItem, int inventorySlot = -1)
{
if (inventorySlot < 0)
{
inventorySlot = _slots.FindIndex(slot => slot.IsEmpty());
}
if (inventorySlot < 0 || !_slots[inventorySlot].IsEmpty())
{
return InventoryActionResult.DestinationFull;
}
if (inventorySlot >= _slots.Count)
{
return InventoryActionResult.DestinationDoesNotExists;
}
_slots[inventorySlot].itemInstance = newItem;
EmitSignal(SignalName.InventoryContentsChanged);
return InventoryActionResult.Success;
}
public InventoryActionResult RemoveItem(int inventorySlot, out ItemInstance? itemInstance )
{
if (inventorySlot < 0 || inventorySlot >= _slots.Count)
{
itemInstance = null;
return InventoryActionResult.SourceDoesNotExists;
}
if (_slots[inventorySlot].IsEmpty())
{
itemInstance = null;
return InventoryActionResult.SourceIsEmpty;
}
itemInstance = _slots[inventorySlot].itemInstance;
_slots[inventorySlot].itemInstance = null;
EmitSignal(SignalName.InventoryContentsChanged);
return InventoryActionResult.Success;
}
public InventoryActionResult RemoveItem(int inventorySlot)
{
return RemoveItem(inventorySlot, out _);
}
}
@@ -0,0 +1 @@
uid://36ui8g5gu0lb
@@ -0,0 +1,63 @@
#nullable enable
using Godot;
namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class InventoryManager : Node
{
public static InventoryManager Instance { get; private set; }
public InventoryInstance playerInventory;
public override void _EnterTree()
{
Instance = this;
}
public override void _Ready()
{
playerInventory = new InventoryInstance();
playerInventory.SlotAmount = 30;
}
public InventoryActionResult CreateItem(
ItemResource itemBlueprint,
InventoryInstance inventory,
int inventorySlot = -1)
{
var newItem = new ItemInstance { blueprint = itemBlueprint };
var addResult = inventory.AddItem(newItem, inventorySlot);
return addResult;
}
public InventoryActionResult MoveItem(
InventoryInstance sourceInventory,
int sourceSlot,
InventoryInstance destinationInventory,
int destinationSlot)
{
var remResult = sourceInventory.RemoveItem(sourceSlot, out var item);
if (remResult != InventoryActionResult.Success) return remResult;
var addResult = destinationInventory.AddItem(item!, destinationSlot);
if(addResult == InventoryActionResult.Success) return InventoryActionResult.Success;
sourceInventory.AddItem(item!, sourceSlot); // can not fail ... in theory
return addResult;
}
public InventoryActionResult RemoveItem(
InventoryInstance inventory,
int inventorySlot,
out ItemInstance? itemInstance)
{
return inventory.RemoveItem(inventorySlot, out itemInstance);
}
public InventoryActionResult RemoveItem(
InventoryInstance inventory,
int inventorySlot)
{
return inventory.RemoveItem(inventorySlot);
}
}
@@ -0,0 +1 @@
uid://701bitgfepjc
@@ -0,0 +1,12 @@
#nullable enable
namespace Babushka.scripts.CSharp.Common.Inventory;
public class InventorySlot
{
public ItemInstance? itemInstance;
public bool IsEmpty()
{
return itemInstance == null;
}
}
@@ -0,0 +1 @@
uid://rxaoggm0qxgm
@@ -0,0 +1,17 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class InventoryTestScript : Node
{
[Export]
private ItemResource _testItemToCreate;
public override void _Ready()
{
InventoryManager.Instance.CreateItem(_testItemToCreate, InventoryManager.Instance.playerInventory);
InventoryManager.Instance.CreateItem(_testItemToCreate, InventoryManager.Instance.playerInventory);
InventoryManager.Instance.CreateItem(_testItemToCreate, InventoryManager.Instance.playerInventory);
InventoryManager.Instance.CreateItem(_testItemToCreate, InventoryManager.Instance.playerInventory);
GD.Print("Added items");
}
}
@@ -0,0 +1 @@
uid://b2jhdxcrhtm2d
@@ -0,0 +1 @@
uid://b7vlkecrn0t5c
@@ -0,0 +1,145 @@
#nullable enable
using Godot;
namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class InventoryUi : Control
{
private GridContainer _slots;
private InventoryInstance _playerInventory;
private Control _slotSelect;
private int? _slotOnMouse;
private int _selectedSlot = 0;
private bool _inventoryExtended = false;
private Tween? _inventoryExtensionTween;
public override void _Ready()
{
GD.Print("Ready inventory ui");
_slots = GetNode<GridContainer>("SlotsContainer/Slots");
_playerInventory = InventoryManager.Instance.playerInventory;
_slotSelect = GetNode<Control>("SlotsContainer/SlotSelectContainer/Selector");
PopulateSlots();
SetSlotContent();
SetSlotSelectPosition();
}
public override void _ExitTree()
{
UnsubscribeSlots();
}
private void SetSlotContent()
{
for (var i = 0; i < _playerInventory.Slots.Count; i++)
{
var inventorySlot = _playerInventory.Slots[i];
var uiSlot = _slots.GetChild(i) as SlotUi;
uiSlot!.nameLabel.Text = inventorySlot.itemInstance?.blueprint.name ?? "";
uiSlot!.nameLabel.LabelSettings = uiSlot!.nameLabel.LabelSettings.Duplicate() as LabelSettings;
uiSlot!.nameLabel.LabelSettings!.FontColor = inventorySlot.itemInstance?.blueprint.color ?? Colors.White;
}
}
private void SetSlotSelectPosition()
{
_slotSelect.Position = new Vector2(_selectedSlot * 100, 0);
}
private void PopulateSlots()
{
var slotPackedScene = GD.Load<PackedScene>("res://prefabs/UI/Inventory/Slot.tscn");
for (var index = 0; index < _playerInventory.Slots.Count; index++)
{
var slotInstance = slotPackedScene.Instantiate<SlotUi>();
slotInstance.index = index;
slotInstance.Clicked += SlotClicked;
_slots.AddChild(slotInstance);
}
}
private void UnsubscribeSlots()
{
for (var index = 0; index < _playerInventory.Slots.Count; index++)
{
var slotInstance = _slots.GetChild(index) as SlotUi;
slotInstance!.Clicked -= SlotClicked;
}
}
private void SlotClicked(int index)
{
if (!_inventoryExtended) return;
GD.Print($"Clicked slot {index}");
if (_slotOnMouse == null)
{
if (_playerInventory.Slots[index].IsEmpty()) return;
_slotOnMouse = index;
GD.Print($"Slot on mouse: {_slotOnMouse}");
}
else
{
var sourceSlot = _slotOnMouse.Value;
var destinationSlot = index;
InventoryManager.Instance.MoveItem(_playerInventory, sourceSlot, _playerInventory, destinationSlot);
_slotOnMouse = null;
SetSlotContent();
}
}
public override void _Process(double delta)
{
if (Input.IsActionJustPressed("ui_inventory_open_close"))
{
InputInventoryOpenClose();
}
if (Input.IsActionJustPressed("ui_inventory_disadvance"))
{
_selectedSlot++;
if (_selectedSlot > 9)
_selectedSlot = 0;
SetSlotSelectPosition();
}
if(Input.IsActionJustPressed("ui_inventory_advance"))
{
_selectedSlot--;
if (_selectedSlot < 0)
_selectedSlot = 9;
SetSlotSelectPosition();
}
}
private void InputInventoryOpenClose()
{
_inventoryExtensionTween?.Kill();
_inventoryExtended = !_inventoryExtended;
if (_inventoryExtended)
{
//GD.Print("Open inventory");
_inventoryExtensionTween = GetTree().CreateTween();
_slotSelect.Hide();
_inventoryExtensionTween
.TweenProperty(_slots, "offset_bottom", -100, 0.4)
.SetTrans(Tween.TransitionType.Quad)
.SetEase(Tween.EaseType.Out);
}
else
{
//GD.Print("Close inventory");
_inventoryExtensionTween = GetTree().CreateTween();
_slotSelect.Show();
_inventoryExtensionTween
.TweenProperty(_slots, "offset_bottom", 200, 0.4)
.SetTrans(Tween.TransitionType.Quad)
.SetEase(Tween.EaseType.Out);
_slotOnMouse = null;
}
}
}
@@ -0,0 +1,6 @@
namespace Babushka.scripts.CSharp.Common.Inventory;
public class ItemInstance
{
public ItemResource blueprint;
}
@@ -0,0 +1 @@
uid://be54lnb6gg81f
@@ -0,0 +1,18 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.Inventory;
[GlobalClass]
public partial class ItemResource: Resource
{
[Export]
public string name;
[Export]
public Color color;
public ItemResource()
{
name = "";
color = Colors.Red;
}
}
@@ -0,0 +1 @@
uid://cbskymrxs6ksu
+27
View File
@@ -0,0 +1,27 @@
using Godot;
using System;
namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class SlotUi : Control
{
public Label nameLabel;
public int index;
[Signal] public delegate void ClickedEventHandler(int index);
public override void _EnterTree()
{
nameLabel = GetNode<Label>("NameLabel");
}
public void _on_gui_input(InputEvent ev)
{
if (ev is not InputEventMouseButton mev) return;
if (mev.Pressed)
{
EmitSignalClicked(index);
}
}
}
@@ -0,0 +1 @@
uid://bh6wcyxh1f0cv
@@ -0,0 +1 @@
uid://csgctygxnj3bc