Browse Source

更新提示

guodong 1 year ago
parent
commit
14f79c13a3

+ 7 - 4
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -390,16 +390,19 @@ namespace GFGGame
         private static IEnumerator CheckVersion(string packageName)
         {
             var package = YooAssets.GetPackage(packageName);
-            string oldVersion = package.GetPackageVersion();
+            if (string.IsNullOrEmpty(GameGlobal.promotedVersion))
+            {
+                GameGlobal.promotedVersion = 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))
+                LogUtil.LogDev($"版本对比: {GameGlobal.promotedVersion} {operation.PackageVersion}");
+                if (!operation.PackageVersion.Equals(GameGlobal.promotedVersion))
                 {
+                    GameGlobal.promotedVersion = operation.PackageVersion;
                     AlertSystem.Show("游戏已有更新,您可以立即重启游戏获取最佳游戏体验,也可以稍后重启更新。")
                         .SetLeftButton(true, "稍后更新")
                         .SetRightButton(true, "重启游戏", (obj) =>

+ 2 - 0
GameClient/Assets/Game/HotUpdate/GameGlobal.cs

@@ -51,6 +51,8 @@ namespace GFGGame
 
         //游戏暂停时间
         public static long pauseTime;
+        //提示过的版本不再提示
+        public static string promotedVersion;
 
         public static void Init()
         {