LauncherConfig.cs 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using LitJson;
  2. namespace GFGGame
  3. {
  4. public class LauncherConfig
  5. {
  6. public enum EnumNetType { DEV, LOCAL, TEMP, TISHEN, PUBLIC }
  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 static string VOICE_KEY = "voice";
  17. public static string SOUND_VOLUMN_KEY = "sound_volumn";
  18. public static string MUSIC_VOLUMN_KEY = "music_volumn";
  19. public static string VOICE_VOLUMN_KEY = "voice_volumn";
  20. public const string SQL_FILE_NAME = "excelConfig.sqlite.bytes";
  21. public const string LAST_LOGIN_IS_AGREE_KEY = "LAST_LOGIN_IS_AGREE_KEY_6";//上次登录是否同意隐私政策
  22. public static string CDN_ROOT;
  23. public static string loginApiUrl;
  24. public static string gameApiUrl;
  25. public static string launcherRootUrl;
  26. public static string cfgUrl;
  27. //平台id
  28. public static int platformId = 1;
  29. //渠道id
  30. public static int ChannelId = 101;
  31. public static string logApiRootUrl;//上报普通日志接口
  32. public static string logApiReportLauncherUrl;//上报节点日志接口
  33. public static string apkVersion;
  34. public static int serverStatus;
  35. public static int onDebug;
  36. public static string manifest_v;
  37. public static string privacy_v;
  38. public static void InitScriptCompilation()
  39. {
  40. launcherRootUrl = "https://wsjclient.obs.cn-north-4.myhuaweicloud.com/";
  41. #if PT_DEV
  42. //外网dev版本
  43. netType = EnumNetType.PUBLIC;
  44. cfgName = "cfg_dev";
  45. #elif PT_TEMP
  46. netType = EnumNetType.PUBLIC;
  47. cfgName = "cfg_temp";
  48. #elif PT_IOS
  49. netType = EnumNetType.PUBLIC;
  50. cfgName = "cfg_ios";
  51. platformId = 2;
  52. ChannelId = (int)ChannelID.AppStore;
  53. #elif PT_TISHEN
  54. netType = EnumNetType.TISHEN;
  55. cfgName = "cfg_ts";
  56. #else
  57. netType = EnumNetType.LOCAL;
  58. cfgName = "cfg_local";
  59. launcherRootUrl = "http://10.108.64.189:81/";
  60. #endif
  61. cfgUrl = launcherRootUrl + "platform/{cfgName}.json";
  62. }
  63. public static void InitPlatform(string json)
  64. {
  65. var result = JsonMapper.ToObject<Result>(json);
  66. LauncherConfig.CDN_ROOT = result.cdnRoot;
  67. // CDN_ROOT = "http://10.108.64.143/";
  68. LauncherConfig.logApiRootUrl = result.logApiUrl;
  69. //LauncherConfig.logApiRootUrl = "http://10.108.64.106:8080/api/Log/";
  70. LauncherConfig.logApiReportLauncherUrl = LauncherConfig.logApiRootUrl + "ReportNode";
  71. LauncherConfig.apkVersion = result.apkVersion;
  72. LauncherConfig.serverStatus = int.Parse(result.serverStatus);
  73. LauncherConfig.onDebug = int.Parse(result.onDebug);
  74. LauncherConfig.manifest_v = result.manifest_v;
  75. LauncherConfig.privacy_v = result.privacy_v;
  76. }
  77. private struct Result
  78. {
  79. public string cdnRoot;
  80. public string logApiUrl;
  81. public string apkVersion;
  82. public string serverStatus;
  83. public string onDebug;
  84. public string manifest_v;
  85. public string privacy_v;
  86. }
  87. }
  88. }