Compare commits
7 Commits
e356078a9f
...
834d6a3a83
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
834d6a3a83 | ||
|
|
676c82c4e5 | ||
|
|
e2d23bec48 | ||
|
|
b01d8c6648 | ||
|
|
f6ac31b52e | ||
|
|
9b1d6e8c8f | ||
|
|
664c9694de |
BIN
assets/ui/SO008A.BMP
Normal file
BIN
assets/ui/SO008A.BMP
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 MiB |
40
assets/ui/SO008A.BMP.import
Normal file
40
assets/ui/SO008A.BMP.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cau61m1755dkn"
|
||||
path="res://.godot/imported/SO008A.BMP-dedc5f46caf0f66b50eed190cef6a3a9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/ui/SO008A.BMP"
|
||||
dest_files=["res://.godot/imported/SO008A.BMP-dedc5f46caf0f66b50eed190cef6a3a9.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
|
||||
BIN
assets/ui/SO008B.BMP
Normal file
BIN
assets/ui/SO008B.BMP
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 MiB |
40
assets/ui/SO008B.BMP.import
Normal file
40
assets/ui/SO008B.BMP.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cavpqnd0qqoou"
|
||||
path="res://.godot/imported/SO008B.BMP-57a2d92123e6b32a5ec6367855ebadf6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/ui/SO008B.BMP"
|
||||
dest_files=["res://.godot/imported/SO008B.BMP-57a2d92123e6b32a5ec6367855ebadf6.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
|
||||
@@ -1,9 +1,7 @@
|
||||
* Reogranize files
|
||||
* Singletons named 'XXXServer'
|
||||
* Dialogue scene command system (ShowText, ShowSprite, MoveSprite, PlaySound, ChangeBackground, etc)
|
||||
* Need to figure out more complicated systems like choices, script eval, conditionals, jumping, etc. Probably end up wanting a DialogueEditor or just making them gdscripts and being done with it
|
||||
* Finish Dialogue Scene (fast forward, auto, history functionality, etc)
|
||||
* Units have an AppearanceInfo component that has a dictionary of str, UnitAppearance. UnitAppearance stores idle sprite, walking sprite, back, front, portrait, etc. AppearanceInfo specifies the current UnitAppearance and has methods for getting that data
|
||||
* Finish main menu
|
||||
* Game Start screen
|
||||
* Load Data Screen
|
||||
@@ -12,6 +10,5 @@
|
||||
* Battle View
|
||||
* Fog of war
|
||||
* Basic map editor (test map data will be harder to craft the more we add)
|
||||
* Walking animations
|
||||
* Start plugging in the Himegari UI
|
||||
* Dialog boxes
|
||||
23
prefabs/chip_bar.tscn
Normal file
23
prefabs/chip_bar.tscn
Normal file
@@ -0,0 +1,23 @@
|
||||
[gd_scene format=3 uid="uid://8edgswcwdiwu"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvmmsm13nyr62" path="res://scripts/ui/chip_bar.gd" id="1_3whrn"]
|
||||
|
||||
[node name="ChipBar" type="Control" unique_id=379110810]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_3whrn")
|
||||
|
||||
[node name="HFlowContainer" type="HFlowContainer" parent="." unique_id=185867767]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/h_separation = 0
|
||||
theme_override_constants/v_separation = 0
|
||||
alignment = 2
|
||||
@@ -2,47 +2,155 @@
|
||||
|
||||
[ext_resource type="Theme" uid="uid://dx26d6py3n8xi" path="res://resources/main_ui_theme.tres" id="1_2ro41"]
|
||||
[ext_resource type="Script" uid="uid://w2wh6gtv3u2l" path="res://scripts/battle/combat_ui.gd" id="2_ui_script"]
|
||||
[ext_resource type="Texture2D" uid="uid://cavpqnd0qqoou" path="res://assets/ui/SO008B.BMP" id="3_hadma"]
|
||||
[ext_resource type="Texture2D" uid="uid://cau61m1755dkn" path="res://assets/ui/SO008A.BMP" id="3_tfn3h"]
|
||||
[ext_resource type="PackedScene" uid="uid://bc5a7tb0my6n5" path="res://prefabs/stylized_number_display.tscn" id="5_55shj"]
|
||||
[ext_resource type="PackedScene" uid="uid://8edgswcwdiwu" path="res://prefabs/chip_bar.tscn" id="6_gqe5k"]
|
||||
|
||||
[node name="CombatUI" type="CanvasLayer" unique_id=1093388037]
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hadma"]
|
||||
atlas = ExtResource("3_tfn3h")
|
||||
region = Rect2(0, 0, 800, 600)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_55shj"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(393, 280, 168, 77)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gqe5k"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(141, 0, 513, 169)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hr2yf"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(393, 169, 263, 111)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3wejr"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(614, 711, 137, 26)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_uh1k2"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(614, 737, 55, 20)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yayqj"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(547, 839, 270, 36)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_eskga"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(249, 272, 3, 14)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_14b7f"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(246, 272, 3, 14)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_manhy"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(1055, 151, 28, 19)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ox7qj"]
|
||||
atlas = ExtResource("3_hadma")
|
||||
region = Rect2(547, 824, 130, 15)
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_gqe5k"]
|
||||
load_path = "res://.godot/imported/SO008B.BMP-57a2d92123e6b32a5ec6367855ebadf6.ctex"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yhw6j"]
|
||||
atlas = SubResource("CompressedTexture2D_gqe5k")
|
||||
region = Rect2(261, 272, 3, 9)
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_icxrh"]
|
||||
load_path = "res://.godot/imported/SO008B.BMP-57a2d92123e6b32a5ec6367855ebadf6.ctex"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kdblo"]
|
||||
atlas = SubResource("CompressedTexture2D_icxrh")
|
||||
region = Rect2(255, 272, 3, 9)
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_ptl6p"]
|
||||
load_path = "res://.godot/imported/SO008B.BMP-57a2d92123e6b32a5ec6367855ebadf6.ctex"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vj7wc"]
|
||||
atlas = SubResource("CompressedTexture2D_ptl6p")
|
||||
region = Rect2(1056, 172, 27, 15)
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_5b4vf"]
|
||||
load_path = "res://.godot/imported/SO008B.BMP-57a2d92123e6b32a5ec6367855ebadf6.ctex"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kd55s"]
|
||||
atlas = SubResource("CompressedTexture2D_5b4vf")
|
||||
region = Rect2(261, 272, 3, 9)
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_4lqfr"]
|
||||
load_path = "res://.godot/imported/SO008B.BMP-57a2d92123e6b32a5ec6367855ebadf6.ctex"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_alhr0"]
|
||||
atlas = SubResource("CompressedTexture2D_4lqfr")
|
||||
region = Rect2(258, 272, 3, 9)
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_eajv6"]
|
||||
load_path = "res://.godot/imported/SO008B.BMP-57a2d92123e6b32a5ec6367855ebadf6.ctex"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_r8i3r"]
|
||||
atlas = SubResource("CompressedTexture2D_eajv6")
|
||||
region = Rect2(1056, 190, 26, 16)
|
||||
|
||||
[node name="BattleViewUI" type="CanvasLayer" unique_id=1093388037]
|
||||
script = ExtResource("2_ui_script")
|
||||
|
||||
[node name="UnitPanel" type="PanelContainer" parent="." unique_id=2000000001]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
[node name="UIBase" type="Control" parent="." unique_id=7839209]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 8.0
|
||||
offset_top = -78.0
|
||||
offset_right = 208.0
|
||||
offset_bottom = -8.0
|
||||
grow_vertical = 0
|
||||
theme = ExtResource("1_2ro41")
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="UnitPanel" unique_id=899996785]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 8
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_right = 8
|
||||
theme_override_constants/margin_bottom = 8
|
||||
[node name="Overlay" type="Control" parent="UIBase" unique_id=114439631]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="UnitPanel/MarginContainer" unique_id=333573880]
|
||||
layout_mode = 2
|
||||
[node name="Background" type="TextureRect" parent="UIBase/Overlay" unique_id=1726665864]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = SubResource("AtlasTexture_hadma")
|
||||
|
||||
[node name="NameLabel" type="Label" parent="UnitPanel/MarginContainer/VBoxContainer" unique_id=2000000002]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Unit"
|
||||
[node name="HoverInfo" type="TextureRect" parent="UIBase/Overlay" unique_id=1180275113]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
texture = SubResource("AtlasTexture_55shj")
|
||||
|
||||
[node name="HPBar" type="ProgressBar" parent="UnitPanel/MarginContainer/VBoxContainer" unique_id=2000000003]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
value = 100.0
|
||||
show_percentage = false
|
||||
[node name="Bars" type="TextureRect" parent="UIBase/Overlay" unique_id=780801800]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -513.0
|
||||
offset_bottom = 169.0
|
||||
grow_horizontal = 0
|
||||
texture = SubResource("AtlasTexture_gqe5k")
|
||||
|
||||
[node name="BackgroundTint" type="ColorRect" parent="." unique_id=253893594]
|
||||
[node name="TextureRect" type="TextureRect" parent="UIBase/Overlay" unique_id=1469571203]
|
||||
layout_mode = 0
|
||||
offset_left = 536.0
|
||||
offset_top = 432.0
|
||||
offset_right = 799.0
|
||||
offset_bottom = 543.0
|
||||
texture = SubResource("AtlasTexture_hr2yf")
|
||||
|
||||
[node name="BackgroundTint" type="ColorRect" parent="UIBase" unique_id=253893594]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@@ -50,121 +158,260 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 0.4)
|
||||
|
||||
[node name="CombatProposalPanel" type="PanelContainer" parent="." unique_id=2088533653]
|
||||
[node name="CombatProposalPanel" type="PanelContainer" parent="UIBase" unique_id=2088533653]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -88.0
|
||||
offset_top = -103.5
|
||||
offset_right = 88.0
|
||||
offset_bottom = 103.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_2ro41")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="CombatProposalPanel" unique_id=924522188]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="UIBase/CombatProposalPanel" unique_id=924522188]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CombatProposalPanel/MarginContainer" unique_id=666671196]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="UIBase/CombatProposalPanel/MarginContainer" unique_id=666671196]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer" unique_id=1520669125]
|
||||
[node name="TitleLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer" unique_id=1520669125]
|
||||
layout_mode = 2
|
||||
text = "COMBAT FORECAST"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="StatsContainer" type="HBoxContainer" parent="CombatProposalPanel/MarginContainer/VBoxContainer" unique_id=1101898616]
|
||||
[node name="StatsContainer" type="HBoxContainer" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer" unique_id=1101898616]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 24
|
||||
|
||||
[node name="AttackerStats" type="VBoxContainer" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer" unique_id=1193603706]
|
||||
[node name="AttackerStats" type="VBoxContainer" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer" unique_id=1193603706]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="AttackerNameLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1574861154]
|
||||
[node name="AttackerNameLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1574861154]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Attacker"
|
||||
|
||||
[node name="AttackerTacticSelect" type="OptionButton" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1466363800]
|
||||
[node name="AttackerTacticSelect" type="OptionButton" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1466363800]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="AttackerHPBar" type="ProgressBar" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=241886156]
|
||||
[node name="AttackerHPBar" type="ProgressBar" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=241886156]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
show_percentage = false
|
||||
|
||||
[node name="AttackerATKLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1656041171]
|
||||
[node name="AttackerATKLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1656041171]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "ATK: 0"
|
||||
|
||||
[node name="AttackerDEFLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=2145851939]
|
||||
[node name="AttackerDEFLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=2145851939]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "DEF: 0"
|
||||
|
||||
[node name="AttackerHITLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1234331828]
|
||||
[node name="AttackerHITLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1234331828]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "HIT: 0%"
|
||||
|
||||
[node name="AttackerSPDLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1461624142]
|
||||
[node name="AttackerSPDLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/AttackerStats" unique_id=1461624142]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "SPD: 0"
|
||||
|
||||
[node name="DefenderStats" type="VBoxContainer" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer" unique_id=1747482540]
|
||||
[node name="DefenderStats" type="VBoxContainer" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer" unique_id=1747482540]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DefenderNameLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=365769500]
|
||||
[node name="DefenderNameLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=365769500]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Defender"
|
||||
|
||||
[node name="DefenderTacticSelect" type="OptionButton" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=1226652499]
|
||||
[node name="DefenderTacticSelect" type="OptionButton" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=1226652499]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DefenderHPBar" type="ProgressBar" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=1878516243]
|
||||
[node name="DefenderHPBar" type="ProgressBar" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=1878516243]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
show_percentage = false
|
||||
|
||||
[node name="DefenderATKLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=1571527922]
|
||||
[node name="DefenderATKLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=1571527922]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "ATK: 0"
|
||||
|
||||
[node name="DefenderDEFLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=1755454849]
|
||||
[node name="DefenderDEFLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=1755454849]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "DEF: 0"
|
||||
|
||||
[node name="DefenderHITLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=717216786]
|
||||
[node name="DefenderHITLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=717216786]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "HIT: 0%"
|
||||
|
||||
[node name="DefenderSPDLabel" type="Label" parent="CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=132072292]
|
||||
[node name="DefenderSPDLabel" type="Label" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/StatsContainer/DefenderStats" unique_id=132072292]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "SPD: 0"
|
||||
|
||||
[node name="ButtonContainer" type="HBoxContainer" parent="CombatProposalPanel/MarginContainer/VBoxContainer" unique_id=2145647565]
|
||||
[node name="ButtonContainer" type="HBoxContainer" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer" unique_id=2145647565]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="FightButton" type="Button" parent="CombatProposalPanel/MarginContainer/VBoxContainer/ButtonContainer" unique_id=2109262268]
|
||||
[node name="FightButton" type="Button" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/ButtonContainer" unique_id=2109262268]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Fight"
|
||||
|
||||
[node name="CancelButton" type="Button" parent="CombatProposalPanel/MarginContainer/VBoxContainer/ButtonContainer" unique_id=238295206]
|
||||
[node name="CancelButton" type="Button" parent="UIBase/CombatProposalPanel/MarginContainer/VBoxContainer/ButtonContainer" unique_id=238295206]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Cancel"
|
||||
|
||||
[node name="UnitPanel" type="Control" parent="UIBase" unique_id=1823763147]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -265.0
|
||||
offset_top = -194.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="UIBase/UnitPanel" unique_id=691752297]
|
||||
layout_mode = 0
|
||||
offset_left = 128.0
|
||||
offset_right = 265.0
|
||||
offset_bottom = 26.0
|
||||
size_flags_horizontal = 8
|
||||
texture = SubResource("AtlasTexture_3wejr")
|
||||
|
||||
[node name="Items" type="HBoxContainer" parent="UIBase/UnitPanel/TextureRect" unique_id=828992814]
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -63.0
|
||||
offset_top = -20.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="Spacer" type="Control" parent="UIBase/UnitPanel/TextureRect/Items" unique_id=1068603879]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="TextureRect" parent="UIBase/UnitPanel/TextureRect/Items" unique_id=1299333906]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
texture = SubResource("AtlasTexture_uh1k2")
|
||||
|
||||
[node name="StylizedNumberDisplay" parent="UIBase/UnitPanel/TextureRect/Items" unique_id=702997768 instance=ExtResource("5_55shj")]
|
||||
layout_mode = 2
|
||||
sprite_sheet = SubResource("AtlasTexture_yayqj")
|
||||
number_sprite_width = 27
|
||||
number_sprite_height = 39
|
||||
value = 12
|
||||
|
||||
[node name="UnitHealth" type="HBoxContainer" parent="UIBase/UnitPanel" unique_id=53239936]
|
||||
layout_mode = 0
|
||||
offset_left = 1.0
|
||||
offset_top = 103.0
|
||||
offset_right = 225.0
|
||||
offset_bottom = 131.0
|
||||
alignment = 2
|
||||
|
||||
[node name="HealthChipBar" parent="UIBase/UnitPanel/UnitHealth" unique_id=379110810 instance=ExtResource("6_gqe5k")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
empty_chip_texture = SubResource("AtlasTexture_eskga")
|
||||
filled_chip_texture = SubResource("AtlasTexture_14b7f")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="UIBase/UnitPanel/UnitHealth" unique_id=668812970]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
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
|
||||
sprite_sheet = SubResource("AtlasTexture_ox7qj")
|
||||
number_sprite_width = 13
|
||||
number_sprite_height = 15
|
||||
|
||||
[node name="UnitSP" type="HBoxContainer" parent="UIBase/UnitPanel" unique_id=514403074]
|
||||
layout_mode = 0
|
||||
offset_left = 1.0
|
||||
offset_top = 133.0
|
||||
offset_right = 225.0
|
||||
offset_bottom = 151.0
|
||||
|
||||
[node name="SPChipBar" parent="UIBase/UnitPanel/UnitSP" unique_id=374103132 instance=ExtResource("6_gqe5k")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
empty_chip_texture = SubResource("AtlasTexture_yhw6j")
|
||||
filled_chip_texture = SubResource("AtlasTexture_kdblo")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="UIBase/UnitPanel/UnitSP" unique_id=805168370]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
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
|
||||
sprite_sheet = SubResource("AtlasTexture_ox7qj")
|
||||
number_sprite_width = 13
|
||||
number_sprite_height = 15
|
||||
|
||||
[node name="UnitFS" type="HBoxContainer" parent="UIBase/UnitPanel" unique_id=1209088756]
|
||||
layout_mode = 0
|
||||
offset_left = 1.0
|
||||
offset_top = 160.0
|
||||
offset_right = 225.0
|
||||
offset_bottom = 178.0
|
||||
|
||||
[node name="FSChipBar" parent="UIBase/UnitPanel/UnitFS" unique_id=1380843979 instance=ExtResource("6_gqe5k")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
empty_chip_texture = SubResource("AtlasTexture_kd55s")
|
||||
filled_chip_texture = SubResource("AtlasTexture_alhr0")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="UIBase/UnitPanel/UnitFS" unique_id=1340673242]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
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
|
||||
sprite_sheet = SubResource("AtlasTexture_ox7qj")
|
||||
number_sprite_width = 13
|
||||
number_sprite_height = 15
|
||||
|
||||
28
prefabs/stylized_number_display.tscn
Normal file
28
prefabs/stylized_number_display.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[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"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_b1oqg"]
|
||||
atlas = ExtResource("2_b1oqg")
|
||||
region = Rect2(546, 839, 272, 39)
|
||||
|
||||
[node name="StylizedNumberDisplay" type="Control" unique_id=702997768]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_s5s2y")
|
||||
sprite_sheet = SubResource("AtlasTexture_b1oqg")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=2089310026]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 2
|
||||
@@ -25,7 +25,7 @@ func _on_unit_unit_allegiance_changed(_unit: Unit, allegiance: UnitAllegiance) -
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fhs1y"]
|
||||
shader = ExtResource("3_fhs1y")
|
||||
shader_parameter/key_color = Color(0, 1, 0, 1)
|
||||
shader_parameter/threshold = 0.01
|
||||
shader_parameter/threshold = 0.010000000475
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fhs1y"]
|
||||
atlas = ExtResource("3_on614")
|
||||
|
||||
@@ -41,3 +41,4 @@ debug_toggle={
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
rendering_device/driver.windows="d3d12"
|
||||
renderer/rendering_method="mobile"
|
||||
environment/defaults/default_clear_color=Color(0, 0, 0, 1)
|
||||
|
||||
BIN
reference_images/chip.png
Normal file
BIN
reference_images/chip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
40
reference_images/chip.png.import
Normal file
40
reference_images/chip.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bhtnqu000slm2"
|
||||
path="res://.godot/imported/chip.png-5735088daa8f24a5994c25e597283774.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reference_images/chip.png"
|
||||
dest_files=["res://.godot/imported/chip.png-5735088daa8f24a5994c25e597283774.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
|
||||
@@ -5,6 +5,10 @@
|
||||
[ext_resource type="Shader" uid="uid://dakre5usldk6r" path="res://shaders/masked_palette_swap.gdshader" id="1_nd71p"]
|
||||
[ext_resource type="Texture2D" uid="uid://b8td6sv5re6r8" path="res://assets/sprites/grey_castle_spritesheet_mask.bmp" id="2_7ddre"]
|
||||
[ext_resource type="Texture2D" uid="uid://b20mhn7ca5xyo" path="res://assets/sprites/aux_terrain.BMP" id="5_qjeyg"]
|
||||
[ext_resource type="Script" uid="uid://csdcbi2gtwrly" path="res://scripts/battle/camera_controller.gd" id="6_wtsjf"]
|
||||
[ext_resource type="PackedScene" uid="uid://bc5a7tb0my6n5" path="res://prefabs/stylized_number_display.tscn" id="7_rnaij"]
|
||||
[ext_resource type="PackedScene" uid="uid://8edgswcwdiwu" path="res://prefabs/chip_bar.tscn" id="8_h3xc6"]
|
||||
[ext_resource type="Texture2D" uid="uid://cavpqnd0qqoou" path="res://assets/ui/SO008B.BMP" id="9_s36qc"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_qjeyg"]
|
||||
texture = ExtResource("1_7ddre")
|
||||
@@ -53,6 +57,14 @@ region = Rect2(0, 100, 100, 100)
|
||||
atlas = ExtResource("5_qjeyg")
|
||||
region = Rect2(210, 0, 41, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6qxox"]
|
||||
atlas = ExtResource("9_s36qc")
|
||||
region = Rect2(249, 272, 3, 14)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gthg3"]
|
||||
atlas = ExtResource("9_s36qc")
|
||||
region = Rect2(246, 272, 3, 14)
|
||||
|
||||
[node name="TestScene" type="Node2D" unique_id=1687841395]
|
||||
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="." unique_id=265586128]
|
||||
@@ -66,3 +78,40 @@ texture = SubResource("AtlasTexture_j8ivh")
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="." unique_id=1517711877]
|
||||
texture = SubResource("AtlasTexture_3qnke")
|
||||
|
||||
[node name="CameraController" type="Camera2D" parent="." unique_id=1277373781]
|
||||
script = ExtResource("6_wtsjf")
|
||||
metadata/_custom_type_script = "uid://csdcbi2gtwrly"
|
||||
|
||||
[node name="Control" type="Control" parent="." unique_id=794632273]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="StylizedNumberDisplay" parent="Control" unique_id=702997768 instance=ExtResource("7_rnaij")]
|
||||
layout_mode = 0
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_right = 50.0
|
||||
offset_bottom = 50.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
number_sprite_width = 27
|
||||
number_sprite_height = 36
|
||||
value = 1234567890
|
||||
|
||||
[node name="ChipBar" parent="Control" unique_id=379110810 instance=ExtResource("8_h3xc6")]
|
||||
layout_mode = 1
|
||||
offset_left = -87.0
|
||||
offset_top = -101.0
|
||||
offset_right = -37.0
|
||||
offset_bottom = -1.0
|
||||
value = 5
|
||||
max_value = 5
|
||||
max_chips_per_row = 10
|
||||
empty_chip_texture = SubResource("AtlasTexture_6qxox")
|
||||
filled_chip_texture = SubResource("AtlasTexture_gthg3")
|
||||
|
||||
@@ -3,9 +3,13 @@ class_name CombatUI extends CanvasLayer
|
||||
signal fight_confirmed(proposal: CombatProposal)
|
||||
signal fight_cancelled
|
||||
|
||||
@onready var unit_panel: PanelContainer = %UnitPanel
|
||||
@onready var name_label: Label = %NameLabel
|
||||
@onready var hp_bar: ProgressBar = %HPBar
|
||||
@onready var unit_panel: Control = %UnitPanel
|
||||
@onready var health_chip_bar: ChipBar = %HealthChipBar
|
||||
@onready var health_number: StylizedNumberDisplay = %HealthNumber
|
||||
@onready var sp_chip_bar: ChipBar = %SPChipBar
|
||||
@onready var sp_number: StylizedNumberDisplay = %SPNumber
|
||||
@onready var fs_chip_bar: ChipBar = %FSChipBar
|
||||
@onready var fs_number: StylizedNumberDisplay = %FSNumber
|
||||
|
||||
@onready var background_tint: ColorRect = %BackgroundTint
|
||||
@onready var proposal_panel: PanelContainer = %CombatProposalPanel
|
||||
@@ -59,8 +63,7 @@ func _on_unit_died(deployed: DeployedUnit) -> void:
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if _selected_unit and is_instance_valid(_selected_unit):
|
||||
hp_bar.max_value = _selected_unit.current_stats.max_hp
|
||||
hp_bar.value = _selected_unit.current_stats.current_hp
|
||||
_refresh_unit_panel()
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if proposal_panel.visible and event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_RIGHT:
|
||||
@@ -71,14 +74,24 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
func _on_unit_selected_changed(deployed: DeployedUnit, selected: bool) -> void:
|
||||
if selected:
|
||||
_selected_unit = deployed
|
||||
name_label.text = deployed.unit.info.name
|
||||
hp_bar.max_value = deployed.current_stats.max_hp
|
||||
hp_bar.value = deployed.current_stats.current_hp
|
||||
_refresh_unit_panel()
|
||||
unit_panel.visible = true
|
||||
else:
|
||||
_selected_unit = null
|
||||
unit_panel.visible = false
|
||||
|
||||
func _refresh_unit_panel() -> void:
|
||||
var stats := _selected_unit.current_stats
|
||||
health_chip_bar.max_value = stats.max_hp
|
||||
health_chip_bar.value = stats.current_hp
|
||||
health_number.value = stats.current_hp
|
||||
sp_chip_bar.max_value = stats.max_sp
|
||||
sp_chip_bar.value = stats.current_sp
|
||||
sp_number.value = stats.current_sp
|
||||
fs_chip_bar.max_value = stats.max_fs
|
||||
fs_chip_bar.value = stats.current_fs
|
||||
fs_number.value = stats.current_fs
|
||||
|
||||
func show_proposal(proposal: CombatProposal) -> void:
|
||||
_current_proposal = proposal
|
||||
_populate_tactic_select(atk_tactic_select, proposal.attacker)
|
||||
|
||||
@@ -8,6 +8,7 @@ var scene_registry: Array = [
|
||||
{ "name": "Battle Test", "path": "res://scenes/views/battle_view.tscn" },
|
||||
{ "name": "Main Menu", "path": "res://scenes/views/main_menu_view.tscn" },
|
||||
{ "name": "Dialogue Test", "path": "res://scenes/dialogue_scene.tscn" },
|
||||
{ "name": "Test Scene", "path": "res://scenes/test_scene.tscn" },
|
||||
]
|
||||
|
||||
var commands: Array[ConsoleCommand] = []
|
||||
|
||||
47
scripts/ui/chip_bar.gd
Normal file
47
scripts/ui/chip_bar.gd
Normal file
@@ -0,0 +1,47 @@
|
||||
class_name ChipBar extends Control
|
||||
|
||||
# The value to represent in filled chips. In the future chips may be colored differently above certain thresholds to stop drawing too many
|
||||
@export var value: int:
|
||||
set(v):
|
||||
value = v
|
||||
if is_node_ready():
|
||||
_refresh()
|
||||
|
||||
# The total number of chips. If value is less than this, those chips should be empty.
|
||||
@export var max_value: int:
|
||||
set(v):
|
||||
max_value = v
|
||||
if is_node_ready():
|
||||
_refresh()
|
||||
|
||||
# Configures the size of the hflow based on the chip texture size.
|
||||
@export var max_chips_per_row: int
|
||||
|
||||
# The texture for an empty chip
|
||||
@export var empty_chip_texture: Texture2D
|
||||
|
||||
# The texture for a filled chip
|
||||
@export var filled_chip_texture: Texture2D
|
||||
|
||||
@onready var _container: HFlowContainer = $HFlowContainer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_refresh()
|
||||
|
||||
|
||||
func _refresh() -> void:
|
||||
for child in _container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
if filled_chip_texture and max_chips_per_row > 0:
|
||||
var chip_width := filled_chip_texture.get_width()
|
||||
_container.custom_minimum_size.x = chip_width * max_chips_per_row
|
||||
|
||||
for i in max_value:
|
||||
var tex_rect := TextureRect.new()
|
||||
if i < value:
|
||||
tex_rect.texture = filled_chip_texture
|
||||
else:
|
||||
tex_rect.texture = empty_chip_texture
|
||||
_container.add_child(tex_rect)
|
||||
1
scripts/ui/chip_bar.gd.uid
Normal file
1
scripts/ui/chip_bar.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cvmmsm13nyr62
|
||||
44
scripts/ui/stylized_number_display.gd
Normal file
44
scripts/ui/stylized_number_display.gd
Normal file
@@ -0,0 +1,44 @@
|
||||
class_name StylizedNumberDisplay extends Control
|
||||
|
||||
@export var sprite_sheet: AtlasTexture
|
||||
@export var number_sprite_width: int
|
||||
@export var number_sprite_height: int
|
||||
@export var value: int = 0:
|
||||
set(v):
|
||||
value = v
|
||||
if is_node_ready():
|
||||
_refresh()
|
||||
|
||||
@onready var _container: HBoxContainer = %HBoxContainer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_refresh()
|
||||
|
||||
|
||||
func _get_minimum_size() -> Vector2:
|
||||
var digit_count := str(absi(value)).length()
|
||||
var spacing: int = _container.get_theme_constant("separation") if is_node_ready() else 0
|
||||
var total_width: int = digit_count * number_sprite_width + maxi(digit_count - 1, 0) * spacing
|
||||
return Vector2(total_width, number_sprite_height)
|
||||
|
||||
|
||||
func _refresh() -> void:
|
||||
for child in _container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
var digits := str(absi(value))
|
||||
for i in digits.length():
|
||||
var digit := digits[i].to_int()
|
||||
var atlas_tex := AtlasTexture.new()
|
||||
atlas_tex.atlas = sprite_sheet.atlas
|
||||
atlas_tex.region = Rect2(
|
||||
sprite_sheet.region.position.x + digit * number_sprite_width,
|
||||
sprite_sheet.region.position.y,
|
||||
number_sprite_width,
|
||||
number_sprite_height,
|
||||
)
|
||||
var tex_rect := TextureRect.new()
|
||||
tex_rect.texture = atlas_tex
|
||||
_container.add_child(tex_rect)
|
||||
update_minimum_size()
|
||||
1
scripts/ui/stylized_number_display.gd.uid
Normal file
1
scripts/ui/stylized_number_display.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://biud4ob4h0rrs
|
||||
Reference in New Issue
Block a user