Fix null-session prompt, stale ready state, spectator UI, and admin cancel
- init_screen.gd: handle null sessionId from game.get_active_session.ack properly — str(null)="<null>" which passed the is_empty() check causing every player to see "active game in progress (null phase)" on login - CustomLobby.gd: call clear_state() at the start of create() and join() so that i_am_ready/partner_ready are reset between lobbies — fixes players appearing instantly ready when entering a new lobby after a previous game - game_screen.gd: in _setup_spectator_ui(), hide _settings_btn (prevents accessing the Concede button) and add a programmatic "Leave" button that calls Game.stop_spectating() and navigates back to FreePlayScreen - CustomLobbiesPage.razor: add Cancel button (admin) for Open/Full lobbies; directly sets Status=Cancelled and refreshes the list 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:
@@ -261,7 +261,7 @@ func _exit_tree() -> void:
|
||||
|
||||
|
||||
func _setup_spectator_ui() -> void:
|
||||
# "SPECTATING" overlay label.
|
||||
# "SPECTATING" label at top-center.
|
||||
var lbl := Label.new()
|
||||
lbl.text = "SPECTATING"
|
||||
lbl.modulate = Color(1.0, 0.76, 0.2)
|
||||
@@ -271,9 +271,21 @@ func _setup_spectator_ui() -> void:
|
||||
lbl.position = Vector2(0, 8)
|
||||
_hud.add_child(lbl)
|
||||
|
||||
# Hide action buttons — spectators can only watch.
|
||||
# "Leave" button for spectators (top-right corner).
|
||||
var leave_btn := Button.new()
|
||||
leave_btn.text = "Leave"
|
||||
leave_btn.set_anchors_preset(Control.PRESET_TOP_RIGHT)
|
||||
leave_btn.position = Vector2(-90, 8)
|
||||
leave_btn.custom_minimum_size = Vector2(80, 32)
|
||||
leave_btn.pressed.connect(func() -> void:
|
||||
Game.stop_spectating()
|
||||
get_tree().change_scene_to_file("res://scenes/free_play/FreePlayScreen.tscn"))
|
||||
_hud.add_child(leave_btn)
|
||||
|
||||
# Hide action buttons and the settings panel — spectators cannot interact with the game.
|
||||
_draw_btn.visible = false
|
||||
_end_turn_btn.visible = false
|
||||
_settings_btn.visible = false
|
||||
|
||||
# ── Environment ───────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user