40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
#if XW_DEVTEST
|
|
using UnityEngine;
|
|
|
|
namespace XGame.MiniGame
|
|
{
|
|
public static class MiniGameTestOverride
|
|
{
|
|
private const string KActive = "xw_devtest_active";
|
|
private const string KGateway = "xw_devtest_gateway";
|
|
private const string KCdn = "xw_devtest_cdn";
|
|
private const string KName = "xw_devtest_name";
|
|
|
|
public static bool IsActive => PlayerPrefs.GetInt(KActive, 0) == 1;
|
|
public static string GatewayUrl => PlayerPrefs.GetString(KGateway, "");
|
|
public static string CdnBase => PlayerPrefs.GetString(KCdn, "");
|
|
public static string ServerName => PlayerPrefs.GetString(KName, "");
|
|
|
|
public static void Apply(string gatewayUrl, string cdnBase, string serverName)
|
|
{
|
|
PlayerPrefs.SetInt(KActive, 1);
|
|
PlayerPrefs.SetString(KGateway, gatewayUrl ?? "");
|
|
PlayerPrefs.SetString(KCdn, cdnBase ?? "");
|
|
PlayerPrefs.SetString(KName, serverName ?? "");
|
|
PlayerPrefs.Save();
|
|
Debug.Log($"[DevTest] switched to LAN dev server {serverName}: {gatewayUrl}");
|
|
}
|
|
|
|
public static void Clear()
|
|
{
|
|
PlayerPrefs.DeleteKey(KActive);
|
|
PlayerPrefs.DeleteKey(KGateway);
|
|
PlayerPrefs.DeleteKey(KCdn);
|
|
PlayerPrefs.DeleteKey(KName);
|
|
PlayerPrefs.Save();
|
|
Debug.Log("[DevTest] reset to normal server config");
|
|
}
|
|
}
|
|
}
|
|
#endif
|