From 9f89e3be35da42eb9ccb44e6589d62f320aa444c Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期四, 11 四月 2019 21:31:06 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/EquipStar/EquipStarWin.cs |   74 ++++++++++++++++++++++++-------------
 1 files changed, 48 insertions(+), 26 deletions(-)

diff --git a/System/EquipStar/EquipStarWin.cs b/System/EquipStar/EquipStarWin.cs
index 385b79a..e6dec43 100644
--- a/System/EquipStar/EquipStarWin.cs
+++ b/System/EquipStar/EquipStarWin.cs
@@ -15,7 +15,7 @@
     public class EquipStarWin : Window
     {
         [SerializeField] RectTransform m_LevelContainer;
-        [SerializeField] ImageCouple[] m_Stars;
+        [SerializeField] Star[] m_Stars;
         [SerializeField] ItemCell m_TargetEquip;
         [SerializeField] Text m_EquipStar;
         [SerializeField] Materials m_Materials;
@@ -56,7 +56,6 @@
             }
 
             DisplayBaseInfo();
-            DisplayDynamicInfo(true);
         }
 
         protected override void OnAfterOpen()
@@ -71,6 +70,12 @@
         protected override void OnAfterClose()
         {
             model.ResetOperateParams();
+        }
+
+        protected override void OnActived()
+        {
+            base.OnActived();
+            DisplayDynamicInfo(true);
         }
 
         protected override void LateUpdate()
@@ -143,9 +148,13 @@
                 var equipPosition = new Int2(model.selectedLevel.value, model.selectedPlace.value);
                 var starLevel = model.equipStarLevel.Fetch();
                 var maxStar = model.equipMaxStarLevel.Fetch();
-                DisplayStars(equipPosition, starLevel, maxStar);
                 DisplayPropertyPreview(equipPosition, starLevel, EquipStarModel.GetMaxStarLevel(equipPosition.x));
                 DisplayStarUpgradeButton(equipPosition, starLevel);
+            }
+
+            if (force || model.stars.dirty)
+            {
+                DisplayStars(model.stars.Fetch());
             }
 
             if (force || model.starUpgradeProbability.dirty)
@@ -167,29 +176,10 @@
             }
         }
 
-        private void DisplayStars(Int2 equipPosition, int currentStar, int maxStar)
+        private void DisplayStars(List<EquipStarModel.Star> stars)
         {
-            if (equipPosition.y == 0)
-            {
-                foreach (var behaviour in m_Stars)
-                {
-                    behaviour.Hide();
-                }
-            }
-            else
-            {
-                for (var i = 0; i < m_Stars.Length; i++)
-                {
-                    if (i < maxStar)
-                    {
-                        m_Stars[i].Display(i < currentStar);
-                    }
-                    else
-                    {
-                        m_Stars[i].Hide();
-                    }
-                }
-            }
+            StopCoroutine("Co_DisplayStars");
+            StartCoroutine("Co_DisplayStars", stars);
         }
 
         private void DisplayMaterialSlots(Int2 equipPosition, int currentStarLevel)
@@ -427,6 +417,32 @@
             m_EffectFailed.Play();
         }
 
+        IEnumerator Co_DisplayStars(List<EquipStarModel.Star> stars)
+        {
+            var hasNewStar = stars.FindIndex(x => { return x.newGet; }) != -1;
+            if (hasNewStar)
+            {
+                yield return WaitingForSecondConst.WaitMS2000;
+            }
+
+            for (var i = 0; i < m_Stars.Length; i++)
+            {
+                if (i < stars.Count)
+                {
+                    var star = stars[i];
+                    m_Stars[i].Display(star.actived);
+                    if (star.newGet)
+                    {
+                        m_Stars[i].PlayEffect();
+                    }
+                }
+                else
+                {
+                    m_Stars[i].Hide();
+                }
+            }
+        }
+
         private void ViewEquipTip()
         {
             var level = model.selectedLevel.value;
@@ -440,11 +456,12 @@
         }
 
         [System.Serializable]
-        public class ImageCouple
+        public class Star
         {
             public RectTransform container;
             public Image imageBase;
             public Image imageStar;
+            public UIEffect newStarEffect;
 
             public void Display(bool active)
             {
@@ -456,6 +473,11 @@
             {
                 container.gameObject.SetActive(false);
             }
+
+            public void PlayEffect()
+            {
+                newStarEffect.Play();
+            }
         }
 
         [System.Serializable]

--
Gitblit v1.8.0