LauncherConfig.cs 3.3 KB

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