From 17d155789d26f4d301efba4054c8947f0cfadf01 Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期四, 27 九月 2018 14:02:13 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
System/ClientVersion/VersionUtility.cs | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/System/ClientVersion/VersionUtility.cs b/System/ClientVersion/VersionUtility.cs
index ba10111..575586d 100644
--- a/System/ClientVersion/VersionUtility.cs
+++ b/System/ClientVersion/VersionUtility.cs
@@ -26,7 +26,7 @@
}
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;
@@ -146,7 +146,14 @@
{
if (IsMaoErGame())
{
- return maoerVersion.url;
+ if (maoerVersion.Keys.Contains("url"))
+ {
+ return maoerVersion["url"].ToString();
+ }
+ else
+ {
+ return string.Empty;
+ }
}
else
{
@@ -159,13 +166,13 @@
{
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
@@ -236,24 +243,20 @@
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("鐚�冲己鏇磚rl锛歿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>();
@@ -266,6 +269,7 @@
}
catch (System.Exception ex)
{
+ Debug.Log(ex);
step = Step.None;
Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestMaoErVersionCheck);
}
@@ -346,7 +350,7 @@
public struct MaoErVersion
{
public string msg;
- public int code;
+ public string code;
public string content;
public string url;
}
--
Gitblit v1.8.0