Move Custom Battle to lobby with OAuth authentication (#5051)

* Move Custom Battle to lobby, use OAuth authentication

- Remove _createConnection() from _internalCustomBattle() since connection
  already exists when called from lobby
- Hide gameSelectionPanel instead of connectionPanel when entering custom battle
- Add customBattleButton field for lobby UI button
- Add cancelCustomBattleButton and CancelCustomBattle() to return to lobby
- Wire up button click handlers in SetupLobbyUI()

The Custom Battle button should now be placed in the gameSelectionPanel (lobby)
in Unity and assigned to the customBattleButton field. A cancel button in the
customBattlePanel should be assigned to cancelCustomBattleButton.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Wire up Custom Battle and Cancel buttons in Unity scene

- Assign customBattleButton in lobby panel
- Assign cancelCustomBattleButton in custom battle panel

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix CancelCustomBattle to properly reset canvas states

Hide shardokCanvas and ensure connectionCanvas is visible when
returning to lobby from custom battle.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix Back button onClick handler in custom battle panel

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-04 13:32:34 -08:00
committed by GitHub
co-authored by Claude Opus 4.5
parent f4aa19119b
commit 811de67c40
2 changed files with 1315 additions and 1037 deletions
@@ -112,6 +112,8 @@ public class ConnectionHandler : MonoBehaviour, ILobbySubscriber, IDisposable {
[Header("Lobby Controls")]
public Button logoutButton;
public Button customBattleButton;
public Button cancelCustomBattleButton;
public TextMeshProUGUI lobbyEnvironmentText;
public TextMeshProUGUI lobbyUserText;
@@ -276,6 +278,10 @@ public class ConnectionHandler : MonoBehaviour, ILobbySubscriber, IDisposable {
private void SetupLobbyUI() {
if (logoutButton != null) { logoutButton.onClick.AddListener(OnLogoutClicked); }
if (customBattleButton != null) { customBattleButton.onClick.AddListener(CustomBattle); }
if (cancelCustomBattleButton != null) {
cancelCustomBattleButton.onClick.AddListener(CancelCustomBattle);
}
}
private void UpdateLobbyStatusDisplays() {
@@ -501,6 +507,14 @@ public class ConnectionHandler : MonoBehaviour, ILobbySubscriber, IDisposable {
public void CustomBattle() { _internalCustomBattle(); }
public void CancelCustomBattle() {
customBattlePanel.SetActive(false);
shardokCanvas.gameObject.SetActive(false);
connectionCanvas.gameObject.SetActive(true);
gameSelectionPanel.SetActive(true);
StartListeningForLobbyUpdates();
}
public void OnApplicationQuit() { Dispose(); }
public void Dispose() {
@@ -666,12 +680,12 @@ public class ConnectionHandler : MonoBehaviour, ILobbySubscriber, IDisposable {
}
private void _internalCustomBattle() {
_createConnection();
// Connection already exists when called from lobby
_persistentClientConnection.SetLobbySubscriber(this);
SetCustomBattleActive(true);
connectionPanel.SetActive(false);
gameSelectionPanel.SetActive(false);
customBattlePanel.SetActive(true);
}
File diff suppressed because it is too large Load Diff