Phase 8: Free Play ready-up system + client scenes
Server (Phase A): - CustomLobby: +HostReady/GuestReady/HostFirstTurnPref/GuestFirstTurnPref/MaxPlayers - Migration: AddReadyUpSystem — applied to prod DB - GameJoinCustomLobbyHandler: no longer auto-creates session; sets Full status, resets readiness, pushes CustomLobbyGuestJoinedPush to host - GameLobbyReadyHandler (NEW): game.custom.lobby.ready — marks caller ready, resolves first-turn, creates session + pushes game.custom.started when all ready - GameUnreadyHandler (NEW): game.custom.lobby.unready - GameChangeLobbyDeckHandler (NEW): game.custom.lobby.change_deck - GameUpdateLobbyRulesHandler (NEW): game.custom.update_rules (host only) - GameListActiveLobbiesHandler (NEW): game.custom.list_active (Status==Started) - GameListCustomLobbiesHandler: now batch-loads host/guest display names - GameMessages: +LobbyReadyRequest/Response, UnreadyInLobbyRequest/Response, ChangeLobbyDeckRequest/Response, UpdateLobbyRulesRequest/Response, ListActiveLobbiesRequest/Response, LobbyReadyStatusPush, LobbyDeckChangedPush, ActiveLobbyDto; CustomLobbyDto +HostDisplayName/GuestDisplayName - ServiceRegistration: register 5 new handlers Client (Phase B): - CustomLobby.gd: new autoload for Free Play lobby state + all server calls - project.godot: register CustomLobby autoload - MainScreen: +Free Play button → FreePlayScreen.tscn - FreePlayScreen (NEW): Open Lobbies tab + Active Games tab + Create dialog - LobbyRoomScreen (NEW): ready-up UI, first-turn selector, preset voting - Game.gd: +is_spectating, +start_spectating(), +stop_spectating() - game_screen.gd: spectator mode — SPECTATING label, hidden action buttons, neutral HUD labels, stop_spectating() on exit 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>
This commit is contained in:
@@ -38,6 +38,7 @@ signal inactive_warning(session_id: String)
|
||||
var session_id : String = ""
|
||||
var state : Dictionary = {}
|
||||
var opponent_name : String = ""
|
||||
var is_spectating : bool = false
|
||||
|
||||
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -50,6 +51,30 @@ func _clear_state() -> void:
|
||||
session_id = ""
|
||||
state = {}
|
||||
opponent_name = ""
|
||||
is_spectating = false
|
||||
|
||||
|
||||
## Start spectating a game session. State is applied from the server ack.
|
||||
func start_spectating(sid: String) -> void:
|
||||
is_spectating = true
|
||||
state = {}
|
||||
session_id = sid
|
||||
Network.request("game.spectate",
|
||||
{ "sessionId": sid },
|
||||
func(_t: String, p: Variant) -> void:
|
||||
print("[Game] <<< game.spectate.ack")
|
||||
_apply_state_from_payload(p),
|
||||
func(code: String, msg: String) -> void:
|
||||
print("[Game] ERR spectate ", code, " ", msg)
|
||||
is_spectating = false)
|
||||
|
||||
|
||||
## Stop spectating the current session.
|
||||
func stop_spectating() -> void:
|
||||
if not is_spectating: return
|
||||
Network.send("game.spectate.stop", { "sessionId": session_id })
|
||||
is_spectating = false
|
||||
_clear_state()
|
||||
|
||||
# ── Public helpers ────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user