Establishes the faux-game-menu base pattern for non-diegetic UI, analogous to ImplantApp but for pre-gameplay and meta-overlay screens (main menu, character creation, settings, debug console, bug report, loading screen). Workstream 1 of the MetaScreen refactor — foundation only, no screen migrations yet. - client/ui/meta/meta_screen.gd: base class (Control) with HIDDEN/OPENING/OPEN/CLOSING phase tracking, three orthogonal policy booleans (pauses_sim, closable_by_escape, captures_input), open/close lifecycle, on_escape contract, closed + escape_pressed signals, subclass hooks (on_open, on_close). - client/ui/meta/meta_stack.gd: autoload coordinator. Overlay stack with push/pop/top/is_active; handle_escape chain; sim-pause coordination via SimBridge when pauses_sim=true; meta_active_changed signal. All class references kept inside method bodies — no top-level class_name refs, matching HudGroups / GameState autoload parse-order discipline. - client/scripts/character_profile.gd: Resource wrapping the visual descriptor with bookmark_id and start_location_id. Target of the creation_confirmed signal once the character creation flow migrates. - client/project.godot: MetaStack registered as autoload after HudGroups, before ImplantRegistry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
61 lines
1.2 KiB
GDScript
61 lines
1.2 KiB
GDScript
class_name MetaScreen
|
|
extends Control
|
|
## Base class for all meta-UI screens (#618, #680).
|
|
## Scene-root screens (main_menu, character_creation) extend this for the
|
|
## lifecycle contract. Overlay screens (settings, debug_console, bug_report,
|
|
## loading_screen) extend this AND push onto MetaStack.
|
|
|
|
signal closed
|
|
signal escape_pressed
|
|
|
|
enum Phase { HIDDEN, OPENING, OPEN, CLOSING }
|
|
|
|
@export var pauses_sim: bool = false
|
|
@export var closable_by_escape: bool = true
|
|
@export var captures_input: bool = true
|
|
|
|
var _phase: Phase = Phase.HIDDEN
|
|
|
|
|
|
func open() -> void:
|
|
if _phase != Phase.HIDDEN:
|
|
return
|
|
_phase = Phase.OPENING
|
|
visible = true
|
|
if captures_input:
|
|
mouse_filter = Control.MOUSE_FILTER_STOP
|
|
on_open()
|
|
_phase = Phase.OPEN
|
|
|
|
|
|
func close() -> void:
|
|
if _phase != Phase.OPEN:
|
|
return
|
|
_phase = Phase.CLOSING
|
|
on_close()
|
|
visible = false
|
|
_phase = Phase.HIDDEN
|
|
closed.emit()
|
|
|
|
|
|
func is_open() -> bool:
|
|
return _phase == Phase.OPEN
|
|
|
|
|
|
## Called by MetaStack when ESC is pressed with this screen on top.
|
|
## Return true to consume the event (prevent stack pop); false to allow pop.
|
|
func on_escape() -> bool:
|
|
escape_pressed.emit()
|
|
return false
|
|
|
|
|
|
# --- Lifecycle hooks — subclasses override ---
|
|
|
|
|
|
func on_open() -> void:
|
|
pass
|
|
|
|
|
|
func on_close() -> void:
|
|
pass
|