e59cf158e5
- api_client.gd: get_avatar_loadout() / save_avatar_loadout() - main_menu.gd: on successful auth (fresh or session-restore), load the catalog + fetch the saved loadout into AvatarSystem so the in-world player renders as the player's avatar. Best-effort: a slow/failed prime never gates getting in (UI goes authenticated first, prime runs after). New "Customize Avatar" button (enabled only when signed in). - avatar_system.gd: local-player convenience API -- ensure_catalog(), set_loadout_from_dict() (from the backend's GET shape), has_loadout(), build_current_avatar(). - player.gd: swaps the placeholder capsule for the assembled avatar (feet-aligned to the capsule bottom) when a loadout is primed; silent fallback to the capsule otherwise. Camera stays first-person for now (third-person is a noted follow-up). - avatar_visualizer.gd: rewrote it -- the old version referenced AvatarLoader.SlotResult / load_slot() which never existed, so it didn't compile and took avatar_customization_ui.gd down with it. Now a thin wrapper over AvatarLoader for the preview. - avatar_customization_ui.gd: seeds from the live loadout, saves through to AvatarSystem + PUT /api/avatar/loadout (local file kept as fallback), fixed a Camera3D.look_at() before-in-tree crash. - scenes/avatar_customization.tscn rebuilt (old one used the Godot-3 `ViewportContainer` node type) + avatar_customization_screen.gd wrapper that returns to the menu on close. - smoke_test_avatar_in_world.gd: primed loadout -> game.tscn -> player shows the assembled avatar, capsule hidden, rig + bone mounts present. Verified: cold-cache smokes green (player 15/15, avatar_system 14/14, avatar_in_world 10/10, main_menu_ui 13/13); against a live backend main_menu_full_flow 12/12, main_menu_back 20/20, world_list 4/4, enter_world 9/9, e2e 4/4; plus a manual register->default-loadout-> customize->save->re-fetch-persisted round trip. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015jtxAiu5dAW4WxCNdGkrkJ
134 lines
4.9 KiB
Plaintext
134 lines
4.9 KiB
Plaintext
[gd_scene load_steps=2 format=3 uid="uid://main_menu_scene"]
|
|
|
|
[ext_resource type="Script" path="res://scripts/main_menu.gd" id="1_main"]
|
|
|
|
[node name="MainMenu" type="Control"]
|
|
anchors_preset = 15
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
script = ExtResource("1_main")
|
|
|
|
[node name="CenterContainer" type="CenterContainer" parent="."]
|
|
layout_mode = 3
|
|
anchors_preset = 15
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
|
|
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
|
layout_mode = 1
|
|
theme_override_constants/separation = 16
|
|
size_flags_horizontal = 4
|
|
|
|
[node name="TitleLabel" type="Label" parent="CenterContainer/VBoxContainer"]
|
|
layout_mode = 1
|
|
text = "AGP Game"
|
|
horizontal_alignment = 1
|
|
theme_override_font_sizes/font_size = 72
|
|
|
|
[node name="AuthButtonsRow" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
|
|
layout_mode = 1
|
|
theme_override_constants/separation = 16
|
|
alignment = 1
|
|
|
|
[node name="LoginButton" type="Button" parent="CenterContainer/VBoxContainer/AuthButtonsRow"]
|
|
layout_mode = 1
|
|
text = "Login"
|
|
size_flags_horizontal = 3
|
|
|
|
[node name="RegisterButton" type="Button" parent="CenterContainer/VBoxContainer/AuthButtonsRow"]
|
|
layout_mode = 1
|
|
text = "Register"
|
|
size_flags_horizontal = 3
|
|
|
|
[node name="AuthPanel" type="PanelContainer" parent="CenterContainer/VBoxContainer"]
|
|
layout_mode = 1
|
|
visible = false
|
|
|
|
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/VBoxContainer/AuthPanel"]
|
|
layout_mode = 1
|
|
theme_override_constants/margin_left = 24
|
|
theme_override_constants/margin_top = 24
|
|
theme_override_constants/margin_right = 24
|
|
theme_override_constants/margin_bottom = 24
|
|
|
|
[node name="AuthVBox" type="VBoxContainer" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer"]
|
|
layout_mode = 1
|
|
theme_override_constants/separation = 8
|
|
size_flags_horizontal = 3
|
|
|
|
[node name="AuthModeLabel" type="Label" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"]
|
|
layout_mode = 1
|
|
text = "Login"
|
|
horizontal_alignment = 1
|
|
theme_override_font_sizes/font_size = 24
|
|
|
|
[node name="UsernameEdit" type="LineEdit" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"]
|
|
layout_mode = 1
|
|
placeholder_text = "Username"
|
|
size_flags_horizontal = 3
|
|
|
|
[node name="PasswordEdit" type="LineEdit" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"]
|
|
layout_mode = 1
|
|
placeholder_text = "Password"
|
|
size_flags_horizontal = 3
|
|
echo_password = true
|
|
|
|
[node name="EmailEdit" type="LineEdit" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"]
|
|
layout_mode = 1
|
|
visible = false
|
|
placeholder_text = "Email"
|
|
size_flags_horizontal = 3
|
|
|
|
[node name="Over18Check" type="CheckBox" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"]
|
|
layout_mode = 1
|
|
visible = false
|
|
text = "I am 18 or older"
|
|
size_flags_horizontal = 3
|
|
|
|
[node name="AuthButton" type="Button" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"]
|
|
layout_mode = 1
|
|
text = "Login"
|
|
size_flags_horizontal = 3
|
|
|
|
[node name="AuthStatusLabel" type="Label" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"]
|
|
layout_mode = 1
|
|
text = ""
|
|
horizontal_alignment = 1
|
|
autowrap_mode = 2
|
|
visible = false
|
|
|
|
[node name="WelcomeLabel" type="Label" parent="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox"]
|
|
layout_mode = 1
|
|
visible = false
|
|
text = ""
|
|
horizontal_alignment = 1
|
|
|
|
[node name="PlayButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
|
layout_mode = 1
|
|
text = "Play"
|
|
size_flags_horizontal = 4
|
|
|
|
[node name="CustomizeButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
|
layout_mode = 1
|
|
text = "Customize Avatar"
|
|
size_flags_horizontal = 4
|
|
disabled = true
|
|
|
|
[node name="QuitButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
|
layout_mode = 1
|
|
text = "Quit"
|
|
size_flags_horizontal = 4
|
|
|
|
[connection signal="pressed" from="CenterContainer/VBoxContainer/AuthButtonsRow/LoginButton" to="." method="_on_login_button_pressed"]
|
|
[connection signal="pressed" from="CenterContainer/VBoxContainer/AuthButtonsRow/RegisterButton" to="." method="_on_register_button_pressed"]
|
|
[connection signal="pressed" from="CenterContainer/VBoxContainer/PlayButton" to="." method="_on_play_button_pressed"]
|
|
[connection signal="pressed" from="CenterContainer/VBoxContainer/CustomizeButton" to="." method="_on_customize_button_pressed"]
|
|
[connection signal="pressed" from="CenterContainer/VBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"]
|
|
[connection signal="pressed" from="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthButton" to="." method="_on_auth_button_pressed"]
|
|
[connection signal="text_submitted" from="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/UsernameEdit" to="." method="_on_auth_button_pressed"]
|
|
[connection signal="text_submitted" from="CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/PasswordEdit" to="." method="_on_auth_button_pressed"]
|