Add chapter overview briefing menu
This commit is contained in:
@@ -650,6 +650,33 @@ func get_scenario_count_in_chapter(scenario_id: String) -> int:
|
||||
return scenario_ids.size()
|
||||
|
||||
|
||||
func get_chapter_progress_entries() -> Array:
|
||||
var entries := []
|
||||
for chapter_index in range(chapter_order.size()):
|
||||
var chapter_id := chapter_order[chapter_index]
|
||||
var scenario_ids: Array = chapter_scenario_ids.get(chapter_id, [])
|
||||
var completed_count := 0
|
||||
var current_in_chapter := false
|
||||
var current_scenario_title := ""
|
||||
for scenario_id in scenario_ids:
|
||||
if completed_scenarios.has(scenario_id):
|
||||
completed_count += 1
|
||||
if scenario_id == current_scenario_id:
|
||||
current_in_chapter = true
|
||||
current_scenario_title = get_scenario_title(scenario_id)
|
||||
entries.append({
|
||||
"id": chapter_id,
|
||||
"title": str(chapter_titles.get(chapter_id, chapter_id)),
|
||||
"position": chapter_index + 1,
|
||||
"chapter_count": chapter_order.size(),
|
||||
"completed": completed_count,
|
||||
"total": scenario_ids.size(),
|
||||
"current": current_in_chapter,
|
||||
"current_scenario_title": current_scenario_title
|
||||
})
|
||||
return entries
|
||||
|
||||
|
||||
func get_next_scenario_id(scenario_id: String) -> String:
|
||||
var index := scenario_order.find(scenario_id)
|
||||
if index == -1 or index + 1 >= scenario_order.size():
|
||||
|
||||
Reference in New Issue
Block a user