32 lines
1.0 KiB
GDScript
32 lines
1.0 KiB
GDScript
extends Control
|
|
## Full-screen host for the AvatarCustomizationUI.
|
|
##
|
|
## The UI itself (scripts/avatar/avatar_customization_ui.gd) builds its own
|
|
## layout programmatically, auto-saves on exit, and emits `closed` / `back_requested`
|
|
## when the player backs out. This thin wrapper hosts it as a navigable scene
|
|
## reachable from the main menu and handles ESC / back transitions.
|
|
|
|
const AvatarCustomizationUI := preload("res://scripts/avatar/avatar_customization_ui.gd")
|
|
|
|
|
|
func _ready() -> void:
|
|
var ui := AvatarCustomizationUI.new()
|
|
ui.name = "AvatarCustomizationUI"
|
|
ui.set_anchors_preset(Control.PRESET_FULL_RECT)
|
|
add_child(ui)
|
|
ui.closed.connect(_on_closed)
|
|
|
|
|
|
func _on_closed() -> void:
|
|
get_tree().change_scene_to_file("res://scenes/main_menu.tscn")
|
|
|
|
|
|
func _unhandled_input(event: InputEvent) -> void:
|
|
if event.is_action_pressed("ui_cancel"):
|
|
get_viewport().set_input_as_handled()
|
|
var ui = get_node_or_null("AvatarCustomizationUI")
|
|
if ui != null and ui.has_method("save_and_exit"):
|
|
ui.save_and_exit()
|
|
else:
|
|
_on_closed()
|