123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- using LitJson;
- namespace GFGGame
- {
- public class LauncherConfig
- {
- public enum EnumNetType
- {
- DEV,
- LOCAL,
- TEMP,
- TISHEN,
- PUBLIC
- }
- public static EnumNetType netType = EnumNetType.LOCAL;
- public static string cfgName;
- //热更代码存放位置
- public const string DllDirHotfix = "Assets/ResIn/Dll/Update/";
- public const string DllDirAOT = "Assets/ResIn/Dll/AOT/";
- public const int HTTP_GET_TIME_OUT = 3;
- public const int HTTP_POST_TIME_OUT = 15;
- public const string SQL_FILE_NAME = "excelConfig.sqlite.bytes";
- public const string LAST_LOGIN_IS_AGREE_KEY = "LAST_LOGIN_IS_AGREE_KEY_6"; //上次登录是否同意隐私政策
- public static string CDN_ROOT;
- public static string launcherRootUrl;
- public static string cfgUrl;
- //平台id
- public static int platformId = 1;
- //渠道id
- public static int ChannelId = 101;
- public static string logApiRootUrl; //上报普通日志接口
- public static string logApiReportLauncherUrl; //上报节点日志接口
- public static string apkVersion;
- //0 正常,1 维护中
- public static int serverStatus;
- public static string statusPrompt;
- //0 关闭所有log界面,1 开启后台log界面, 2 开启弹窗log界面
- public static int onDebug;
- //AB资源版本
- public static string manifest_v;
- //隐私政策文件地址模版
- public static string privacy_v;
- public static string updateAppPrompt;
- public static string updateResPrompt;
- public static int promptSizeMB;
- public static string updateUrl;
- public static long updateEndTime; //强制更新期限,毫秒级时间戳
- //新发行给的
- public static string showLog;
- public static string gameId;
- public static string douYouAdId;
- public static string vxSdkAppId = "wxd9772f42f126413f";
- //是否使用douYou的ios sdk 0不使用用douYouSdk 1使用douYouSdk
- public static string isUseDouYouIos;
- public static void InitScriptCompilation()
- {
- launcherRootUrl = "http://cdn.goufuguiwxw.com/";
- #if PT_DEV
- //外网dev版本
- netType = EnumNetType.LOCAL;
- cfgName = "cfg_dev19";
- ChannelId = (int)ChannelID.Test;
- #elif PT_DouYouDev
- netType = EnumNetType.LOCAL;
- cfgName = "cfg_douYouDev";
- ChannelId = (int)ChannelID.DouYouDev;
- #elif PT_TAPTAP
- netType = EnumNetType.PUBLIC;
- cfgName = "cfg_taptap";
- ChannelId = (int)ChannelID.TapTap;
- #elif PT_DOUYOU
- netType = EnumNetType.PUBLIC;
- cfgName = "cfg_gfg";
- ChannelId = (int)ChannelID.DouYou;
- #elif PT_IOS
- netType = EnumNetType.PUBLIC;
- cfgName = "cfg_ios";
- platformId = 2;
- ChannelId = (int)ChannelID.GFG;
- #elif PT_IosLocal
- netType = EnumNetType.PUBLIC;
- cfgName = "cfg_ios2";
- platformId = 2;
- isUseDouYouIos = "1";
- ChannelId = (int)ChannelID.GFG;
- #else
- netType = EnumNetType.PUBLIC;
- cfgName = "cfg_local";
- ChannelId = (int)ChannelID.Test;
- #endif
- cfgUrl = launcherRootUrl + "platform/{cfgName}.json";
- }
- public static void InitPlatform(string json)
- {
- var result = JsonMapper.ToObject<Result>(json);
- LauncherConfig.CDN_ROOT = result.cdnRoot;
- LauncherConfig.logApiRootUrl = result.logApiUrl;
- LauncherConfig.logApiReportLauncherUrl = LauncherConfig.logApiRootUrl + "ReportNode";
- LauncherConfig.apkVersion = result.apkVersion;
- if (!string.IsNullOrEmpty(result.serverStatus))
- {
- LauncherConfig.serverStatus = int.Parse(result.serverStatus);
- }
- if (!string.IsNullOrEmpty(result.onDebug))
- {
- LauncherConfig.onDebug = int.Parse(result.onDebug);
- }
- if (!string.IsNullOrEmpty(result.showLog))
- {
- LauncherConfig.showLog = result.showLog;
- }
- if (!string.IsNullOrEmpty(result.gameId))
- {
- LauncherConfig.gameId = result.gameId;
- }
- if (!string.IsNullOrEmpty(result.douYouAdId))
- {
- LauncherConfig.douYouAdId = result.douYouAdId;
- }
- if (!string.IsNullOrEmpty(result.isUseDouYouIos))
- {
- LauncherConfig.isUseDouYouIos = result.isUseDouYouIos;
- if (LauncherConfig.isUseDouYouIos == "1")
- {
- ChannelId = (int)ChannelID.DouYou;
- }
- }
- LauncherConfig.manifest_v = result.manifest_v;
- LauncherConfig.privacy_v = result.privacy_v;
- LauncherConfig.statusPrompt = result.statusPrompt;
- LauncherConfig.updateAppPrompt = result.updateAppPrompt;
- LauncherConfig.updateResPrompt = result.updateResPrompt;
- LauncherConfig.updateUrl = result.updateUrl;
- if (!string.IsNullOrEmpty(result.updateEndTime))
- {
- LauncherConfig.updateEndTime = LauncherTimeUtil.GetTimestamp(result.updateEndTime);
- }
- if (!string.IsNullOrEmpty(result.promptSizeMB))
- {
- LauncherConfig.promptSizeMB = int.Parse(result.promptSizeMB);
- }
- }
- private struct Result
- {
- public string cdnRoot;
- public string logApiUrl;
- public string apkVersion;
- public string serverStatus;
- public string onDebug;
- public string manifest_v;
- public string privacy_v;
- public string statusPrompt;
- public string updateAppPrompt;
- public string updateResPrompt;
- public string promptSizeMB;
- public string updateUrl;
- public string douYouAdId;
- public string gameId;
- public string showLog;
- public string updateEndTime; //更新最后时间
- public string isUseDouYouIos;
- }
- }
- }
|