|
@@ -1,5 +1,7 @@
|
|
|
-using UniFramework.Pooling;
|
|
|
+using System.Collections;
|
|
|
+using UniFramework.Pooling;
|
|
|
using UnityEngine;
|
|
|
+using YooAsset;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
@@ -43,5 +45,36 @@ namespace GFGGame
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void OnApplicationPause(bool pause)
|
|
|
+ {
|
|
|
+ if(!pause)
|
|
|
+ {
|
|
|
+ StartCoroutine(CheckVersion(VersionController.DefaultPackage));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private IEnumerator CheckVersion(string packageName)
|
|
|
+ {
|
|
|
+ var package = YooAssets.GetPackage(packageName);
|
|
|
+ string oldVersion = package.GetPackageVersion();
|
|
|
+ var operation = package.UpdatePackageVersionAsync();
|
|
|
+ yield return operation;
|
|
|
+
|
|
|
+ if (operation.Status == EOperationStatus.Succeed)
|
|
|
+ {
|
|
|
+ VersionController.Instance.PackageVersion = operation.PackageVersion;
|
|
|
+ LogUtil.LogDev($"版本对比: {oldVersion} {operation.PackageVersion}");
|
|
|
+ if(!operation.PackageVersion.Equals(oldVersion))
|
|
|
+ {
|
|
|
+ AlertSystem.Show("游戏已有更新,您可以立即重启游戏获取最佳游戏体验,也可以稍后重启更新。")
|
|
|
+ .SetLeftButton(true, "稍后更新")
|
|
|
+ .SetRightButton(true, "重启游戏", (obj)=>
|
|
|
+ {
|
|
|
+ Application.Quit();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|