LauncherConfig.cs 3.3 KB

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