zhangjiannan 2025-03-27 15:53:06 +08:00
parent 03ad4754fb
commit ad7f3dd098
2 changed files with 28 additions and 18 deletions

View File

@ -15,7 +15,7 @@ namespace GameLogic
public Version(string json)
{
info = MiniJSON.jsonDecode(json) as Hashtable;
}
}
public string ToJson()
{
@ -61,7 +61,7 @@ namespace GameLogic
/// 流媒体目录中的游戏及其版本号
/// </summary>
Version internalVersion;
public void Initialize()
{
InitVersions();
@ -80,7 +80,8 @@ namespace GameLogic
externalVersion = new Version(File.ReadAllText(VersionsFilePath, utf8));
}
}
catch (Exception e) {
catch (Exception e)
{
Debug.LogError(e);
}
@ -88,7 +89,7 @@ namespace GameLogic
{
internalVersion = new Version(Resources.Load<TextAsset>(VersionsFile).text);
}
catch(Exception e)
catch (Exception e)
{
Debug.LogError(e);
}
@ -152,9 +153,9 @@ namespace GameLogic
string[] vs1 = ver1.Split('.');
string[] vs2 = ver2.Split('.');
if(vs1.Length != vs2.Length)
if (vs1.Length != vs2.Length)
{
return -1;
return -1;
}
int v1, v2;
@ -185,7 +186,7 @@ namespace GameLogic
{
if (externalVersion != null)
{
if(externalVersion.GetInfo(key) != null)
if (externalVersion.GetInfo(key) != null)
{
return externalVersion.GetInfo(key);
}
@ -200,6 +201,13 @@ namespace GameLogic
public string GetVersionInfoStream(string key)
{
if (externalVersion != null)
{
if (externalVersion.GetInfo(key) != null)
{
return externalVersion.GetInfo(key);
}
}
if (internalVersion != null)
{
return internalVersion.GetInfo(key);
@ -234,12 +242,13 @@ namespace GameLogic
/// 检测包版本,用于比较本地包与线上包的差异,有差异则需要更换新包
/// </summary>
public static bool CheckPackageVersionSame(string checkVersion)
{
{
string localPackageVersion = Instance.GetVersionInfoStream("packageVersion");
if(localPackageVersion != null && checkVersion != null)
if (localPackageVersion != null && checkVersion != null)
{
return localPackageVersion.Equals(checkVersion);
}else if(localPackageVersion == null && checkVersion == null)
}
else if (localPackageVersion == null && checkVersion == null)
{
return true;
}

View File

@ -358,19 +358,20 @@ namespace ResUpdate
Debug.Log(string.Format("Version Compare result:{0}", result));
//如果版本号一致,就不进行更新了
//if (result == 0)
//{
// Debug.Log(string.Format("version:{0},版本号一致,更新完成", version));
// UpdateSuccess();
//}
//else
//{
if (result == 0)
{
Debug.Log(string.Format("version:{0},版本号一致,更新完成", version));
sdkLodingUrl = table["sdkLodingUrl"] as string;
UpdateSuccess();
}
else
{
localVersion = version;
sdkLodingUrl = table["sdkLodingUrl"] as string;
Debug.Log(string.Format("vertion_txt {0}", localVersion, sdkLodingUrl));
DownLoadVersionFiles();
//}
}
}
else
{