LauncherConfig.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 logApiRootUrl;
  25. public static string logApiReportLauncherUrl;
  26. public static string apkVersion;
  27. public static int serverStatus;
  28. public static int onDebug;
  29. public static string manifest_v;
  30. public static string resKey
  31. {
  32. get
  33. {
  34. #if PT_TEMP || PT_TISHEN || PT_DEV
  35. return "dfs";
  36. #else
  37. return null;
  38. #endif
  39. }
  40. }
  41. public static void InitScriptCompilation()
  42. {
  43. #if PT_DEV
  44. //外网dev版本
  45. netType = EnumNetType.DEV;
  46. cfgName = "cfg_dev";
  47. #elif PT_TEMP
  48. netType = EnumNetType.TEMP;
  49. cfgName = "cfg_temp";
  50. #elif PT_TISHEN
  51. netType = EnumNetType.TISHEN;
  52. cfgName = "cfg_ts";
  53. #else
  54. netType = EnumNetType.LOCAL;
  55. cfgName = "cfg_local";
  56. #endif
  57. cfgUrl = "http://gfg1.obs.cn-north-4.myhuaweicloud.com/14/platform/{cfgName}.json";
  58. }
  59. public static void InitPlatform(string json)
  60. {
  61. var result = JsonMapper.ToObject<Result>(json);
  62. LauncherConfig.CDN_ROOT = result.cdnRoot;
  63. //CDN_ROOT = "http://10.108.64.127/";
  64. LauncherConfig.logApiRootUrl = result.logApiUrl;
  65. //LauncherConfig.logApiRootUrl = "http://10.108.64.106:8080/api/Log/";
  66. LauncherConfig.logApiReportLauncherUrl = LauncherConfig.logApiRootUrl + "ReportNode";
  67. LauncherConfig.logKey = result.logKey;
  68. LauncherConfig.apkVersion = result.apkVersion;
  69. LauncherConfig.serverStatus = int.Parse(result.serverStatus);
  70. LauncherConfig.platformId = int.Parse(result.platformId);
  71. LauncherConfig.onDebug = int.Parse(result.onDebug);
  72. LauncherConfig.manifest_v = result.manifest_v;
  73. }
  74. private struct Result
  75. {
  76. public string cdnRoot;
  77. public string logApiUrl;
  78. public string logKey;
  79. public string apkVersion;
  80. public string serverStatus;
  81. public string platformId;
  82. public string onDebug;
  83. public string manifest_v;
  84. }
  85. }
  86. }