feat(ui): wire M8 social, M9 economy, and M10 discovery into main menu and in-game HUD
checkpoint / checkpoint (push) Successful in 5m54s
checkpoint / checkpoint (push) Successful in 5m54s
This commit is contained in:
+72
-12
@@ -39,8 +39,15 @@ var _dob_edit: LineEdit
|
||||
var _auth_button: Button
|
||||
var _status_label: Label
|
||||
var _welcome_label: Label
|
||||
var _discover_button: Button
|
||||
var _play_button: Button
|
||||
var _customize_button: Button
|
||||
var _social_button: Button
|
||||
var _chat_button: Button
|
||||
var _marketplace_button: Button
|
||||
var _wallet_button: Button
|
||||
var _groups_button: Button
|
||||
var _selling_button: Button
|
||||
var _quit_button: Button
|
||||
|
||||
var _is_register_mode: bool = false
|
||||
@@ -93,16 +100,22 @@ func _ready() -> void:
|
||||
_auth_button = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthButton
|
||||
_status_label = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthStatusLabel
|
||||
_welcome_label = $CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/WelcomeLabel
|
||||
_discover_button = $CenterContainer/VBoxContainer.get_node_or_null("DiscoverButton")
|
||||
_play_button = $CenterContainer/VBoxContainer/PlayButton
|
||||
_customize_button = $CenterContainer/VBoxContainer/CustomizeButton
|
||||
_social_button = $CenterContainer/VBoxContainer.get_node_or_null("SocialButton")
|
||||
_chat_button = $CenterContainer/VBoxContainer.get_node_or_null("ChatButton")
|
||||
_marketplace_button = $CenterContainer/VBoxContainer.get_node_or_null("MarketplaceButton")
|
||||
_wallet_button = $CenterContainer/VBoxContainer.get_node_or_null("WalletButton")
|
||||
_groups_button = $CenterContainer/VBoxContainer.get_node_or_null("GroupsButton")
|
||||
_selling_button = $CenterContainer/VBoxContainer.get_node_or_null("SellingButton")
|
||||
_quit_button = $CenterContainer/VBoxContainer/QuitButton
|
||||
|
||||
# Default to Play being gated. When a token exists, the async session
|
||||
# Default to navigation being gated. When a token exists, the async session
|
||||
# check below may take several frames (a real get_me() round-trip);
|
||||
# keeping the button disabled until validation succeeds prevents a fast
|
||||
# click from navigating to world_list with an expired/invalid token.
|
||||
_play_button.disabled = true
|
||||
_customize_button.disabled = true
|
||||
_set_nav_enabled(false)
|
||||
|
||||
# Check whether a valid session already exists (e.g. user logged in,
|
||||
# navigated to world_list, then clicked Back). If so, restore the
|
||||
@@ -122,6 +135,16 @@ func _ready() -> void:
|
||||
auth_state_ready.emit()
|
||||
|
||||
|
||||
func _set_nav_enabled(enabled: bool) -> void:
|
||||
var buttons = [
|
||||
_discover_button, _play_button, _customize_button, _social_button,
|
||||
_chat_button, _marketplace_button, _wallet_button, _groups_button, _selling_button
|
||||
]
|
||||
for b in buttons:
|
||||
if b != null and is_instance_valid(b):
|
||||
b.disabled = not enabled
|
||||
|
||||
|
||||
## Restore the UI to the authenticated state (Play enabled, welcome message
|
||||
## visible, auth buttons hidden). AuthPanel itself stays visible -- the
|
||||
## welcome label lives inside it, so hiding the panel hides the label too
|
||||
@@ -148,8 +171,7 @@ func _show_authenticated(username: String) -> void:
|
||||
_dob_edit.visible = false
|
||||
_auth_button.visible = false
|
||||
_auth_mode_label.visible = false
|
||||
_play_button.disabled = false
|
||||
_customize_button.disabled = false
|
||||
_set_nav_enabled(true)
|
||||
_auth_buttons_row.visible = false
|
||||
print("Restored authenticated session for: ", username)
|
||||
|
||||
@@ -163,18 +185,21 @@ func _reset_to_logged_out() -> void:
|
||||
_email_edit.visible = false
|
||||
_dob_edit.visible = false
|
||||
_dob_edit.text = ""
|
||||
_play_button.disabled = true # Gate play behind successful auth.
|
||||
_customize_button.disabled = true
|
||||
_set_nav_enabled(false)
|
||||
_update_auth_mode_ui()
|
||||
|
||||
|
||||
# ─── Play / Quit ──────────────────────────────────────────────────────────────
|
||||
# ─── Navigation ───────────────────────────────────────────────────────────────
|
||||
|
||||
func _on_discover_button_pressed() -> void:
|
||||
if _discover_button != null and _discover_button.disabled:
|
||||
return
|
||||
get_tree().change_scene_to_file("res://scenes/discovery_ui.tscn")
|
||||
|
||||
|
||||
func _on_play_button_pressed() -> void:
|
||||
if _play_button.disabled:
|
||||
return
|
||||
# Browse worlds is the first real screen past login -- actual gameplay
|
||||
# (joining a world) doesn't exist yet, browsing does.
|
||||
get_tree().change_scene_to_file("res://scenes/world_list.tscn")
|
||||
|
||||
|
||||
@@ -184,6 +209,42 @@ func _on_customize_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/avatar_customization.tscn")
|
||||
|
||||
|
||||
func _on_social_button_pressed() -> void:
|
||||
if _social_button != null and _social_button.disabled:
|
||||
return
|
||||
get_tree().change_scene_to_file("res://scenes/friends_presence_ui.tscn")
|
||||
|
||||
|
||||
func _on_chat_button_pressed() -> void:
|
||||
if _chat_button != null and _chat_button.disabled:
|
||||
return
|
||||
get_tree().change_scene_to_file("res://scenes/chat_ui.tscn")
|
||||
|
||||
|
||||
func _on_marketplace_button_pressed() -> void:
|
||||
if _marketplace_button != null and _marketplace_button.disabled:
|
||||
return
|
||||
get_tree().change_scene_to_file("res://scenes/marketplace_ui.tscn")
|
||||
|
||||
|
||||
func _on_wallet_button_pressed() -> void:
|
||||
if _wallet_button != null and _wallet_button.disabled:
|
||||
return
|
||||
get_tree().change_scene_to_file("res://scenes/wallet_ui.tscn")
|
||||
|
||||
|
||||
func _on_groups_button_pressed() -> void:
|
||||
if _groups_button != null and _groups_button.disabled:
|
||||
return
|
||||
get_tree().change_scene_to_file("res://scenes/groups_ui.tscn")
|
||||
|
||||
|
||||
func _on_selling_button_pressed() -> void:
|
||||
if _selling_button != null and _selling_button.disabled:
|
||||
return
|
||||
get_tree().change_scene_to_file("res://scenes/selling_payout_ui.tscn")
|
||||
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
@@ -301,8 +362,7 @@ func _on_auth_complete(result: Dictionary) -> void:
|
||||
_status_label.visible = false
|
||||
_welcome_label.text = "Welcome, %s!" % _username_edit.text.strip_edges()
|
||||
_welcome_label.visible = true
|
||||
_play_button.disabled = false
|
||||
_customize_button.disabled = false
|
||||
_set_nav_enabled(true)
|
||||
_auth_buttons_row.visible = false
|
||||
print("Auth successful. Token stored.")
|
||||
await _prime_avatar()
|
||||
|
||||
Reference in New Issue
Block a user