123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using LitJson;
- using UnityEngine;
- namespace GFGGame
- {
- public class LauncherConfig
- {
- public enum EnumNetType { DEV, LOCAL, TEMP }
- public static EnumNetType netType = EnumNetType.LOCAL;
- public static string cfgName;
- public const int HTTP_GET_TIME_OUT = 3;
- public const int HTTP_POST_TIME_OUT = 15;
- public static string SOUND_KEY = "sound";
- public static string MUSIC_KEY = "music";
- public const string SQL_FILE_NAME = "excelConfig.sqlite.bytes";
- public static string CDN_ROOT;
- public static string loginApiUrl;
- public static string gameApiUrl;
- //平台id
- public static string cfgUrl = "http://gfg1.obs.cn-north-4.myhuaweicloud.com/14/platform/{cfgName}.json";
- public static int platformId = 1;
- public static string logKey;
- public static string logApiUrl;
- public static string resKey
- {
- get
- {
- #if PT_TEMP
- return "dfs";
- #else
- return null;
- #endif
- }
- }
- //public static string CDN_ROOT = "http://10.108.64.127/";
- public static bool ILRuntimeMode;
- public static void Init()
- {
- #if PT_DEV
- //外网dev版本
- netType = EnumNetType.DEV;
- cfgName = "cfg_dev";
- #elif PT_TEMP
- netType = EnumNetType.TEMP;
- cfgName = "cfg_temp";
- #else
- netType = EnumNetType.LOCAL;
- cfgName = "cfg_local";
- #endif
- }
- /// <summary>
- /// 获取启动器配置
- /// </summary>
- public static void GetLauncherCfg()
- {
- var url = cfgUrl.Replace("{cfgName}", cfgName);
- HttpTool.Instance.Get(url, (string data) =>
- {
- ResultHandler(data);
- });
- }
- private static void ResultHandler(string data)
- {
- var result = JsonMapper.ToObject<Result>(data);
- CDN_ROOT = result.cdnRoot;
- //CDN_ROOT = "http://10.108.64.127/";
- loginApiUrl = result.loginApiUrl;
- logApiUrl = result.logApiUrl;
- logKey = result.logKey;
- ET.Log.Debug($"ptcfg \n{data}");
- LogServerHelperHttp.SendNodeLog((int)LogNode.OnStart);
- LauncherView.Instance.SetDesc("获取版本信息...");
- VersionController.Instance.Init();
- }
- private struct Result
- {
- public string cdnRoot;
- public string loginApiUrl;
- public string logApiUrl;
- public string logKey;
- }
- }
- }
|