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

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