From c0f7dd8eec858501ccf676eed41ded2d33e7d31b Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Mon, 19 May 2025 21:32:38 -0600 Subject: [PATCH] Add inventory menu --- project.godot | 5 ++ src/resources/ui/ui_panel.tres | 18 ++++ src/scenes/characters/player.tscn | 68 +++++++-------- src/scenes/levels/level.tscn | 26 +++--- src/scenes/structures/lamp.tscn | 1 - src/scenes/ui/inventory.tscn | 139 +++++++++++++++++++++++++++++- src/scenes/ui/user_interface.tscn | 8 +- src/scripts/ui/user_interface.gd | 13 +++ 8 files changed, 229 insertions(+), 49 deletions(-) create mode 100644 src/resources/ui/ui_panel.tres diff --git a/project.godot b/project.godot index c35166d..7ca6586 100644 --- a/project.godot +++ b/project.godot @@ -81,6 +81,11 @@ debug_gain_xp={ "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":4194332,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } +open_inventory={ +"deadzone": 0.2, +"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) +] +} [layer_names] diff --git a/src/resources/ui/ui_panel.tres b/src/resources/ui/ui_panel.tres new file mode 100644 index 0000000..fe5481d --- /dev/null +++ b/src/resources/ui/ui_panel.tres @@ -0,0 +1,18 @@ +[gd_resource type="StyleBoxTexture" load_steps=2 format=3 uid="uid://copt367rq3lyr"] + +[ext_resource type="Texture2D" uid="uid://c26cs2s0d7bhb" path="res://assets/ui/window/window_c.png" id="1_wgctn"] + +[resource] +content_margin_left = 8.0 +content_margin_top = 8.0 +content_margin_right = 8.0 +content_margin_bottom = 8.0 +texture = ExtResource("1_wgctn") +texture_margin_left = 8.0 +texture_margin_top = 8.0 +texture_margin_right = 8.0 +texture_margin_bottom = 8.0 +expand_margin_left = 8.0 +expand_margin_top = 8.0 +expand_margin_right = 8.0 +expand_margin_bottom = 8.0 diff --git a/src/scenes/characters/player.tscn b/src/scenes/characters/player.tscn index cff0c02..25d18b6 100644 --- a/src/scenes/characters/player.tscn +++ b/src/scenes/characters/player.tscn @@ -48,53 +48,53 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) [node name="Rig" parent="RigPivot" instance=ExtResource("3_n52bt")] [node name="Skeleton3D" parent="RigPivot/Rig/CharacterRig/GameRig" index="0"] -bones/0/position = Vector3(9.10632e-15, 0.897796, -0.0481735) +bones/0/position = Vector3(1.10278e-14, 0.894503, -0.0481735) bones/0/rotation = Quaternion(0.12582, 1.18262e-07, 1.49989e-08, 0.992053) bones/1/rotation = Quaternion(-0.0566577, -0.00072973, -0.0117082, 0.998325) bones/2/position = Vector3(3.20474e-09, 0.146689, -1.95578e-08) -bones/2/rotation = Quaternion(-0.00137182, -0.000408462, 0.00321463, 0.999994) +bones/2/rotation = Quaternion(-0.0035143, -0.000443189, 0.00321533, 0.999989) bones/3/position = Vector3(-2.01263e-09, 0.202058, -2.51457e-08) -bones/3/rotation = Quaternion(-0.0960596, -0.000374465, 0.00852031, 0.995339) +bones/3/rotation = Quaternion(-0.0979643, -0.000399219, 0.00851909, 0.995153) bones/4/position = Vector3(3.02934e-10, 0.0925562, 3.91155e-08) -bones/4/rotation = Quaternion(0.276725, 1.55382e-08, 9.05906e-08, 0.960949) +bones/4/rotation = Quaternion(0.278201, 1.45752e-08, 9.45482e-08, 0.960523) bones/5/rotation = Quaternion(-0.0948564, -2.80691e-14, -2.26155e-08, 0.995491) -bones/6/rotation = Quaternion(-0.156608, -1.1777e-07, -1.84686e-08, 0.987661) -bones/7/position = Vector3(-1.64274e-08, 0.897796, -0.0481734) +bones/6/rotation = Quaternion(-0.154381, -1.17377e-07, -2.09848e-08, 0.988011) +bones/7/position = Vector3(-3.12401e-08, 0.894502, -0.0481735) bones/7/rotation = Quaternion(-0.0863677, -0.751104, -0.383052, 0.530711) -bones/8/position = Vector3(-7.15453e-08, 0.897796, -0.0481735) +bones/8/position = Vector3(-6.05844e-08, 0.894502, -0.0481735) bones/8/rotation = Quaternion(-0.0863677, 0.751104, 0.383052, 0.530711) -bones/9/position = Vector3(0.131144, 0.964001, -0.0351291) -bones/9/rotation = Quaternion(0.993043, 0.020862, -0.0309536, 0.111679) +bones/9/position = Vector3(0.131144, 0.960707, -0.0351291) +bones/9/rotation = Quaternion(0.992736, 0.0210142, -0.0308827, 0.114366) bones/10/position = Vector3(-2.36129e-08, 0.26601, -2.14789e-08) bones/10/rotation = Quaternion(-3.13921e-08, -0.000695086, 1.20449e-08, 1) bones/11/position = Vector3(-4.6306e-08, 0.26601, 2.42145e-08) -bones/11/rotation = Quaternion(0.420385, -0.000700496, 0.000324692, 0.907346) +bones/11/rotation = Quaternion(0.426635, -0.000700668, 0.000330655, 0.904424) bones/12/position = Vector3(3.05151e-08, 0.22603, 5.03768e-08) bones/12/rotation = Quaternion(-8.19226e-09, -0.00710644, 4.16102e-08, 0.999975) bones/13/position = Vector3(-2.95495e-08, 0.22603, 2.68392e-09) -bones/13/rotation = Quaternion(-0.751659, 0.0118859, 0.0244045, 0.658993) +bones/13/rotation = Quaternion(-0.754363, 0.0118957, 0.0244191, 0.655896) bones/14/position = Vector3(-3.05481e-08, 0.139877, 1.64787e-08) bones/14/rotation = Quaternion(-9.66743e-05, 0.967474, -0.252972, -0.000383447) -bones/15/position = Vector3(-0.131144, 0.964001, -0.0351291) -bones/15/rotation = Quaternion(0.973202, -0.00578121, 0.0273228, 0.228249) +bones/15/position = Vector3(-0.131144, 0.960707, -0.0351291) +bones/15/rotation = Quaternion(0.97251, -0.00591078, 0.0272326, 0.23119) bones/16/position = Vector3(-1.10042e-08, 0.265705, -3.31989e-08) bones/16/rotation = Quaternion(-3.43227e-08, 0.00314323, 8.33075e-10, 0.999995) bones/17/position = Vector3(1.83545e-08, 0.265705, 6.98543e-10) -bones/17/rotation = Quaternion(0.444398, 0.00329248, -0.00163343, 0.895822) +bones/17/rotation = Quaternion(0.450281, 0.00332722, -0.00167803, 0.892879) bones/18/position = Vector3(1.2807e-08, 0.225719, -8.28774e-09) bones/18/rotation = Quaternion(-2.29017e-08, -0.00785732, 3.30149e-08, 0.999969) bones/19/position = Vector3(-1.27748e-08, 0.225719, 1.12004e-08) -bones/19/rotation = Quaternion(-0.68825, -0.028193, -0.000730449, 0.724925) +bones/19/rotation = Quaternion(-0.690793, -0.0282064, -0.000547657, 0.722502) bones/20/position = Vector3(-1.30142e-08, 0.139877, -2.77457e-09) bones/20/rotation = Quaternion(-9.96472e-05, 0.967461, -0.253021, -0.000383039) -bones/21/position = Vector3(0.0251286, 1.42797, 0.0426986) -bones/21/rotation = Quaternion(-0.491549, -0.258729, -0.401319, 0.728273) -bones/22/position = Vector3(0.188732, 1.46498, -0.0229053) -bones/22/rotation = Quaternion(0.0479058, -0.159993, 0.97454, -0.1496) +bones/21/position = Vector3(0.0251286, 1.42485, 0.0415178) +bones/21/rotation = Quaternion(-0.49711, -0.256398, -0.397268, 0.727544) +bones/22/position = Vector3(0.187962, 1.46126, -0.0263026) +bones/22/rotation = Quaternion(0.0548836, -0.158917, 0.974172, -0.150742) bones/23/position = Vector3(-5.41331e-09, 0.143946, -2.98023e-08) -bones/23/rotation = Quaternion(5.96391e-08, -0.0175512, 7.66073e-08, 0.999846) +bones/23/rotation = Quaternion(1.2041e-07, -0.011847, -3.39987e-08, 0.99993) bones/24/position = Vector3(-6.33301e-08, 0.143946, 4.3873e-08) -bones/24/rotation = Quaternion(0.302664, -0.0175519, -0.0185676, 0.952755) +bones/24/rotation = Quaternion(0.289579, -0.0118476, -0.0175549, 0.95692) bones/25/position = Vector3(1.30385e-08, 0.127601, 6.51926e-09) bones/25/rotation = Quaternion(1.49943e-07, -1.20606e-07, 9.91859e-08, 1) bones/26/position = Vector3(2.06034e-08, 0.127601, 2.42761e-08) @@ -119,14 +119,14 @@ bones/42/rotation = Quaternion(-0.120913, 0.799109, 0.0358921, 0.587807) bones/43/rotation = Quaternion(0.498693, -0.0202705, -0.0256953, 0.866161) bones/44/rotation = Quaternion(0.715385, 0.035306, 0.0573145, 0.695481) bones/45/rotation = Quaternion(-0.129059, 0.728936, -0.0250259, 0.67184) -bones/46/position = Vector3(-0.0113635, 1.42797, 0.0426986) -bones/46/rotation = Quaternion(-0.509052, 0.222962, 0.376924, 0.741001) -bones/47/position = Vector3(-0.16781, 1.46546, -0.0382827) -bones/47/rotation = Quaternion(-0.0717007, -0.137456, 0.973476, 0.168253) +bones/46/position = Vector3(-0.0113635, 1.42485, 0.0415177) +bones/46/rotation = Quaternion(-0.519031, 0.211804, 0.366694, 0.742483) +bones/47/position = Vector3(-0.164846, 1.46159, -0.0452729) +bones/47/rotation = Quaternion(-0.087622, -0.134684, 0.972172, 0.17048) bones/48/position = Vector3(1.88476e-07, 0.143946, 1.02445e-08) -bones/48/rotation = Quaternion(1.02745e-07, 0.0159803, 1.16495e-07, 0.999872) +bones/48/rotation = Quaternion(-7.58983e-08, 0.00510357, -1.36906e-07, 0.999987) bones/49/position = Vector3(6.5191e-09, 0.143946, -1.95094e-08) -bones/49/rotation = Quaternion(0.336074, 0.0159807, 0.0289808, 0.941254) +bones/49/rotation = Quaternion(0.321008, 0.00510392, 0.0288052, 0.946625) bones/50/position = Vector3(-1.48779e-07, 0.1276, 5.9139e-08) bones/50/rotation = Quaternion(-8.73115e-08, 2.7474e-08, -1.28057e-07, 1) bones/51/position = Vector3(1.9461e-07, 0.127601, 6.06248e-08) @@ -152,19 +152,19 @@ bones/67/rotation = Quaternion(0.108364, -0.768224, 0.166291, 0.608635) bones/68/rotation = Quaternion(0.629954, 0.0295149, 0.0177509, 0.775869) bones/69/rotation = Quaternion(0.816678, -0.0439534, -0.0509861, 0.573155) bones/70/rotation = Quaternion(-0.12906, -0.728937, 0.0250258, 0.67184) -bones/71/position = Vector3(0.127191, 1.34658, -0.0262327) -bones/71/rotation = Quaternion(1.93793e-08, 0.612015, 0.790846, -4.63801e-08) -bones/72/position = Vector3(-0.113426, 1.34658, -0.0262327) -bones/72/rotation = Quaternion(1.93794e-08, 0.612015, 0.790846, -4.63801e-08) +bones/71/position = Vector3(0.127191, 1.34281, -0.0266916) +bones/71/rotation = Quaternion(1.91355e-08, 0.615566, 0.788085, -4.65116e-08) +bones/72/position = Vector3(-0.113426, 1.34281, -0.0266916) +bones/72/rotation = Quaternion(1.91418e-08, 0.615476, 0.788156, -4.65081e-08) [node name="RightHandBone" parent="RigPivot/Rig" index="2"] -transform = Transform3D(-0.962343, -0.270804, -0.0237128, 0.23972, -0.886535, 0.395715, -0.128183, 0.375129, 0.918067, -0.341627, 0.984705, -0.0250425) +transform = Transform3D(-0.962343, -0.270802, -0.0237146, 0.243922, -0.898731, 0.364397, -0.119992, 0.344891, 0.930941, -0.338663, 0.977671, -0.0395404) [node name="LeftHandBone" parent="RigPivot/Rig" index="3"] -transform = Transform3D(-0.970514, 0.239108, 0.0305212, -0.220736, -0.932453, 0.286019, 0.096849, 0.270848, 0.957738, 0.345543, 0.972205, -0.045435) +transform = Transform3D(-0.970513, 0.239108, 0.0305213, -0.22344, -0.939884, 0.258251, 0.0904365, 0.243817, 0.965595, 0.344773, 0.966514, -0.0555742) [node name="RayAttachment" type="BoneAttachment3D" parent="RigPivot/Rig"] -transform = Transform3D(-0.962343, -0.270804, -0.0237128, 0.23972, -0.886535, 0.395715, -0.128183, 0.375129, 0.918067, -0.341627, 0.984705, -0.0250425) +transform = Transform3D(-0.962343, -0.270802, -0.0237146, 0.243922, -0.898731, 0.364397, -0.119992, 0.344891, 0.930941, -0.338663, 0.977671, -0.0395404) bone_name = "DEF-hand.R" bone_idx = 51 use_external_skeleton = true diff --git a/src/scenes/levels/level.tscn b/src/scenes/levels/level.tscn index 2569aa7..5f536bd 100644 --- a/src/scenes/levels/level.tscn +++ b/src/scenes/levels/level.tscn @@ -97,7 +97,6 @@ mesh_list = Array[Terrain3DMeshAsset]([SubResource("Terrain3DMeshAsset_856t6")]) texture_list = Array[Terrain3DTextureAsset]([SubResource("Terrain3DTextureAsset_0slur")]) [sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_dn2un"] -energy_multiplier = 4.0 use_debanding = false [sub_resource type="Sky" id="Sky_7iny7"] @@ -107,7 +106,8 @@ sky_material = SubResource("PhysicalSkyMaterial_dn2un") background_mode = 2 sky = SubResource("Sky_7iny7") ambient_light_source = 3 -ambient_light_color = Color(1, 1, 1, 1) +ambient_light_color = Color(0.235156, 0.278907, 0.35, 1) +ambient_light_sky_contribution = 0.7 reflected_light_source = 2 tonemap_mode = 3 tonemap_white = 6.0 @@ -128,18 +128,20 @@ metadata/_edit_lock_ = true environment = SubResource("Environment_cxs0p") camera_attributes = SubResource("CameraAttributesPractical_0slur") script = ExtResource("1_1jhfv") -current_time = 11.5 +current_time = 0.0 reflected_energy = 4.0 metadata/_custom_type_script = "uid://bmywk4wvcp0lr" [node name="SunLight" type="DirectionalLight3D" parent="Sky3D"] -transform = Transform3D(0, -0.996487, 0.0837498, 0.631677, 0.0649255, 0.772508, -0.775232, 0.0529029, 0.629458, 0.0837499, 0.772508, 0.629458) +transform = Transform3D(0, -0.421456, 0.906849, 0.959384, -0.255826, -0.118895, 0.282105, 0.870016, 0.404338, 0.906849, -0.118894, 0.404338) +light_color = Color(0.98, 0.523, 0.294, 1) +light_energy = 0.0 shadow_enabled = true [node name="MoonLight" type="DirectionalLight3D" parent="Sky3D"] -transform = Transform3D(0, -0.570079, -0.82159, -0.5765, -0.671319, 0.46581, -0.817097, 0.473646, -0.328651, -0.82159, 0.46581, -0.32865) +transform = Transform3D(0, -0.977458, 0.211132, -0.187706, 0.207379, 0.960084, -0.982225, -0.0396307, -0.183475, 0.211132, 0.960084, -0.183475) light_color = Color(0.572549, 0.776471, 0.956863, 1) -light_energy = 0.0 +light_energy = 0.288025 shadow_enabled = true [node name="Skydome" type="Node" parent="Sky3D"] @@ -152,8 +154,8 @@ ground_color = Color(0.3, 0.3, 0.3, 1) sky_layers = 4 sky_render_priority = -128 horizon_level = 0.0 -sun_altitude = -39.4203 -sun_azimuth = -172.421 +sun_altitude = -172.547 +sun_azimuth = -163.221 sun_disk_color = Color(0.996094, 0.541334, 0.140076, 1) sun_disk_intensity = 2.0 sun_disk_size = 0.015 @@ -161,8 +163,8 @@ sun_light_path = NodePath("../SunLight") sun_light_color = Color(1, 1, 1, 1) sun_horizon_light_color = Color(0.98, 0.523, 0.294, 1) sun_light_energy = 1.0 -moon_altitude = -133.862 -moon_azimuth = -337.164 +moon_altitude = -16.2431 +moon_azimuth = -49.0091 moon_color = Color(1, 1, 1, 1) moon_size = 0.07 enable_set_moon_texture = false @@ -170,7 +172,7 @@ moon_resolution = 2 moon_light_path = NodePath("../MoonLight") moon_light_color = Color(0.572549, 0.776471, 0.956863, 1) moon_light_energy = 0.3 -deep_space_euler = Vector3(1.29154, 3.14159, 1.51595) +deep_space_euler = Vector3(1.29154, -3.14159, -1.78505) background_color = Color(0.709804, 0.709804, 0.709804, 0.854902) set_background_texture = false stars_field_color = Color(1, 1, 1, 1) @@ -239,7 +241,7 @@ update_in_editor = false dome_path = NodePath("../Skydome") system_sync = false total_cycle_in_minutes = 15.0 -total_hours = 11.5 +total_hours = 0.0 day = 1 month = 1 year = 2025 diff --git a/src/scenes/structures/lamp.tscn b/src/scenes/structures/lamp.tscn index 165f2cc..882be07 100644 --- a/src/scenes/structures/lamp.tscn +++ b/src/scenes/structures/lamp.tscn @@ -8,7 +8,6 @@ [node name="OmniLight3D" type="OmniLight3D" parent="lamppost_furn"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.471, 2.92497, 0) -visible = false light_color = Color(0.900353, 0.606455, 0.0980959, 1) light_energy = 10.0 omni_range = 10.6869 diff --git a/src/scenes/ui/inventory.tscn b/src/scenes/ui/inventory.tscn index cd7b787..2ff2b2c 100644 --- a/src/scenes/ui/inventory.tscn +++ b/src/scenes/ui/inventory.tscn @@ -1,4 +1,36 @@ -[gd_scene format=3 uid="uid://csadps2at3npv"] +[gd_scene load_steps=12 format=3 uid="uid://csadps2at3npv"] + +[ext_resource type="Texture2D" uid="uid://dhvatbbng4411" path="res://assets/ui/window/window_header.png" id="1_0708f"] +[ext_resource type="FontFile" uid="uid://sua821wsaeli" path="res://assets/fonts/Candara_Bold.ttf" id="2_apwy2"] +[ext_resource type="StyleBox" uid="uid://copt367rq3lyr" path="res://src/resources/ui/ui_panel.tres" id="3_qcfrv"] +[ext_resource type="Texture2D" uid="uid://dd48efbhydh3d" path="res://assets/ui/icons/spell_slot_empty_icon.png" id="4_16ir6"] +[ext_resource type="FontFile" uid="uid://d3s081dnj7ea4" path="res://assets/fonts/Candara_Italic.ttf" id="5_ylnvo"] + +[sub_resource type="Gradient" id="Gradient_s4y2v"] +colors = PackedColorArray(0.0941176, 0.101961, 0.133333, 1, 0.0185326, 0.0209737, 0.0325612, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_0708f"] +gradient = SubResource("Gradient_s4y2v") +fill_to = Vector2(0, 1) + +[sub_resource type="LabelSettings" id="LabelSettings_qcfrv"] +font = ExtResource("2_apwy2") +font_size = 48 +font_color = Color(0.835294, 0.627451, 0.356863, 1) + +[sub_resource type="LabelSettings" id="LabelSettings_31epi"] +font = ExtResource("2_apwy2") +font_size = 36 +font_color = Color(0.835294, 0.627451, 0.356863, 1) +shadow_color = Color(0, 0, 0, 1) + +[sub_resource type="LabelSettings" id="LabelSettings_dryat"] +font = ExtResource("5_ylnvo") +font_size = 24 + +[sub_resource type="LabelSettings" id="LabelSettings_tfrle"] +font = ExtResource("2_apwy2") +font_size = 32 [node name="Inventory" type="Control"] layout_mode = 3 @@ -7,3 +39,108 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 + +[node name="BackgroundGradient" type="TextureRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("GradientTexture2D_0708f") + +[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 = 32 +theme_override_constants/margin_top = 32 +theme_override_constants/margin_right = 32 +theme_override_constants/margin_bottom = 32 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +layout_mode = 2 + +[node name="HeaderRect" type="TextureRect" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +texture = ExtResource("1_0708f") +stretch_mode = 5 + +[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HeaderRect"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "Inventory" +label_settings = SubResource("LabelSettings_qcfrv") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/separation = 0 + +[node name="EquippedItems" type="PanelContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(960, 0) +layout_mode = 2 +theme_override_styles/panel = ExtResource("3_qcfrv") + +[node name="SubViewportContainer" type="SubViewportContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(512, 0) +layout_mode = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(384, 0) +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="CharacterSheet" type="PanelContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_styles/panel = ExtResource("3_qcfrv") + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet"] +layout_mode = 2 + +[node name="LevelLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Level 1" +label_settings = SubResource("LabelSettings_31epi") +horizontal_alignment = 1 + +[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer"] +layout_mode = 2 +columns = 2 + +[node name="Attribute" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +texture = ExtResource("4_16ir6") + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute"] +layout_mode = 1 +anchors_preset = 14 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="AttributeName" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute/VBoxContainer"] +layout_mode = 2 +text = "Strength" +label_settings = SubResource("LabelSettings_dryat") +horizontal_alignment = 1 + +[node name="AttributeScore" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute/VBoxContainer"] +layout_mode = 2 +text = "0" +label_settings = SubResource("LabelSettings_tfrle") +horizontal_alignment = 1 diff --git a/src/scenes/ui/user_interface.tscn b/src/scenes/ui/user_interface.tscn index 38cd044..bb10838 100644 --- a/src/scenes/ui/user_interface.tscn +++ b/src/scenes/ui/user_interface.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://blex30jj7g55d"] +[gd_scene load_steps=9 format=3 uid="uid://blex30jj7g55d"] [ext_resource type="Texture2D" uid="uid://b7gexelwfg2wp" path="res://assets/ui/unitframe/health_bar_under.png" id="1_qhv2u"] [ext_resource type="Script" uid="uid://5d05pjburasd" path="res://src/scripts/ui/user_interface.gd" id="1_xba4v"] @@ -6,6 +6,7 @@ [ext_resource type="Texture2D" uid="uid://bvwedh6c8rvg" path="res://assets/ui/unitframe/main_bar.png" id="3_j2uiq"] [ext_resource type="FontFile" uid="uid://xseb06nenn48" path="res://assets/fonts/Candara.ttf" id="3_nxqqf"] [ext_resource type="Texture2D" uid="uid://dn2npqh8ue3vy" path="res://assets/ui/unitframe/blue_bar.png" id="4_ma5hf"] +[ext_resource type="PackedScene" uid="uid://csadps2at3npv" path="res://src/scenes/ui/inventory.tscn" id="7_70hpn"] [sub_resource type="LabelSettings" id="LabelSettings_xba4v"] font = ExtResource("3_nxqqf") @@ -13,6 +14,7 @@ font_size = 26 font_color = Color(0.960784, 0.717647, 0.423529, 1) [node name="UserInterface" type="Control"] +process_mode = 3 layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -100,3 +102,7 @@ text = "999" label_settings = SubResource("LabelSettings_xba4v") horizontal_alignment = 1 vertical_alignment = 1 + +[node name="Inventory" parent="." instance=ExtResource("7_70hpn")] +visible = false +layout_mode = 1 diff --git a/src/scripts/ui/user_interface.gd b/src/scripts/ui/user_interface.gd index 78b51ad..d7be60e 100644 --- a/src/scripts/ui/user_interface.gd +++ b/src/scripts/ui/user_interface.gd @@ -4,9 +4,14 @@ extends Control @onready var health_bar: TextureProgressBar = %HealthBar @onready var xp_bar: TextureProgressBar = %XPBar @onready var health_label: Label = %HealthLabel +@onready var inventory: Control = $Inventory @export var player: Player +func _unhandled_input(event: InputEvent) -> void: + if event.is_action_pressed("open_inventory"): + toggle_inventory_menu() + func update_stats_display() -> void: level_label.text = str(player.stats.level) xp_bar.max_value = player.stats.perc_level_up_boundary() @@ -16,3 +21,11 @@ func update_health() -> void: health_bar.max_value = player.health_component.max_health health_bar.value = player.health_component.current_health health_label.text = player.health_component.get_health_string() + +func toggle_inventory_menu() -> void: + get_tree().paused = !get_tree().paused + inventory.visible = !inventory.visible + if inventory.visible: + Input.mouse_mode = Input.MOUSE_MODE_VISIBLE + else: + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED