LauncherConfig.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using LitJson;
  2. namespace GFGGame
  3. {
  4. public class LauncherConfig
  5. {
  6. public enum EnumNetType { DEV, LOCAL, TEMP, TISHEN }
  7. public static EnumNetType netType = EnumNetType.LOCAL;
  8. public static string cfgName;
  9. //热更代码存放位置
  10. public const string DllDirHotfix = "Assets/ResIn/Dll/Update/";
  11. public const string DllDirAOT = "Assets/ResIn/Dll/AOT/";
  12. public const int HTTP_GET_TIME_OUT = 3;
  13. public const int HTTP_POST_TIME_OUT = 15;
  14. public static string SOUND_KEY = "sound";
  15. public static string MUSIC_KEY = "music";
  16. public const string SQL_FILE_NAME = "excelConfig.sqlite.bytes";
  17. public static string CDN_ROOT;
  18. public static string loginApiUrl;
  19. public static string gameApiUrl;
  20. public static string cfgUrl;
  21. //平台id
  22. public static int platformId = 1;
  23. public static string logKey;
  24. public static string logApiUrl;
  25. public static string apkVersion;
  26. public static int serverStatus;
  27. public static int onDebug;
  28. public static string manifest_v;
  29. public static string resKey
  30. {
  31. get
  32. {
  33. #if PT_TEMP || PT_TISHEN
  34. return "dfs";
  35. #else
  36. return null;
  37. #endif
  38. }
  39. }
  40. public static void InitScriptCompilation()
  41. {
  42. #if PT_DEV
  43. //外网dev版本
  44. netType = EnumNetType.DEV;
  45. cfgName = "cfg_dev";
  46. #elif PT_TEMP
  47. netType = EnumNetType.TEMP;
  48. cfgName = "cfg_temp";
  49. #elif PT_TISHEN
  50. netType = EnumNetType.TISHEN;
  51. cfgName = "cfg_ts";
  52. #else
  53. netType = EnumNetType.LOCAL;
  54. cfgName = "cfg_local";
  55. #endif
  56. cfgUrl = "http://gfg1.obs.cn-north-4.myhuaweicloud.com/14/platform/{cfgName}.json";
  57. }
  58. public static void InitPlatform(string json)
  59. {
  60. ET.Log.Debug($"ptcfg \n{json}");
  61. var result = JsonMapper.ToObject<Result>(json);
  62. LauncherConfig.CDN_ROOT = result.cdnRoot;
  63. //CDN_ROOT = "http://10.108.64.127/";
  64. LauncherConfig.logApiUrl = result.logApiUrl;
  65. LauncherConfig.logKey = result.logKey;
  66. LauncherConfig.apkVersion = result.apkVersion;
  67. LauncherConfig.serverStatus = int.Parse(result.serverStatus);
  68. LauncherConfig.platformId = int.Parse(result.platformId);
  69. LauncherConfig.onDebug = int.Parse(result.onDebug);
  70. LauncherConfig.manifest_v = result.manifest_v;
  71. ET.Log.Debug($"platformId {LauncherConfig.platformId}");
  72. }
  73. private struct Result
  74. {
  75. public string cdnRoot;
  76. public string logApiUrl;
  77. public string logKey;
  78. public string apkVersion;
  79. public string serverStatus;
  80. public string platformId;
  81. public string onDebug;
  82. public string manifest_v;
  83. }
  84. }
  85. }