Testing chip bar
This commit is contained in:
@@ -4,6 +4,8 @@ signal fight_confirmed(proposal: CombatProposal)
|
||||
signal fight_cancelled
|
||||
|
||||
@onready var unit_panel: Control = %UnitPanel
|
||||
@onready var unit_name_label: RichTextLabel = %UnitName
|
||||
@onready var level_number: StylizedNumberDisplay = %LevelNumber
|
||||
@onready var health_chip_bar: ChipBar = %HealthChipBar
|
||||
@onready var health_number: StylizedNumberDisplay = %HealthNumber
|
||||
@onready var sp_chip_bar: ChipBar = %SPChipBar
|
||||
@@ -82,6 +84,8 @@ func _on_unit_selected_changed(deployed: DeployedUnit, selected: bool) -> void:
|
||||
|
||||
func _refresh_unit_panel() -> void:
|
||||
var stats := _selected_unit.current_stats
|
||||
unit_name_label.text = "[b]%s[/b]" % _selected_unit.unit.info.name
|
||||
level_number.value = stats.level
|
||||
health_chip_bar.max_value = stats.max_hp
|
||||
health_chip_bar.value = stats.current_hp
|
||||
health_number.value = stats.current_hp
|
||||
|
||||
@@ -33,6 +33,8 @@ var lck: int:
|
||||
get: return unit_stats.lck
|
||||
var mov: int:
|
||||
get: return unit_stats.mov
|
||||
var level: int:
|
||||
get: return unit_stats.level
|
||||
|
||||
static func from_unit_stats(source: UnitStats) -> DeployedUnitStats:
|
||||
var stats := DeployedUnitStats.new()
|
||||
|
||||
@@ -38,10 +38,11 @@ func _refresh() -> void:
|
||||
var chip_width := filled_chip_texture.get_width()
|
||||
_container.custom_minimum_size.x = chip_width * max_chips_per_row
|
||||
|
||||
var empty_count := max_value - value
|
||||
for i in max_value:
|
||||
var tex_rect := TextureRect.new()
|
||||
if i < value:
|
||||
tex_rect.texture = filled_chip_texture
|
||||
else:
|
||||
if i < empty_count:
|
||||
tex_rect.texture = empty_chip_texture
|
||||
else:
|
||||
tex_rect.texture = filled_chip_texture
|
||||
_container.add_child(tex_rect)
|
||||
|
||||
@@ -13,3 +13,6 @@ class_name UnitStats extends Resource
|
||||
@export var eva: int = 1
|
||||
@export var lck: int = 1
|
||||
@export var mov: int = 3
|
||||
|
||||
@export var level: int = 1
|
||||
@export var experience: int = 0
|
||||
|
||||
Reference in New Issue
Block a user