LauncherConfig.cs 2.2 KB

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