LauncherConfig.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using LitJson;
  2. namespace GFGGame
  3. {
  4. public class LauncherConfig
  5. {
  6. public enum EnumNetType { 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 privacy_v;
  37. public static void InitScriptCompilation()
  38. {
  39. #if PT_DEV
  40. //外网dev版本
  41. netType = EnumNetType.TEMP;
  42. cfgName = "cfg_dev";
  43. #elif PT_TEMP
  44. netType = EnumNetType.TEMP;
  45. cfgName = "cfg_temp";
  46. #elif PT_IOS
  47. netType = EnumNetType.TEMP;
  48. cfgName = "cfg_ios";
  49. platformId = 2;
  50. #elif PT_TISHEN
  51. netType = EnumNetType.TISHEN;
  52. cfgName = "cfg_ts";
  53. #else
  54. netType = EnumNetType.LOCAL;
  55. cfgName = "cfg_local";
  56. #endif
  57. if (netType == EnumNetType.LOCAL)
  58. {
  59. launcherRootUrl = "http://10.108.64.189:81/";
  60. cfgUrl = launcherRootUrl + "platform/{cfgName}.json";
  61. }
  62. else
  63. {
  64. launcherRootUrl = "http://gfg1.obs.cn-north-4.myhuaweicloud.com/gameRes/";
  65. cfgUrl = launcherRootUrl + "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.privacy_v = result.privacy_v;
  80. }
  81. private struct Result
  82. {
  83. public string cdnRoot;
  84. public string logApiUrl;
  85. public string apkVersion;
  86. public string serverStatus;
  87. public string onDebug;
  88. public string privacy_v;
  89. }
  90. }
  91. }