Require API question loading
This commit is contained in:
@@ -8,6 +8,8 @@ var zone_list: GridContainer
|
||||
func _ready() -> void:
|
||||
set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
add_theme_constant_override("separation", 14)
|
||||
if not QuestionBankService.questions_changed.is_connected(_refresh_zones):
|
||||
QuestionBankService.questions_changed.connect(_refresh_zones)
|
||||
|
||||
var title := Label.new()
|
||||
title.text = "Study Map"
|
||||
@@ -27,9 +29,31 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func on_show(_payload: Variant = null) -> void:
|
||||
_refresh_zones()
|
||||
|
||||
|
||||
func _refresh_zones() -> void:
|
||||
if zone_list == null:
|
||||
return
|
||||
|
||||
for child in zone_list.get_children():
|
||||
child.queue_free()
|
||||
|
||||
if QuestionBankService.is_loading:
|
||||
var loading := Label.new()
|
||||
loading.text = "Loading question bank..."
|
||||
Style.set_label(loading, 20, Style.AMBER)
|
||||
zone_list.add_child(loading)
|
||||
return
|
||||
|
||||
if not QuestionBankService.has_questions():
|
||||
var empty := Label.new()
|
||||
empty.text = QuestionBankService.last_error if QuestionBankService.last_error != "" else "No API questions loaded."
|
||||
empty.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
Style.set_label(empty, 20, Style.RED)
|
||||
zone_list.add_child(empty)
|
||||
return
|
||||
|
||||
var systems: Array[String] = ["All Systems"]
|
||||
systems.append_array(QuestionBankService.get_systems())
|
||||
var stats: Dictionary = ProfileService.get_profile().get("system_stats", {})
|
||||
|
||||
Reference in New Issue
Block a user