- Defer LOAD_GAME dispatch until SimBridge reaches CONNECTED (critical) - Guard _build_saves_list() against queue_free() race on rapid reopen - Disable save entries with empty newest_save, guard in _on_save_selected - Send before show_loading on F6 quickload, skip overlay on send failure - Clear pending_load_path in _on_new_game()/_on_continue() (stale path) - Add hide_loading(success: bool) API for future failure-state UI - Add test_save_load_flow_sprint21.gd covering LoadingScreen + GameState Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45 lines
1.3 KiB
GDScript
45 lines
1.3 KiB
GDScript
extends Control
|
|
## #257: Loading screen overlay — blocks input during save/load round-trip.
|
|
## Shown when LOAD_GAME fires; hidden when save_result arrives (success or failure).
|
|
## Full-screen, dark overlay with centered status text.
|
|
|
|
const BG_COLOR := Color(0.0, 0.0, 0.0, 0.75)
|
|
const TEXT_COLOR := Color("#c8d0e0")
|
|
const FONT_SIZE := 18
|
|
|
|
var _label: Label = null
|
|
|
|
|
|
func _ready() -> void:
|
|
visible = false
|
|
mouse_filter = Control.MOUSE_FILTER_STOP
|
|
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
_build_ui()
|
|
|
|
|
|
func _build_ui() -> void:
|
|
var bg := ColorRect.new()
|
|
bg.color = BG_COLOR
|
|
bg.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
bg.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
add_child(bg)
|
|
|
|
_label = Label.new()
|
|
_label.text = UIStrings.get_text("notifications.loading")
|
|
_label.add_theme_font_size_override("font_size", FONT_SIZE)
|
|
_label.add_theme_color_override("font_color", TEXT_COLOR)
|
|
_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
_label.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
add_child(_label)
|
|
|
|
|
|
func show_loading() -> void:
|
|
visible = true
|
|
|
|
|
|
## Hide the loading overlay. success=false is reserved for future failure-state UI.
|
|
func hide_loading(success: bool = true) -> void:
|
|
visible = false
|