Files
CC-Framework.BriskGameServer/Assets/BriskSdk/Runtime/Core/BriskOptions.cs

41 lines
1.0 KiB
C#

using System;
public sealed class BriskOptions
{
public string BaseUrl;
public string GameKey;
public string ClientVersion;
public string DeviceId;
public bool EnableLog;
public bool ValidateSessionOnInitialize = true;
public IBriskTokenStore TokenStore;
public IBriskErrorPresenter ErrorPresenter;
public Action ExitHandler;
public void Validate()
{
if (string.IsNullOrWhiteSpace(BaseUrl))
{
throw new ArgumentException("BriskOptions.BaseUrl is required.", nameof(BaseUrl));
}
if (string.IsNullOrWhiteSpace(GameKey))
{
throw new ArgumentException("BriskOptions.GameKey is required.", nameof(GameKey));
}
BaseUrl = NormalizeBaseUrl(BaseUrl);
}
private static string NormalizeBaseUrl(string baseUrl)
{
var normalized = baseUrl.Trim().TrimEnd('/');
if (normalized.EndsWith("/api", StringComparison.OrdinalIgnoreCase))
{
return normalized;
}
return normalized + "/api";
}
}