LauncherConfig.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using LitJson;
  2. namespace GFGGame
  3. {
  4. public class LauncherConfig
  5. {
  6. public enum EnumNetType { DEV, LOCAL, TEMP }
  7. public static EnumNetType netType = EnumNetType.LOCAL;
  8. public static string cfgName;
  9. public static bool ILRuntimeMode;
  10. public const int HTTP_GET_TIME_OUT = 3;
  11. public const int HTTP_POST_TIME_OUT = 15;
  12. public static string SOUND_KEY = "sound";
  13. public static string MUSIC_KEY = "music";
  14. public const string SQL_FILE_NAME = "excelConfig.sqlite.bytes";
  15. public static string CDN_ROOT;
  16. public static string loginApiUrl;
  17. public static string gameApiUrl;
  18. public static string cfgUrl;
  19. //ƽ̨id
  20. public static int platformId = 1;
  21. public static string logKey;
  22. public static string logApiUrl;
  23. public static string apkVersion;
  24. public static int serverStatus;
  25. public static int onDebug;
  26. public static string resKey
  27. {
  28. get
  29. {
  30. #if PT_TEMP
  31. return "dfs";
  32. #else
  33. return null;
  34. #endif
  35. }
  36. }
  37. public static void InitScriptCompilation()
  38. {
  39. #if PT_DEV
  40. //ÍâÍødev°æ±¾
  41. netType = EnumNetType.DEV;
  42. cfgName = "cfg_dev";
  43. #elif PT_TEMP
  44. netType = EnumNetType.TEMP;
  45. cfgName = "cfg_temp1";
  46. #else
  47. netType = EnumNetType.LOCAL;
  48. cfgName = "cfg_local";
  49. #endif
  50. cfgUrl = "http://gfg1.obs.cn-north-4.myhuaweicloud.com/14/platform/{cfgName}.json";
  51. }
  52. public static void InitPlatform(string json)
  53. {
  54. ET.Log.Debug($"ptcfg \n{json}");
  55. var result = JsonMapper.ToObject<Result>(json);
  56. LauncherConfig.CDN_ROOT = result.cdnRoot;
  57. //CDN_ROOT = "http://10.108.64.127/";
  58. LauncherConfig.loginApiUrl = result.loginApiUrl;
  59. LauncherConfig.logApiUrl = result.logApiUrl;
  60. LauncherConfig.logKey = result.logKey;
  61. LauncherConfig.apkVersion = result.apkVersion;
  62. LauncherConfig.serverStatus = int.Parse(result.serverStatus);
  63. LauncherConfig.platformId = int.Parse(result.platformId);
  64. LauncherConfig.onDebug = int.Parse(result.onDebug);
  65. ET.Log.Debug($"platformId {LauncherConfig.platformId}");
  66. }
  67. private struct Result
  68. {
  69. public string cdnRoot;
  70. public string loginApiUrl;
  71. public string logApiUrl;
  72. public string logKey;
  73. public string apkVersion;
  74. public string serverStatus;
  75. public string platformId;
  76. public string onDebug;
  77. }
  78. }
  79. }