From 6a655628c8efd93be9819984eaec8c96447a0bca Mon Sep 17 00:00:00 2001
From: KoalaTrapLord <265133236+KoalaTrapLord@users.noreply.github.com>
Date: Sat, 28 Mar 2026 20:04:42 -0400
Subject: [PATCH] feat(#151): add Play Live button to SimulationController
---
.../Assets/Scripts/UI/SimulationController.cs | 74 +++++++++++++------
1 file changed, 50 insertions(+), 24 deletions(-)
diff --git a/unity-client/Assets/Scripts/UI/SimulationController.cs b/unity-client/Assets/Scripts/UI/SimulationController.cs
index 3274cd5..92ad20b 100644
--- a/unity-client/Assets/Scripts/UI/SimulationController.cs
+++ b/unity-client/Assets/Scripts/UI/SimulationController.cs
@@ -15,6 +15,7 @@ namespace CommanderAILab.UI
///
/// Simulator scene — configure and run multi-player simulations,
/// poll status, display results per deck.
+ /// Also provides a Play Live button that routes to the Battleground scene.
///
public class SimulationController : MonoBehaviour
{
@@ -22,6 +23,8 @@ namespace CommanderAILab.UI
[Header("Navigation")]
[SerializeField] private Button backButton;
[SerializeField] private Button startSimButton;
+ /// Routes to the Battleground scene for a live 4-player game.
+ [SerializeField] private Button playLiveButton;
// ── Config Panel ──────────────────────────────────────────────────────
[Header("Config")]
@@ -74,6 +77,9 @@ namespace CommanderAILab.UI
startSimButton.onClick.AddListener(OnStartSim);
retryButton.onClick.AddListener(OnStartSim);
+ // Play Live: save current deck selections and load Battleground scene
+ playLiveButton?.onClick.AddListener(OnPlayLive);
+
numPlayersSlider.minValue = 2;
numPlayersSlider.maxValue = 4;
numPlayersSlider.wholeNumbers = true;
@@ -83,12 +89,10 @@ namespace CommanderAILab.UI
errorPanel.SetActive(false);
- // Check for a deck exported from DeckBuilder
string simDeck = PlayerPrefs.GetString("SimDeck", "");
if (!string.IsNullOrEmpty(simDeck))
{
PlayerPrefs.DeleteKey("SimDeck");
- // Pre-populate deck dropdown 0 after decks load — stored for later
PlayerPrefs.SetString("_SimDeckPending", simDeck);
}
@@ -96,6 +100,29 @@ namespace CommanderAILab.UI
LoadAiProfiles();
}
+ // ── Play Live ─────────────────────────────────────────────────────────
+ private void OnPlayLive()
+ {
+ // Persist current deck selections so LobbySetupModal can pre-populate
+ var seats = new List