Add chapter battle replay entries
This commit is contained in:
@@ -2045,6 +2045,48 @@ func _rebuild_chapter_menu() -> void:
|
||||
chapter_label.custom_minimum_size = Vector2(560, 0)
|
||||
chapter_label.text = line
|
||||
chapter_list.add_child(chapter_label)
|
||||
for scenario in entry.get("scenarios", []):
|
||||
_add_chapter_scenario_entry(scenario)
|
||||
|
||||
|
||||
func _add_chapter_scenario_entry(scenario: Dictionary) -> void:
|
||||
var scenario_id := str(scenario.get("id", ""))
|
||||
var title := str(scenario.get("title", scenario_id))
|
||||
var position := int(scenario.get("position", 0))
|
||||
var total := int(scenario.get("total", 0))
|
||||
var completed := bool(scenario.get("completed", false))
|
||||
var current := bool(scenario.get("current", false))
|
||||
var available := bool(scenario.get("available", false))
|
||||
var status := "Current" if current else ("Replay" if completed else "Upcoming")
|
||||
var text := " %02d/%02d %s [%s]" % [position, total, title, status]
|
||||
if available:
|
||||
var scenario_button := Button.new()
|
||||
scenario_button.custom_minimum_size = Vector2(560, 0)
|
||||
scenario_button.text = text
|
||||
scenario_button.pressed.connect(_on_chapter_scenario_pressed.bind(scenario_id))
|
||||
chapter_list.add_child(scenario_button)
|
||||
else:
|
||||
var scenario_label := Label.new()
|
||||
scenario_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
scenario_label.custom_minimum_size = Vector2(560, 0)
|
||||
scenario_label.text = text
|
||||
chapter_list.add_child(scenario_label)
|
||||
|
||||
|
||||
func _on_chapter_scenario_pressed(scenario_id: String) -> void:
|
||||
if battle_started or briefing_panel == null or not briefing_panel.visible:
|
||||
return
|
||||
if scenario_id.is_empty():
|
||||
return
|
||||
if not campaign_state.is_scenario_completed(scenario_id) and scenario_id != campaign_state.current_scenario_id:
|
||||
_play_ui_cancel()
|
||||
return
|
||||
_play_ui_confirm()
|
||||
if log_box != null:
|
||||
log_box.clear()
|
||||
_load_scenario(scenario_id)
|
||||
_show_briefing()
|
||||
_update_hud()
|
||||
|
||||
|
||||
func _on_shop_pressed() -> void:
|
||||
@@ -2691,7 +2733,7 @@ func _format_battle_result_summary() -> String:
|
||||
pending_text += "\nNext: %s" % pending_next
|
||||
return pending_text
|
||||
if battle_result_summary.get("already_completed", false):
|
||||
var already_saved := "Campaign saved." if battle_result_summary.get("saved", false) else "Campaign save failed."
|
||||
var already_saved := "Campaign unchanged." if battle_result_summary.get("saved", false) else "Campaign replay failed."
|
||||
var already_next := str(battle_result_summary.get("next_scenario_title", ""))
|
||||
if already_next.is_empty():
|
||||
return "Rewards already claimed.\n%s" % already_saved
|
||||
|
||||
Reference in New Issue
Block a user