LauncherConfig.cs 3.5 KB

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