78 lines
3.2 KiB
C#
78 lines
3.2 KiB
C#
using System;
|
||
using UnityEngine;
|
||
|
||
// config_N.json 的內容 : 當下完整的 GameSettings + 這一回合的資訊
|
||
// 直接繼承 GameSettings,之後 StartUI 多了什麼設定,這裡會自動跟著記錄
|
||
// 輔助欄位以這一回合實際套用的條件為準 (自動配置時不是 StartUI 存的值)
|
||
[Serializable]
|
||
public class RoundConfig : GameSettings
|
||
{
|
||
// 回合資訊 (時間都是 Time.realtimeSinceStartupAsDouble 時間軸,跟 CSV 一致)
|
||
public int roundIndex;
|
||
public string startTimeLocal; // 開始的實際時間 (ISO 8601)
|
||
public double startTime;
|
||
public double endTime;
|
||
public double duration;
|
||
public double pausedSeconds;
|
||
|
||
// 摘要
|
||
public int shots;
|
||
public int hits;
|
||
public int mouseEvents;
|
||
public int frames;
|
||
|
||
// 重現與分析用
|
||
public int recoilSeed; // v1.1.0 起 = roundSeed
|
||
public float cameraVerticalFov;
|
||
public float fixedDeltaTime;
|
||
public string appVersion;
|
||
public string unityVersion;
|
||
|
||
// v1.1.0 : 協定、build 與排程 (自由模式的 planIndex / blockIndex / orderInBlock 為 -1)
|
||
public string protocolVersion;
|
||
public string buildId; // 出包時的 git commit 短碼,分辨同版號的不同 build
|
||
public string sessionId; // 這次執行的代號 (= 資料夾 / zip 的時間戳)
|
||
public int planSeed; // 排程種子
|
||
public int planIndex; // 排程中的第幾項 (熱身 0~4,正式 5~84)
|
||
public int blockIndex; // 區塊 0~7,熱身 -1
|
||
public int orderInBlock; // 區塊內 0~9,熱身 -1
|
||
public bool isWarmup; // 熱身回合 (分析時排除)
|
||
public float assistFovDeg; // 作用範圍 (度),無輔助為 0
|
||
public int roundSeed; // 這一回合的亂數種子
|
||
public int targetFps; // Application.targetFrameRate,-1 = 不限制
|
||
public int vSyncCount;
|
||
|
||
public static RoundConfig Create(int index, SessionPlan.RoundCondition condition)
|
||
{
|
||
RoundConfig c = new RoundConfig();
|
||
JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(Load()), c); // 複製目前存檔的設定
|
||
|
||
c.assistMode = condition.assistMode;
|
||
c.assistStrength = condition.assistStrength;
|
||
c.assistDelayMs = condition.assistDelayMs;
|
||
c.assistDelayJitterMs = condition.assistDelayJitterMs;
|
||
|
||
c.roundIndex = index;
|
||
c.startTimeLocal = DateTime.Now.ToString("o");
|
||
c.startTime = Time.realtimeSinceStartupAsDouble;
|
||
c.fixedDeltaTime = Time.fixedDeltaTime;
|
||
c.appVersion = Application.version;
|
||
c.unityVersion = Application.unityVersion;
|
||
|
||
c.protocolVersion = SessionPlan.ProtocolVersion;
|
||
c.buildId = BuildInfo.Id;
|
||
c.sessionId = SessionPlan.SessionId;
|
||
c.planSeed = SessionPlan.PlanSeed;
|
||
c.planIndex = condition.planIndex;
|
||
c.blockIndex = condition.blockIndex;
|
||
c.orderInBlock = condition.orderInBlock;
|
||
c.isWarmup = condition.isWarmup;
|
||
c.assistFovDeg = condition.assistFovDeg;
|
||
c.roundSeed = condition.roundSeed;
|
||
c.recoilSeed = condition.roundSeed;
|
||
c.targetFps = Application.targetFrameRate;
|
||
c.vSyncCount = QualitySettings.vSyncCount;
|
||
return c;
|
||
}
|
||
}
|