Add objective progress tracker
This commit is contained in:
@@ -232,7 +232,8 @@ func _create_hud() -> void:
|
||||
top_row.add_child(status_label)
|
||||
|
||||
objective_label = Label.new()
|
||||
objective_label.custom_minimum_size = Vector2(300, 40)
|
||||
objective_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
objective_label.custom_minimum_size = Vector2(360, 48)
|
||||
top_row.add_child(objective_label)
|
||||
|
||||
campaign_status_label = Label.new()
|
||||
@@ -259,6 +260,8 @@ func _create_hud() -> void:
|
||||
side_panel.add_child(side_column)
|
||||
|
||||
var selected_row := HBoxContainer.new()
|
||||
selected_row.custom_minimum_size = Vector2(420, 104)
|
||||
selected_row.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
selected_row.add_theme_constant_override("separation", 8)
|
||||
side_column.add_child(selected_row)
|
||||
|
||||
@@ -1457,7 +1460,7 @@ func _refresh_ranges() -> void:
|
||||
|
||||
func _update_hud() -> void:
|
||||
status_label.text = state.get_status_text()
|
||||
objective_label.text = String(state.objectives.get("victory", "Defeat all enemies."))
|
||||
objective_label.text = _format_objective_hud_text()
|
||||
campaign_status_label.text = campaign_state.get_progress_text()
|
||||
_update_cell_info()
|
||||
_update_forecast()
|
||||
@@ -1530,6 +1533,16 @@ func _update_hud() -> void:
|
||||
threat_button.disabled = not battle_started or state.battle_status != BattleState.STATUS_ACTIVE or campaign_complete_screen
|
||||
|
||||
|
||||
func _format_objective_hud_text() -> String:
|
||||
var text := String(state.objectives.get("victory", "Defeat all enemies."))
|
||||
var progress_text := state.get_objective_progress_text()
|
||||
if progress_text.is_empty():
|
||||
return text
|
||||
if text.is_empty():
|
||||
return progress_text
|
||||
return "%s\n%s" % [text, progress_text]
|
||||
|
||||
|
||||
func _hovered_unit_for_hud_portrait() -> Dictionary:
|
||||
if not state.is_inside(hover_cell):
|
||||
return {}
|
||||
@@ -2428,6 +2441,11 @@ func _format_briefing_objectives() -> String:
|
||||
if not text.is_empty():
|
||||
text += "\n"
|
||||
text += "Defeat: %s" % defeat
|
||||
var tracker_text := state.get_objective_progress_text(true)
|
||||
if not tracker_text.is_empty():
|
||||
if not text.is_empty():
|
||||
text += "\n"
|
||||
text += "Tracker: %s" % tracker_text
|
||||
var rewards_text := _format_briefing_rewards()
|
||||
if not rewards_text.is_empty():
|
||||
if not text.is_empty():
|
||||
|
||||
Reference in New Issue
Block a user