LauncherConfig.cs 3.4 KB

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