- Chat bubble now hidden on all scenes; MainScreen shows/hides it via Chat.set_bubble_visible() in _ready/_exit_tree - send_friend_request now uses Network.request so _fetch_social() fires on success, making the friends list update immediately after adding - Added DM close button (✕) to each conversation row in the DMs tab; _close_dm removes the channel from local state via Chat.close_dm() Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
70 lines
2.7 KiB
GDScript
70 lines
2.7 KiB
GDScript
extends Control
|
|
## Main hub screen — shown after successful authentication.
|
|
##
|
|
## Session expiry is handled centrally by Auth.gd, which calls logout() and
|
|
## navigates to LoginScreen when auth.hello is rejected on reconnect.
|
|
|
|
@onready var welcome_label : Label = %WelcomeLabel
|
|
@onready var status_label : Label = %StatusLabel
|
|
@onready var logout_btn : Button = %LogoutBtn
|
|
@onready var collection_btn : Button = %CollectionBtn
|
|
@onready var bazaar_btn : Button = %BazaarBtn
|
|
@onready var leaderboard_btn : Button = %LeaderboardBtn
|
|
@onready var account_btn : Button = %AccountBtn
|
|
@onready var settings_btn : Button = %SettingsBtn
|
|
@onready var report_bug_btn : Button = %ReportBugBtn
|
|
@onready var bug_report_dialog = %BugReportDialog
|
|
|
|
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
|
|
|
func _ready() -> void:
|
|
welcome_label.text = "Welcome, %s!" % Auth.display_name
|
|
Chat.set_bubble_visible(true)
|
|
|
|
Network.connected.connect(_update_status)
|
|
Network.disconnected.connect(_update_status)
|
|
_update_status()
|
|
|
|
logout_btn.pressed.connect(_on_logout_pressed)
|
|
|
|
collection_btn.pressed.connect(func():
|
|
get_tree().change_scene_to_file("res://scenes/collection/CollectionScreen.tscn"))
|
|
|
|
bazaar_btn.pressed.connect(func():
|
|
get_tree().change_scene_to_file("res://scenes/bazaar/BazaarScreen.tscn"))
|
|
|
|
leaderboard_btn.pressed.connect(func():
|
|
get_tree().change_scene_to_file("res://scenes/leaderboard/LeaderboardScreen.tscn"))
|
|
|
|
account_btn.pressed.connect(func():
|
|
get_tree().change_scene_to_file("res://scenes/account/AccountScreen.tscn"))
|
|
|
|
settings_btn.pressed.connect(func():
|
|
get_tree().change_scene_to_file("res://scenes/settings/SettingsScreen.tscn"))
|
|
|
|
report_bug_btn.pressed.connect(func():
|
|
bug_report_dialog.popup_centered())
|
|
|
|
|
|
func _exit_tree() -> void:
|
|
Chat.set_bubble_visible(false)
|
|
if Network.connected.is_connected(_update_status):
|
|
Network.connected.disconnect(_update_status)
|
|
if Network.disconnected.is_connected(_update_status):
|
|
Network.disconnected.disconnect(_update_status)
|
|
|
|
# ── Signal handlers ───────────────────────────────────────────────────────────
|
|
|
|
func _update_status() -> void:
|
|
if Network.is_online():
|
|
status_label.text = "● Online"
|
|
status_label.modulate = Color(0.3, 0.9, 0.4)
|
|
else:
|
|
status_label.text = "● Reconnecting…"
|
|
status_label.modulate = Color(1.0, 0.8, 0.2)
|
|
|
|
|
|
func _on_logout_pressed() -> void:
|
|
Auth.logout()
|
|
get_tree().change_scene_to_file("res://scenes/login/LoginScreen.tscn")
|