Split objective panel progress and risk
This commit is contained in:
@@ -72,6 +72,8 @@ var campaign_complete_screen := false
|
||||
var status_label: Label
|
||||
var objective_label: Label
|
||||
var campaign_status_label: Label
|
||||
var mission_title_label: Label
|
||||
var mission_detail_label: Label
|
||||
var hud_unit_portrait_panel: PanelContainer
|
||||
var hud_unit_portrait_texture: TextureRect
|
||||
var hud_unit_portrait_label: Label
|
||||
@@ -252,11 +254,11 @@ func _create_hud() -> void:
|
||||
|
||||
var side_panel := PanelContainer.new()
|
||||
side_panel.position = Vector2(760, 104)
|
||||
side_panel.size = Vector2(480, 580)
|
||||
side_panel.size = Vector2(480, 610)
|
||||
root.add_child(side_panel)
|
||||
|
||||
var side_column := VBoxContainer.new()
|
||||
side_column.add_theme_constant_override("separation", 10)
|
||||
side_column.add_theme_constant_override("separation", 6)
|
||||
side_panel.add_child(side_column)
|
||||
|
||||
var selected_row := HBoxContainer.new()
|
||||
@@ -292,19 +294,29 @@ func _create_hud() -> void:
|
||||
selected_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
selected_row.add_child(selected_label)
|
||||
|
||||
mission_title_label = Label.new()
|
||||
mission_title_label.text = "Objective"
|
||||
mission_title_label.add_theme_font_size_override("font_size", 14)
|
||||
side_column.add_child(mission_title_label)
|
||||
|
||||
mission_detail_label = Label.new()
|
||||
mission_detail_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
mission_detail_label.custom_minimum_size = Vector2(420, 126)
|
||||
side_column.add_child(mission_detail_label)
|
||||
|
||||
cell_info_label = Label.new()
|
||||
cell_info_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
cell_info_label.custom_minimum_size = Vector2(420, 126)
|
||||
cell_info_label.custom_minimum_size = Vector2(420, 90)
|
||||
side_column.add_child(cell_info_label)
|
||||
|
||||
forecast_label = Label.new()
|
||||
forecast_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
forecast_label.custom_minimum_size = Vector2(420, 84)
|
||||
forecast_label.custom_minimum_size = Vector2(420, 60)
|
||||
side_column.add_child(forecast_label)
|
||||
|
||||
inventory_label = Label.new()
|
||||
inventory_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
inventory_label.custom_minimum_size = Vector2(420, 40)
|
||||
inventory_label.custom_minimum_size = Vector2(420, 34)
|
||||
side_column.add_child(inventory_label)
|
||||
|
||||
var button_row := HBoxContainer.new()
|
||||
@@ -382,7 +394,7 @@ func _create_hud() -> void:
|
||||
equip_menu.add_child(equip_list)
|
||||
|
||||
log_box = RichTextLabel.new()
|
||||
log_box.custom_minimum_size = Vector2(420, 150)
|
||||
log_box.custom_minimum_size = Vector2(420, 70)
|
||||
log_box.fit_content = false
|
||||
side_column.add_child(log_box)
|
||||
|
||||
@@ -1462,6 +1474,7 @@ func _update_hud() -> void:
|
||||
status_label.text = state.get_status_text()
|
||||
objective_label.text = _format_objective_hud_text()
|
||||
campaign_status_label.text = campaign_state.get_progress_text()
|
||||
_update_mission_panel()
|
||||
_update_cell_info()
|
||||
_update_forecast()
|
||||
_update_result_panel()
|
||||
@@ -1535,12 +1548,35 @@ func _update_hud() -> void:
|
||||
|
||||
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]
|
||||
return "Objective"
|
||||
return "Objective: %s" % text
|
||||
|
||||
|
||||
func _update_mission_panel() -> void:
|
||||
if mission_detail_label == null:
|
||||
return
|
||||
mission_detail_label.text = _format_mission_panel_text()
|
||||
|
||||
|
||||
func _format_mission_panel_text() -> String:
|
||||
var lines := []
|
||||
var victory := str(state.objectives.get("victory", ""))
|
||||
if not victory.is_empty():
|
||||
lines.append("Win: %s" % victory)
|
||||
var progress_lines := state.get_objective_progress_lines(false, false)
|
||||
if not progress_lines.is_empty():
|
||||
lines.append("Progress:")
|
||||
for progress_line in progress_lines:
|
||||
lines.append(" %s" % progress_line)
|
||||
var risk_lines := state.get_defeat_progress_lines()
|
||||
if not risk_lines.is_empty():
|
||||
lines.append("Risk:")
|
||||
for risk_line in risk_lines:
|
||||
lines.append(" %s" % risk_line)
|
||||
if lines.is_empty():
|
||||
return "No objective data."
|
||||
return _join_strings(lines, "\n")
|
||||
|
||||
|
||||
func _hovered_unit_for_hud_portrait() -> Dictionary:
|
||||
@@ -2441,11 +2477,16 @@ 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():
|
||||
var progress_lines := state.get_objective_progress_lines(false, false)
|
||||
if not progress_lines.is_empty():
|
||||
if not text.is_empty():
|
||||
text += "\n"
|
||||
text += "Tracker: %s" % tracker_text
|
||||
text += "Progress: %s" % _join_strings(progress_lines, ", ")
|
||||
var risk_lines := state.get_defeat_progress_lines()
|
||||
if not risk_lines.is_empty():
|
||||
if not text.is_empty():
|
||||
text += "\n"
|
||||
text += "Risk: %s" % _join_strings(risk_lines, ", ")
|
||||
var rewards_text := _format_briefing_rewards()
|
||||
if not rewards_text.is_empty():
|
||||
if not text.is_empty():
|
||||
|
||||
Reference in New Issue
Block a user