| | |
| | | }
|
| | |
|
| | | public VersionInfo versionInfo { get; private set; }
|
| | | public MaoErVersion maoerVersion;
|
| | | public JsonData maoerVersion;
|
| | | public bool completed { get { return step == Step.Completed; } }
|
| | |
|
| | | Step m_Step = Step.None;
|
| | |
| | | {
|
| | | if (IsMaoErGame())
|
| | | {
|
| | | return maoerVersion.url;
|
| | | if (maoerVersion.Keys.Contains("url"))
|
| | | {
|
| | | return maoerVersion["url"].ToString();
|
| | | }
|
| | | else
|
| | | {
|
| | | return string.Empty;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | {
|
| | | if (IsMaoErGame())
|
| | | {
|
| | | if (string.IsNullOrEmpty(maoerVersion.content))
|
| | | if (maoerVersion.Keys.Contains("content"))
|
| | | {
|
| | | return string.Empty;
|
| | | return StringUtility.Contact(Language.GetFromLocal(30), "\r\n", maoerVersion["content"].ToString());
|
| | | }
|
| | | else
|
| | | {
|
| | | return StringUtility.Contact(Language.GetFromLocal(30), "\r\n", maoerVersion.content);
|
| | | return string.Empty;
|
| | | }
|
| | | }
|
| | | else
|
| | |
| | | var tables = new Dictionary<string, string>();
|
| | | tables["uid"] = ModelCenter.Instance.GetModel<LoginModel>().sdkLoginResult.account;
|
| | | var url = "https://api.maoergame.com/update/download/url";
|
| | | Debug.LogFormat("猫耳强更url:{0} uid:{1} ", url, ModelCenter.Instance.GetModel<LoginModel>().sdkLoginResult.account);
|
| | | HttpRequest.Instance.RequestHttpPost(url, tables, HttpRequest.defaultHttpContentType, 1, OnMaoErVersionCheckResult);
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnMaoErVersionCheckResult(bool ok, string result)
|
| | | {
|
| | | UTF8Encoding utf8 = new UTF8Encoding();
|
| | | Byte[] encodedBytes = utf8.GetBytes(result);
|
| | | String decodedString = utf8.GetString(encodedBytes);
|
| | | Debug.LogFormat("猫耳强更请求返回结果 result:{0}:{1}", ok, result);
|
| | |
|
| | | Debug.LogFormat("猫耳强更请求返回结果 result:{0}", decodedString);
|
| | | if (ok)
|
| | | {
|
| | | try
|
| | | {
|
| | | maoerVersion = JsonMapper.ToObject<MaoErVersion>(result);
|
| | | if (maoerVersion.code == 0)
|
| | | maoerVersion = JsonMapper.ToObject(result);
|
| | | if (maoerVersion.Keys.Contains("code") && maoerVersion["code"].ToString() == "0")
|
| | | {
|
| | | step = Step.DownLoadPrepared;
|
| | | WindowCenter.Instance.OpenFromLocal<VersionUpdateWin>();
|
| | |
| | | }
|
| | | catch (System.Exception ex)
|
| | | {
|
| | | Debug.Log(ex);
|
| | | step = Step.None;
|
| | | Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestMaoErVersionCheck);
|
| | | }
|
| | |
| | | public struct MaoErVersion
|
| | | {
|
| | | public string msg;
|
| | | public int code;
|
| | | public string code;
|
| | | public string content;
|
| | | public string url;
|
| | | }
|