Add host-configurable match settings persisted in settings
- GameSettings: 7 match fields (mode, hunter count, hide/seek/resolve durations, radar ping interval/lifetime) with authored defaults - MatchSettingSlider (new): enum-driven panel binder, seeds from settings, saves on change; lifetime label shows one decimal (invariant culture) - MatchManager: ApplyHostMatchSettings() on StartMatch (clamped); phase message now carries ping interval so clients tick correctly Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1468921ca2
commit
270c42d85b
4 files changed
+200
-14
No files matched your search
@@ -18,6 +18,18 @@ public static class GameSettings
|
||||
public float mouseSensitivity = global::MouseSensitivity.Default;
|
||||
public float masterVolume = global::MasterVolume.Default;
|
||||
public string playerName = "";
|
||||
|
||||
// Host-side match rules (Esc-menu Match Panel). Ranges are authored on the panel sliders; the
|
||||
// values are applied server-side in MatchManager.StartMatch (with defensive clamps there).
|
||||
// Defaults mirror the Main scene's authored MatchManager values, so a fresh Settings.json
|
||||
// starts matches exactly like before the panel existed.
|
||||
public int matchMode = 0; // MatchManager.MatchMode index (0 = Classic, 1 = Conversion)
|
||||
public int matchHunterCount = 1;
|
||||
public float matchHideDuration = 120f;
|
||||
public float matchSeekDuration = 300f;
|
||||
public float matchResolveDuration = 50f;
|
||||
public float matchRadarPingInterval = 30f;
|
||||
public float matchRadarPingLifetime = 1f;
|
||||
}
|
||||
|
||||
private static Data _data;
|
||||
@@ -60,6 +72,55 @@ public static class GameSettings
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>MatchManager.MatchMode enum index the host starts matches with (0 = Classic, 1 = Conversion).</summary>
|
||||
public static int MatchModeIndex
|
||||
{
|
||||
get => Store.matchMode;
|
||||
set { if (Store.matchMode != value) { Store.matchMode = value; Save(); } }
|
||||
}
|
||||
|
||||
/// <summary>How many randomly chosen players become Hunters at match start.</summary>
|
||||
public static int MatchHunterCount
|
||||
{
|
||||
get => Store.matchHunterCount;
|
||||
set { if (Store.matchHunterCount != value) { Store.matchHunterCount = value; Save(); } }
|
||||
}
|
||||
|
||||
/// <summary>HIDE phase length in seconds.</summary>
|
||||
public static float MatchHideDuration
|
||||
{
|
||||
get => Store.matchHideDuration;
|
||||
set { if (!Mathf.Approximately(Store.matchHideDuration, value)) { Store.matchHideDuration = value; Save(); } }
|
||||
}
|
||||
|
||||
/// <summary>SEEK phase length in seconds.</summary>
|
||||
public static float MatchSeekDuration
|
||||
{
|
||||
get => Store.matchSeekDuration;
|
||||
set { if (!Mathf.Approximately(Store.matchSeekDuration, value)) { Store.matchSeekDuration = value; Save(); } }
|
||||
}
|
||||
|
||||
/// <summary>RESOLUTION (result screen) phase length in seconds.</summary>
|
||||
public static float MatchResolveDuration
|
||||
{
|
||||
get => Store.matchResolveDuration;
|
||||
set { if (!Mathf.Approximately(Store.matchResolveDuration, value)) { Store.matchResolveDuration = value; Save(); } }
|
||||
}
|
||||
|
||||
/// <summary>Seconds between radar ping sweeps during Seek (0 = pings disabled).</summary>
|
||||
public static float MatchRadarPingInterval
|
||||
{
|
||||
get => Store.matchRadarPingInterval;
|
||||
set { if (!Mathf.Approximately(Store.matchRadarPingInterval, value)) { Store.matchRadarPingInterval = value; Save(); } }
|
||||
}
|
||||
|
||||
/// <summary>Seconds each hider radar blip stays alive before it fades.</summary>
|
||||
public static float MatchRadarPingLifetime
|
||||
{
|
||||
get => Store.matchRadarPingLifetime;
|
||||
set { if (!Mathf.Approximately(Store.matchRadarPingLifetime, value)) { Store.matchRadarPingLifetime = value; Save(); } }
|
||||
}
|
||||
|
||||
private static Data Load()
|
||||
{
|
||||
string path = SavePath();
|
||||
|
||||
Reference in new issue
Block a user