feat: Implement comprehensive lobby system with main menu, room management, and loading screen.
This commit is contained in:
@@ -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."""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
extends Control
|
||||
extends CanvasLayer
|
||||
|
||||
@export var tips: Array[String] = [
|
||||
"Use your cards wisely!",
|
||||
@@ -79,6 +79,14 @@ func change_scene(resource: PackedScene):
|
||||
|
||||
get_tree().change_scene_to_packed(resource)
|
||||
|
||||
# Update label to show we are initializing the game world
|
||||
if scene_name_label:
|
||||
scene_name_label.text = "Preparing Game..."
|
||||
|
||||
# Wait for assets (Tektons, Spawn Tiles) to initialize in the background
|
||||
# This keeps the loading screen visible while main.gd runs its _ready() setup
|
||||
await get_tree().create_timer(1.2).timeout
|
||||
|
||||
# Clean up self (Loading Screen)
|
||||
queue_free()
|
||||
|
||||
@@ -86,7 +94,7 @@ func change_scene(resource: PackedScene):
|
||||
func load_level(_path: String):
|
||||
print("Starting load for: ", _path)
|
||||
path = _path
|
||||
show()
|
||||
visible = true
|
||||
content_control.show()
|
||||
|
||||
if scene_name_label:
|
||||
|
||||
Reference in New Issue
Block a user