feat: Implement comprehensive lobby system with main menu, room management, and loading screen.

This commit is contained in:
Yogi Wiguna
2026-03-17 12:02:20 +08:00
parent b877f94e34
commit 6eb6dfa20d
5 changed files with 71 additions and 37 deletions
+8 -6
View File
@@ -290,19 +290,21 @@ func leave_room() -> void:
reset()
_stop_lan_broadcast()
# Emit before nulling peer so UI can still access peer info if needed
emit_signal("room_left")
if is_lan_mode:
# LAN mode: just close the ENet peer directly
if multiplayer.has_multiplayer_peer():
multiplayer.set_multiplayer_peer(null)
is_lan_mode = false
# LAN mode: Host should keep peer alive long enough to reach lobby
if not is_host or get_tree().current_scene.name == "Lobby":
if multiplayer.has_multiplayer_peer():
multiplayer.set_multiplayer_peer(null)
is_lan_mode = false
else:
# Nakama mode: full Nakama cleanup
NakamaManager.cleanup()
# Important: Clean up game state as well to prevent ghost players
GameStateManager.reset()
emit_signal("room_left")
func refresh_room_list() -> void:
"""Request updated room list from Nakama or scan for LAN rooms."""