feat: Implement Stop N Go game mode with phase management, mission objectives, and visual HUD elements.
This commit is contained in:
@@ -75,6 +75,10 @@ func connect_to_nakama_async(email: String = "", password: String = "") -> bool:
|
||||
|
||||
# 3. Initialize Multiplayer Bridge
|
||||
# This links Nakama's socket to Godot's High-Level Multiplayer API
|
||||
if bridge:
|
||||
bridge.leave()
|
||||
bridge = null
|
||||
|
||||
bridge = NakamaMultiplayerBridge.new(socket)
|
||||
|
||||
# Connect bridge signals
|
||||
@@ -89,6 +93,26 @@ func connect_to_nakama_async(email: String = "", password: String = "") -> bool:
|
||||
emit_signal("connected_to_nakama")
|
||||
return true
|
||||
|
||||
func cleanup():
|
||||
"""Properly shutdown the Nakama connection and reset the multiplayer peer."""
|
||||
print("[NakamaManager] Full cleanup starting...")
|
||||
|
||||
if bridge:
|
||||
bridge.leave()
|
||||
bridge = null
|
||||
|
||||
if socket:
|
||||
socket.close()
|
||||
socket = null
|
||||
|
||||
current_match_id = ""
|
||||
|
||||
# Reset Godot's multiplayer peer
|
||||
if multiplayer.get_multiplayer_peer():
|
||||
multiplayer.set_multiplayer_peer(null)
|
||||
|
||||
print("[NakamaManager] Cleanup complete.")
|
||||
|
||||
# --- Match Management ---
|
||||
|
||||
func host_game():
|
||||
@@ -172,5 +196,4 @@ func list_matches_async() -> Array:
|
||||
return rooms
|
||||
|
||||
func _exit_tree():
|
||||
if socket:
|
||||
socket.close()
|
||||
cleanup()
|
||||
|
||||
Reference in New Issue
Block a user