From 52762ee0aa92f329c38f9f15574bfbd80e91d8ff Mon Sep 17 00:00:00 2001 From: KoalaTrapLord Date: Wed, 18 Mar 2026 01:59:58 -0400 Subject: [PATCH] Unity U3: Add SimStatusModel.cs + SimStartResponse (#48) This file defines the SimStatusModel and SimStartResponse classes for mapping JSON responses from the API. --- .../Assets/Scripts/Models/SimStatusModel.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 unity-client/Assets/Scripts/Models/SimStatusModel.cs diff --git a/unity-client/Assets/Scripts/Models/SimStatusModel.cs b/unity-client/Assets/Scripts/Models/SimStatusModel.cs new file mode 100644 index 0000000..f672d1a --- /dev/null +++ b/unity-client/Assets/Scripts/Models/SimStatusModel.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace CommanderAILab.Models +{ + /// Maps to StartResponse from /api/lab/start. + [Serializable] + public class SimStartResponse + { + [JsonProperty("batchId")] public string batchId; + [JsonProperty("status")] public string status; + [JsonProperty("message")] public string message; + + public override string ToString() => $"Batch {batchId}: {status}"; + } + + /// Maps to StatusResponse from /api/lab/status/{id}. + [Serializable] + public class SimStatusModel + { + [JsonProperty("batchId")] public string batchId; + [JsonProperty("running")] public bool running; + [JsonProperty("completed")] public int completed; + [JsonProperty("total")] public int total; + [JsonProperty("threads")] public int threads; + [JsonProperty("elapsedMs")] public int elapsedMs; + [JsonProperty("error")] public string error; + [JsonProperty("simsPerSec")] public float simsPerSec; + [JsonProperty("run_id")] public string runId; + [JsonProperty("games_completed")] public int gamesCompleted; + [JsonProperty("total_games")] public int totalGames; + [JsonProperty("current_decks")] public List currentDecks; + + public override string ToString() => $"Batch {batchId}: {completed}/{total} ({(running ? "running" : "done")})"; + } +}