Removes the version-mismatch guard from Protocol.decode_snapshot() and the PROTOCOL_VERSION constant from the client (server side done in #874). Core changes: - protocol.gd: remove const PROTOCOL_VERSION, remove version mismatch guard, remove "version" from return dict, add gauntlet_mode/room_id decode - sim_bridge.gd: remove handshake version check; relax handshake guard to require only a valid Dictionary (server no longer sends protocol_version); emit handshake_complete(0) for API compat - loading_screen.gd: drop "· protocol N" suffix from version label - test_harness.gd: replace Protocol.PROTOCOL_VERSION with literal 23 Test updates (21 files): replace "version": Protocol.PROTOCOL_VERSION with "version": 23 in all snapshot bytes dicts; remove snapshot.version == N assertions; remove version-rejection tests (test_rejects_version_6, test_decode_snapshot_rejects_missing_version, test_decode_snapshot_rejects_old_version, test_protocol_rejects_version_mismatch, test_sim_bridge_test_snapshot_uses_current_protocol_version). Also includes: #872 bookmark_catalog carry-forward regression test, and #873 merge-path flow tests (test_merge_path_flows_sprint37.gd). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
89 lines
2.8 KiB
GDScript
89 lines
2.8 KiB
GDScript
extends MetaScreen
|
|
## #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.
|
|
## #724: Shows client version (from project.yaml) and protocol version below the status text.
|
|
|
|
const BG_COLOR := Color(0.05, 0.05, 0.08, 1.0)
|
|
const TEXT_COLOR := Color("#c8d0e0")
|
|
const VERSION_COLOR := Color("#667788")
|
|
const FONT_SIZE := 18
|
|
const VERSION_FONT_SIZE := 11
|
|
|
|
var _label: Label = null
|
|
var _version_label: Label = null
|
|
|
|
|
|
func _ready() -> void:
|
|
closable_by_escape = false
|
|
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)
|
|
|
|
var client_ver := _read_client_version()
|
|
_version_label = Label.new()
|
|
_version_label.text = "v%s" % [client_ver]
|
|
_version_label.add_theme_font_size_override("font_size", VERSION_FONT_SIZE)
|
|
_version_label.add_theme_color_override("font_color", VERSION_COLOR)
|
|
_version_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
_version_label.anchor_left = 0.0
|
|
_version_label.anchor_right = 1.0
|
|
_version_label.anchor_top = 1.0
|
|
_version_label.anchor_bottom = 1.0
|
|
_version_label.offset_top = -32.0
|
|
_version_label.offset_bottom = -8.0
|
|
_version_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
add_child(_version_label)
|
|
|
|
|
|
func _read_client_version() -> String:
|
|
var yaml_path := ProjectSettings.globalize_path("res://") + "/../project.yaml"
|
|
if not FileAccess.file_exists(yaml_path):
|
|
return "?.?.?"
|
|
var file := FileAccess.open(yaml_path, FileAccess.READ)
|
|
if file == null:
|
|
return "?.?.?"
|
|
var content := file.get_as_text()
|
|
file.close()
|
|
for line: String in content.split("\n"):
|
|
if line.begins_with("version:"):
|
|
var parts := line.split(":", false, 1)
|
|
if parts.size() >= 2:
|
|
return parts[1].strip_edges()
|
|
return "?.?.?"
|
|
|
|
|
|
## Update the status text shown while loading. Call before show_loading() or after.
|
|
func set_message(text: String) -> void:
|
|
if _label != null:
|
|
_label.text = text
|
|
|
|
|
|
func show_loading() -> void:
|
|
MetaStack.push(self)
|
|
open()
|
|
|
|
|
|
## Hide the loading overlay. success=false is reserved for future failure-state UI.
|
|
func hide_loading(_success: bool = true) -> void:
|
|
close()
|