diff --git a/assets/ui/unit_faces.BMP b/assets/ui/unit_faces.BMP new file mode 100644 index 0000000..b8b2b47 Binary files /dev/null and b/assets/ui/unit_faces.BMP differ diff --git a/assets/ui/unit_faces.BMP.import b/assets/ui/unit_faces.BMP.import new file mode 100644 index 0000000..a32ff1f --- /dev/null +++ b/assets/ui/unit_faces.BMP.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c7coajdu61crq" +path="res://.godot/imported/unit_faces.BMP-4eb539ec6753a0109183a7c01fbbbf92.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/unit_faces.BMP" +dest_files=["res://.godot/imported/unit_faces.BMP-4eb539ec6753a0109183a7c01fbbbf92.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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 diff --git a/prefabs/combat_ui.tscn b/prefabs/combat_ui.tscn index 3c08082..9ccc7c5 100644 --- a/prefabs/combat_ui.tscn +++ b/prefabs/combat_ui.tscn @@ -357,7 +357,7 @@ texture = SubResource("AtlasTexture_manhy") [node name="HealthNumber" parent="UIBase/UnitPanel/UnitHealth" unique_id=1442983008 instance=ExtResource("5_55shj")] unique_name_in_owner = true layout_mode = 2 -size_flags_vertical = 0 +size_flags_vertical = 4 sprite_sheet = SubResource("AtlasTexture_ox7qj") number_sprite_width = 13 number_sprite_height = 15 @@ -386,7 +386,7 @@ texture = SubResource("AtlasTexture_vj7wc") [node name="SPNumber" parent="UIBase/UnitPanel/UnitSP" unique_id=442319509 instance=ExtResource("5_55shj")] unique_name_in_owner = true layout_mode = 2 -size_flags_vertical = 0 +size_flags_vertical = 4 sprite_sheet = SubResource("AtlasTexture_ox7qj") number_sprite_width = 13 number_sprite_height = 15 @@ -415,7 +415,7 @@ texture = SubResource("AtlasTexture_r8i3r") [node name="FSNumber" parent="UIBase/UnitPanel/UnitFS" unique_id=1558008542 instance=ExtResource("5_55shj")] unique_name_in_owner = true layout_mode = 2 -size_flags_vertical = 0 +size_flags_vertical = 4 sprite_sheet = SubResource("AtlasTexture_ox7qj") number_sprite_width = 13 number_sprite_height = 15 diff --git a/prefabs/contiguous_bar.tscn b/prefabs/contiguous_bar.tscn new file mode 100644 index 0000000..4df4822 --- /dev/null +++ b/prefabs/contiguous_bar.tscn @@ -0,0 +1,52 @@ +[gd_scene format=3 uid="uid://fw4ug70qd8nm"] + +[ext_resource type="Texture2D" uid="uid://cavpqnd0qqoou" path="res://assets/ui/SO008B.BMP" id="1_nj0tn"] +[ext_resource type="Script" uid="uid://cb32ywwuyi706" path="res://scripts/ui/contiguous_bar.gd" id="2_cbar"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_vkyrt"] +atlas = ExtResource("1_nj0tn") +region = Rect2(680, 557, 52, 7) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3kyon"] +atlas = ExtResource("1_nj0tn") +region = Rect2(680, 564, 50, 5) + +[node name="ContiguousBar" type="Control" unique_id=1119297666] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("2_cbar") + +[node name="EmptyBar" type="NinePatchRect" parent="." unique_id=303722124] +layout_mode = 1 +anchors_preset = 14 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_bottom = 7.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("AtlasTexture_vkyrt") +region_rect = Rect2(0, 0, 52, 7) +patch_margin_left = 1 +patch_margin_top = 1 +patch_margin_right = 1 +patch_margin_bottom = 1 + +[node name="Fill" type="NinePatchRect" parent="EmptyBar" unique_id=1864372620] +layout_mode = 1 +anchors_preset = 11 +anchor_left = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -1.0 +offset_top = 1.0 +offset_right = -1.0 +offset_bottom = -1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("AtlasTexture_3kyon") +region_rect = Rect2(0, 0, 50, 5) diff --git a/prefabs/deployment_slot.tscn b/prefabs/deployment_slot.tscn new file mode 100644 index 0000000..1deaaed --- /dev/null +++ b/prefabs/deployment_slot.tscn @@ -0,0 +1,186 @@ +[gd_scene format=3 uid="uid://csu4xocsj71td"] + +[ext_resource type="Texture2D" uid="uid://cavpqnd0qqoou" path="res://assets/ui/SO008B.BMP" id="1_vc35g"] +[ext_resource type="Shader" uid="uid://bd8ki8xwym5nc" path="res://shaders/chroma_key.gdshader" id="2_mwfff"] +[ext_resource type="Texture2D" uid="uid://c7coajdu61crq" path="res://assets/ui/unit_faces.BMP" id="3_q3r6y"] +[ext_resource type="Script" uid="uid://cb32ywwuyi706" path="res://scripts/ui/contiguous_bar.gd" id="4_byj02"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_07lbo"] +atlas = ExtResource("1_vc35g") +region = Rect2(680, 522, 60, 35) + +[sub_resource type="AtlasTexture" id="AtlasTexture_scfqt"] +atlas = ExtResource("1_vc35g") +region = Rect2(680, 605, 50, 17) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_a8mo2"] +shader = ExtResource("2_mwfff") +shader_parameter/key_color = Color(0, 1, 0, 1) +shader_parameter/threshold = 0.01 + +[sub_resource type="AtlasTexture" id="AtlasTexture_ajsjv"] +atlas = ExtResource("3_q3r6y") +region = Rect2(40, 0, 40, 40) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kqrkf"] +atlas = ExtResource("1_vc35g") +region = Rect2(708, 587, 28, 17) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1c3gn"] +atlas = ExtResource("1_vc35g") +region = Rect2(264, 272, 52, 7) + +[sub_resource type="AtlasTexture" id="AtlasTexture_d4kxr"] +atlas = ExtResource("1_vc35g") +region = Rect2(264, 279, 50, 5) + +[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_vxtih"] +blend_mode = 1 + +[sub_resource type="AtlasTexture" id="AtlasTexture_og56w"] +atlas = ExtResource("1_vc35g") +region = Rect2(740, 522, 45, 35) + +[node name="DeploymentSlot" type="Control" unique_id=258677476] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Base" type="TextureRect" parent="." unique_id=1397025328] +self_modulate = Color(0.85881317, 0.8389489, 0.60661924, 1) +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -30.0 +offset_top = -17.5 +offset_right = 30.0 +offset_bottom = 17.5 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("AtlasTexture_07lbo") + +[node name="Contents" type="Control" parent="Base" unique_id=1351926154] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Empty" type="Control" parent="Base/Contents" unique_id=1459198631] +visible = false +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Label" type="TextureRect" parent="Base/Contents/Empty" unique_id=460221998] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -25.0 +offset_top = -8.5 +offset_right = 25.0 +offset_bottom = 8.5 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("AtlasTexture_scfqt") + +[node name="Deployed" type="Control" parent="Base/Contents" unique_id=1502290289] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="UnitSprite" type="TextureRect" parent="Base/Contents/Deployed" unique_id=1617524406] +material = SubResource("ShaderMaterial_a8mo2") +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_top = -45.0 +offset_right = 40.0 +offset_bottom = -5.0 +grow_vertical = 0 +texture = SubResource("AtlasTexture_ajsjv") + +[node name="ReadyLabel" type="TextureRect" parent="Base/Contents/Deployed" unique_id=1608591044] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -30.0 +offset_top = -14.0 +offset_right = -2.0 +offset_bottom = 3.0 +grow_horizontal = 0 +grow_vertical = 2 +texture = SubResource("AtlasTexture_kqrkf") + +[node name="EmptyBar" type="NinePatchRect" parent="Base/Contents/Deployed" unique_id=855067973] +layout_mode = 1 +anchors_preset = 14 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = 2.0 +offset_top = 7.0 +offset_right = -2.0 +offset_bottom = 14.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("AtlasTexture_1c3gn") +region_rect = Rect2(0, 0, 52, 7) +patch_margin_left = 1 +patch_margin_top = 1 +patch_margin_right = 1 +patch_margin_bottom = 1 +script = ExtResource("4_byj02") +value = 50 +max_value = 50 + +[node name="Fill" type="NinePatchRect" parent="Base/Contents/Deployed/EmptyBar" unique_id=318061429] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 1.0 +offset_top = 1.0 +offset_right = -1.0 +offset_bottom = -1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("AtlasTexture_d4kxr") +region_rect = Rect2(0, 0, 50, 5) + +[node name="Hover" type="TextureRect" parent="." unique_id=1517469291] +visible = false +material = SubResource("CanvasItemMaterial_vxtih") +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -22.5 +offset_top = -17.5 +offset_right = 22.5 +offset_bottom = 17.5 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("AtlasTexture_og56w") diff --git a/prefabs/stylized_number_display.tscn b/prefabs/stylized_number_display.tscn index 2d9dbbb..0b9d6fc 100644 --- a/prefabs/stylized_number_display.tscn +++ b/prefabs/stylized_number_display.tscn @@ -1,10 +1,10 @@ [gd_scene format=3 uid="uid://bc5a7tb0my6n5"] -[ext_resource type="Script" uid="uid://biud4ob4h0rrs" path="res://scripts/ui/stylized_number_display.gd" id="1_s5s2y"] -[ext_resource type="Texture2D" uid="uid://cavpqnd0qqoou" path="res://assets/ui/SO008B.BMP" id="2_b1oqg"] +[ext_resource type="Script" uid="uid://biud4ob4h0rrs" path="res://scripts/ui/stylized_number_display.gd" id="1_yn0fd"] +[ext_resource type="Texture2D" uid="uid://cavpqnd0qqoou" path="res://assets/ui/SO008B.BMP" id="2_2wvj5"] [sub_resource type="AtlasTexture" id="AtlasTexture_b1oqg"] -atlas = ExtResource("2_b1oqg") +atlas = ExtResource("2_2wvj5") region = Rect2(546, 839, 272, 39) [node name="StylizedNumberDisplay" type="Control" unique_id=702997768] @@ -14,11 +14,12 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -script = ExtResource("1_s5s2y") +script = ExtResource("1_yn0fd") sprite_sheet = SubResource("AtlasTexture_b1oqg") [node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=2089310026] unique_name_in_owner = true +custom_minimum_size = Vector2(60, 0) layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -26,3 +27,4 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 theme_override_constants/separation = 2 +alignment = 1 diff --git a/scripts/ui/contiguous_bar.gd b/scripts/ui/contiguous_bar.gd new file mode 100644 index 0000000..f469b93 --- /dev/null +++ b/scripts/ui/contiguous_bar.gd @@ -0,0 +1,34 @@ +@tool +class_name ContiguousBar extends Control + +@onready var fill: NinePatchRect = $Fill + +@export var value: int: + set(v): + value = v + _refresh() + +@export var max_value: int: + set(v): + max_value = v + _refresh() + + +func _ready() -> void: + _refresh() + + +func _refresh() -> void: + if fill == null: + return + var ratio := 0.0 + if max_value > 0: + ratio = clampf(float(value) / float(max_value), 0.0, 1.0) + fill.anchor_top = 0.0 + fill.anchor_bottom = 1.0 + fill.anchor_right = 1.0 + fill.anchor_left = 1.0 - ratio + fill.offset_top = 1.0 + fill.offset_bottom = -1.0 + fill.offset_right = -1.0 + fill.offset_left = 2.0 * ratio - 1.0 diff --git a/scripts/ui/contiguous_bar.gd.uid b/scripts/ui/contiguous_bar.gd.uid new file mode 100644 index 0000000..411f7f5 --- /dev/null +++ b/scripts/ui/contiguous_bar.gd.uid @@ -0,0 +1 @@ +uid://cb32ywwuyi706