Weird alignments

This commit is contained in:
gamer147
2026-04-10 09:46:39 -04:00
parent e2d23bec48
commit 676c82c4e5
3 changed files with 43 additions and 20 deletions

View File

@@ -12,8 +12,12 @@ grow_vertical = 2
script = ExtResource("1_3whrn")
[node name="HFlowContainer" type="HFlowContainer" parent="." unique_id=185867767]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
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

View File

@@ -283,7 +283,7 @@ layout_mode = 2
text = "Cancel"
[node name="UnitPanel" type="Control" parent="UIBase" unique_id=1823763147]
visible = false
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
@@ -333,12 +333,13 @@ value = 12
[node name="UnitHealth" type="HBoxContainer" parent="UIBase/UnitPanel" unique_id=53239936]
layout_mode = 0
offset_left = 185.0
offset_left = 1.0
offset_top = 103.0
offset_right = 225.0
offset_bottom = 143.0
offset_bottom = 131.0
[node name="ChipBar" parent="UIBase/UnitPanel/UnitHealth" unique_id=379110810 instance=ExtResource("6_gqe5k")]
[node name="HealthChipBar" parent="UIBase/UnitPanel/UnitHealth" unique_id=379110810 instance=ExtResource("6_gqe5k")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 0
max_chips_per_row = 100
@@ -350,7 +351,8 @@ layout_mode = 2
size_flags_vertical = 0
texture = SubResource("AtlasTexture_manhy")
[node name="StylizedNumberDisplay" parent="UIBase/UnitPanel/UnitHealth" unique_id=1442983008 instance=ExtResource("5_55shj")]
[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")
@@ -364,7 +366,8 @@ offset_top = 133.0
offset_right = 225.0
offset_bottom = 151.0
[node name="ChipBar" parent="UIBase/UnitPanel/UnitSP" unique_id=374103132 instance=ExtResource("6_gqe5k")]
[node name="SPChipBar" parent="UIBase/UnitPanel/UnitSP" unique_id=374103132 instance=ExtResource("6_gqe5k")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 0
max_chips_per_row = 100
@@ -376,7 +379,8 @@ layout_mode = 2
size_flags_vertical = 0
texture = SubResource("AtlasTexture_vj7wc")
[node name="StylizedNumberDisplay" parent="UIBase/UnitPanel/UnitSP" unique_id=442319509 instance=ExtResource("5_55shj")]
[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")
@@ -390,7 +394,8 @@ offset_top = 160.0
offset_right = 225.0
offset_bottom = 178.0
[node name="ChipBar" parent="UIBase/UnitPanel/UnitFS" unique_id=1380843979 instance=ExtResource("6_gqe5k")]
[node name="FSChipBar" parent="UIBase/UnitPanel/UnitFS" unique_id=1380843979 instance=ExtResource("6_gqe5k")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 0
max_chips_per_row = 100
@@ -402,7 +407,8 @@ layout_mode = 2
size_flags_vertical = 0
texture = SubResource("AtlasTexture_r8i3r")
[node name="StylizedNumberDisplay" parent="UIBase/UnitPanel/UnitFS" unique_id=1558008542 instance=ExtResource("5_55shj")]
[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")

View File

@@ -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)