mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-27 16:09:07 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
namespace RadicadeServer.RecNet.Rooms
|
||||
{
|
||||
public static class SceneLocations
|
||||
{
|
||||
public const string MakerRoom = "a75f7547-79eb-47c6-8986-6767abcb4f92";
|
||||
|
||||
public const string Dorm = "76d98498-60a1-430c-ab76-b54a29b7a163";
|
||||
|
||||
private static readonly HashSet<string> KnownBadValues = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"unknown",
|
||||
"none",
|
||||
"null",
|
||||
};
|
||||
|
||||
public static bool IsValid(string? unitySceneId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(unitySceneId))
|
||||
return false;
|
||||
|
||||
var trimmed = unitySceneId.Trim();
|
||||
if (KnownBadValues.Contains(trimmed))
|
||||
return false;
|
||||
|
||||
return Guid.TryParse(trimmed, out _);
|
||||
}
|
||||
|
||||
public static string ResolveFallback(IEnumerable<string?> candidateUnitySceneIds, bool isDorm)
|
||||
{
|
||||
foreach (var id in candidateUnitySceneIds)
|
||||
{
|
||||
if (IsValid(id))
|
||||
return id!.Trim();
|
||||
}
|
||||
|
||||
return isDorm ? Dorm : MakerRoom;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user