Add core game retry flow and question stats

This commit is contained in:
hz
2026-07-10 14:05:57 -05:00
parent 1822c00a3b
commit e991dccbb2
17 changed files with 1036 additions and 80 deletions
+15 -2
View File
@@ -13,6 +13,8 @@ var start_button: Button
func _ready() -> void:
set_anchors_preset(Control.PRESET_FULL_RECT)
add_theme_constant_override("separation", 16)
if not QuestionBankService.questions_changed.is_connected(_refresh_setup):
QuestionBankService.questions_changed.connect(_refresh_setup)
var title := Label.new()
title.text = "Block Setup"
@@ -66,12 +68,23 @@ func _ready() -> void:
func on_show(payload: Variant = null) -> void:
selected_system = str(payload) if payload != null else "All Systems"
_refresh_setup()
func _refresh_setup() -> void:
if system_label == null:
return
system_label.text = "Zone: %s" % selected_system
var available := QuestionBankService.get_questions_for_system(selected_system).size()
size_spin.max_value = max(1, available)
size_spin.value = min(size_spin.value, available)
start_button.disabled = available == 0
status_label.text = QuestionBankService.last_error if available == 0 else ""
start_button.disabled = available == 0 or QuestionBankService.is_loading
if QuestionBankService.is_loading:
status_label.text = "Question API unavailable. Retrying in %d seconds..." % QuestionBankService.next_retry_seconds if QuestionBankService.load_state == "retrying" else "Loading question bank..."
elif available == 0:
status_label.text = QuestionBankService.last_error if QuestionBankService.last_error != "" else "No questions are available for this zone yet."
else:
status_label.text = "%d questions available." % available
func _start_block() -> void: