From 000e8cbabb0639d2c4b90ebc28f08256f028d209 Mon Sep 17 00:00:00 2001
From: chenxin <chenxin6991@163.com>
Date: Sat, 12 Dec 2020 16:07:04 +0800
Subject: [PATCH] 产生2级塔逻辑

---
 Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs      |    2 +-
 Assets/Scripts/Common/GameConfig.cs                      |    5 +++++
 Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs         |    1 +
 Assets/Scripts/TowerDefense/UI/HUD/EndlessRandomTower.cs |    7 +++++--
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Assets/Scripts/Common/GameConfig.cs b/Assets/Scripts/Common/GameConfig.cs
index 5fa45ea..2ae3096 100644
--- a/Assets/Scripts/Common/GameConfig.cs
+++ b/Assets/Scripts/Common/GameConfig.cs
@@ -111,6 +111,11 @@
         /// </summary>
         public static int GameCompletedCount;
 
+        /// <summary>
+        /// 是否提升过所有塔的等级
+        /// </summary>
+        public static bool IsUpgradeTowerLevel;
+
         #region 各个塔的偏移量
         public static Vector3 fireScale = new Vector3(1.92f, 1.92f, 2.208f);
         public static Vector3 woodScale = new Vector3(1.5f, 1.5f, 2.82f);
diff --git a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs
index b8ff7de..2400d53 100644
--- a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs
+++ b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs
@@ -87,6 +87,7 @@
         InitSDK();
         bGameStart = false;
         bFirstLoaded = false;
+        GameConfig.IsUpgradeTowerLevel = false;
         GameConfig.CreateRandomTower = true;
 
         bVibrate = new bool[4];
diff --git a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
index 177cb49..8c1d17c 100644
--- a/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
+++ b/Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
@@ -812,6 +812,7 @@
                     PlayUpgradeEffect(m_listTower[i]);
                 }
             }
+            GameConfig.IsUpgradeTowerLevel = true;
             UpdateMinLevelArr();
             EndlessRandomTower.instance.UpdateDescDisplay();
         }
@@ -2300,7 +2301,6 @@
             bool successfulPurchase = EndlessLevelManager.instance.Currency.TryPurchase(cost);
             if (!successfulPurchase) return false;
 
-            EndlessRandomTower.instance.UpdateDescDisplay();
             SetUpGhostTower(tow);
             //Debug.Log("设置影子塔防.");
             m_CurrentTower.Show();
diff --git a/Assets/Scripts/TowerDefense/UI/HUD/EndlessRandomTower.cs b/Assets/Scripts/TowerDefense/UI/HUD/EndlessRandomTower.cs
index 6494829..357afd1 100644
--- a/Assets/Scripts/TowerDefense/UI/HUD/EndlessRandomTower.cs
+++ b/Assets/Scripts/TowerDefense/UI/HUD/EndlessRandomTower.cs
@@ -86,7 +86,8 @@
 
     public void UpdateDescDisplay()
     {
-        int minLevel = Mathf.Min(EndlessGameUI.instance.MinLevel, 1);
+        int minLevel = GameConfig.IsUpgradeTowerLevel ? 1 : 0;
+
         NormalDesc.text = $"购买{minLevel + 1}级宝石";
     }
 
@@ -353,7 +354,9 @@
             gameUI.CancelGhostPlacement();
 
         if (level == -1)
-            level = Mathf.Min(EndlessGameUI.instance.MinLevel, 1);
+        {
+            level = GameConfig.IsUpgradeTowerLevel ? 1 : 0;
+        }
 
         return gameUI.RandomPlaceTower(tower, posx, posy, level, cost, false, isFirstAppear);
     }

--
Gitblit v1.9.1