Add briefing campaign header
This commit is contained in:
@@ -61,6 +61,9 @@ var cell_info_label: Label
|
||||
var forecast_label: Label
|
||||
var inventory_label: Label
|
||||
var briefing_panel: PanelContainer
|
||||
var briefing_title_label: Label
|
||||
var briefing_location_label: Label
|
||||
var briefing_objective_label: Label
|
||||
var briefing_label: Label
|
||||
var shop_button: Button
|
||||
var shop_menu: VBoxContainer
|
||||
@@ -312,18 +315,38 @@ func _create_hud() -> void:
|
||||
|
||||
briefing_panel = PanelContainer.new()
|
||||
briefing_panel.visible = false
|
||||
briefing_panel.position = Vector2(284, 88)
|
||||
briefing_panel.size = Vector2(640, 500)
|
||||
briefing_panel.position = Vector2(300, 88)
|
||||
briefing_panel.size = Vector2(680, 600)
|
||||
root.add_child(briefing_panel)
|
||||
|
||||
var briefing_column := VBoxContainer.new()
|
||||
briefing_column.add_theme_constant_override("separation", 10)
|
||||
briefing_column.add_theme_constant_override("separation", 8)
|
||||
briefing_panel.add_child(briefing_column)
|
||||
|
||||
briefing_title_label = Label.new()
|
||||
briefing_title_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
briefing_title_label.custom_minimum_size = Vector2(640, 28)
|
||||
briefing_title_label.add_theme_font_size_override("font_size", 20)
|
||||
briefing_column.add_child(briefing_title_label)
|
||||
|
||||
briefing_location_label = Label.new()
|
||||
briefing_location_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
briefing_location_label.custom_minimum_size = Vector2(640, 22)
|
||||
briefing_column.add_child(briefing_location_label)
|
||||
|
||||
briefing_objective_label = Label.new()
|
||||
briefing_objective_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
briefing_objective_label.custom_minimum_size = Vector2(640, 48)
|
||||
briefing_column.add_child(briefing_objective_label)
|
||||
|
||||
var briefing_scroll := ScrollContainer.new()
|
||||
briefing_scroll.custom_minimum_size = Vector2(640, 96)
|
||||
briefing_column.add_child(briefing_scroll)
|
||||
|
||||
briefing_label = Label.new()
|
||||
briefing_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
briefing_label.custom_minimum_size = Vector2(600, 170)
|
||||
briefing_column.add_child(briefing_label)
|
||||
briefing_label.custom_minimum_size = Vector2(620, 0)
|
||||
briefing_scroll.add_child(briefing_label)
|
||||
|
||||
var prep_button_row := HBoxContainer.new()
|
||||
prep_button_row.add_theme_constant_override("separation", 8)
|
||||
@@ -1793,6 +1816,39 @@ func _load_scenario(scenario_id: String) -> void:
|
||||
)
|
||||
|
||||
|
||||
func _format_briefing_title(briefing: Dictionary) -> String:
|
||||
var title := str(briefing.get("title", state.battle_name))
|
||||
if title.is_empty():
|
||||
title = campaign_state.get_scenario_title(active_scenario_id)
|
||||
var position := campaign_state.get_scenario_position(active_scenario_id)
|
||||
var count := campaign_state.get_scenario_count()
|
||||
if position > 0 and count > 0:
|
||||
return "Battle %02d/%02d - %s" % [position, count, title]
|
||||
return title
|
||||
|
||||
|
||||
func _format_briefing_location(briefing: Dictionary) -> String:
|
||||
var location := str(briefing.get("location", ""))
|
||||
if campaign_state.campaign_title.is_empty():
|
||||
return location
|
||||
if location.is_empty():
|
||||
return campaign_state.campaign_title
|
||||
return "%s | %s" % [campaign_state.campaign_title, location]
|
||||
|
||||
|
||||
func _format_briefing_objectives() -> String:
|
||||
var text := ""
|
||||
var victory := str(state.objectives.get("victory", ""))
|
||||
if not victory.is_empty():
|
||||
text = "Victory: %s" % victory
|
||||
var defeat := str(state.objectives.get("defeat", ""))
|
||||
if not defeat.is_empty():
|
||||
if not text.is_empty():
|
||||
text += "\n"
|
||||
text += "Defeat: %s" % defeat
|
||||
return text
|
||||
|
||||
|
||||
func _show_briefing() -> void:
|
||||
_play_bgm("menu")
|
||||
var briefing := state.get_briefing()
|
||||
@@ -1806,12 +1862,12 @@ func _show_briefing() -> void:
|
||||
body += "\n"
|
||||
body += str(line)
|
||||
|
||||
briefing_label.text = "%s\n%s\n\n%s\n\nObjective: %s" % [
|
||||
briefing.get("title", state.battle_name),
|
||||
briefing.get("location", ""),
|
||||
body,
|
||||
state.objectives.get("victory", "")
|
||||
]
|
||||
briefing_title_label.text = _format_briefing_title(briefing)
|
||||
briefing_location_label.text = _format_briefing_location(briefing)
|
||||
briefing_location_label.visible = not briefing_location_label.text.is_empty()
|
||||
briefing_objective_label.text = _format_briefing_objectives()
|
||||
briefing_objective_label.visible = not briefing_objective_label.text.is_empty()
|
||||
briefing_label.text = body
|
||||
briefing_panel.visible = true
|
||||
battle_started = false
|
||||
_hide_shop_menu()
|
||||
|
||||
Reference in New Issue
Block a user