From b0a563c5bba10739df06afa7cd456d1edad00a9f Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期二, 12 三月 2019 13:50:11 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/EquipTrain/EquipTrainPropertyBarBehaviour.cs |   22 +++++++++++++++++-----
 System/EquipTrain/EquipTrainWin.cs                  |    2 +-
 System/EquipStar/EquipStarMaterialCandidate.cs      |    1 +
 System/EquipTrain/EquipTrainModel.cs                |    9 ++++++---
 System/EquipTrain/EquipTrainPropertyBar.cs          |    2 ++
 5 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/System/EquipStar/EquipStarMaterialCandidate.cs b/System/EquipStar/EquipStarMaterialCandidate.cs
index bbfc5d6..915d562 100644
--- a/System/EquipStar/EquipStarMaterialCandidate.cs
+++ b/System/EquipStar/EquipStarMaterialCandidate.cs
@@ -27,6 +27,7 @@
             var item = packModel.GetItemByGuid(this.equip);
 
             m_ItemName.text = item.config.ItemName;
+            m_ItemName.color = UIHelper.GetUIColor(item.config.ItemColor, true);
             var successRate = model.GetMaterialSuccessRate(model.selectedLevel.value, model.selectedPlace.value, this.equip);
             m_Rate.text = string.Format("鎴愬姛鐜� +{0}", Mathf.RoundToInt(successRate * 100));
             m_Item.SetItem(item.config.ID, 1);
diff --git a/System/EquipTrain/EquipTrainModel.cs b/System/EquipTrain/EquipTrainModel.cs
index 7d3066e..6858aab 100644
--- a/System/EquipTrain/EquipTrainModel.cs
+++ b/System/EquipTrain/EquipTrainModel.cs
@@ -90,8 +90,8 @@
                 equipTrainMaxLevel.value = trainState == TrainState.Empty ? -1 : GetMaxTrainLevel(level, place);
                 material.value = GetTrainMaterial(level, place);
 
-                InitTrainableProperties(level, place);
                 operateType.value = CalculateTrainOperateType(level, place);
+                InitTrainableProperties(level, place, operateType.value);
             }
 
         }
@@ -165,8 +165,8 @@
             equipTrainMaxLevel.value = trainState == TrainState.Empty ? -1 : GetMaxTrainLevel(level, place);
             material.value = GetTrainMaterial(level, place);
 
-            InitTrainableProperties(level, place);
             operateType.value = CalculateTrainOperateType(level, place);
+            InitTrainableProperties(level, place, operateType.value);
         }
 
         public void SetInevitable(int index, bool invevitable)
@@ -307,7 +307,7 @@
             return places;
         }
 
-        private void InitTrainableProperties(int level, int place)
+        private void InitTrainableProperties(int level, int place, TrainOperateType operateType)
         {
             propertyBars.Clear();
             var trainState = GetEquipPlaceTrainState(level, place);
@@ -321,16 +321,19 @@
             var propertyBar = new EquipTrainPropertyBar(data.config.attType1, trainState == TrainState.Empty ? 0 : data.config.attMax1, trainState);
             propertyBar.propertyValue.value = trainedProperties.x;
             propertyBar.deltaValue.value = unSavedProperties.x;
+            propertyBar.operateType.value = operateType;
             propertyBars.Add(propertyBar);
 
             propertyBar = new EquipTrainPropertyBar(data.config.attType2, trainState == TrainState.Empty ? 0 : data.config.attMax2, trainState);
             propertyBar.propertyValue.value = trainedProperties.y;
             propertyBar.deltaValue.value = unSavedProperties.y;
+            propertyBar.operateType.value = operateType;
             propertyBars.Add(propertyBar);
 
             propertyBar = new EquipTrainPropertyBar(data.config.attType3, trainState == TrainState.Empty ? 0 : data.config.attMax3, trainState);
             propertyBar.propertyValue.value = trainedProperties.z;
             propertyBar.deltaValue.value = unSavedProperties.z;
+            propertyBar.operateType.value = operateType;
             propertyBars.Add(propertyBar);
 
             inevitableMaterialCount.value = CalculateInevitableMaterialCount();
diff --git a/System/EquipTrain/EquipTrainPropertyBar.cs b/System/EquipTrain/EquipTrainPropertyBar.cs
index d49e87b..4f50326 100644
--- a/System/EquipTrain/EquipTrainPropertyBar.cs
+++ b/System/EquipTrain/EquipTrainPropertyBar.cs
@@ -13,6 +13,8 @@
         public readonly LogicInt propertyValue = new LogicInt();
         public readonly LogicInt deltaValue = new LogicInt();
         public readonly LogicBool inevitable = new LogicBool();
+        public readonly LogicEnum<EquipTrainModel.TrainOperateType> operateType
+            = new LogicEnum<EquipTrainModel.TrainOperateType>(EquipTrainModel.TrainOperateType.None);
 
         public EquipTrainPropertyBar(int propertyId, int upperLimit, EquipTrainModel.TrainState trainState)
         {
diff --git a/System/EquipTrain/EquipTrainPropertyBarBehaviour.cs b/System/EquipTrain/EquipTrainPropertyBarBehaviour.cs
index 92f585a..c71f351 100644
--- a/System/EquipTrain/EquipTrainPropertyBarBehaviour.cs
+++ b/System/EquipTrain/EquipTrainPropertyBarBehaviour.cs
@@ -61,6 +61,7 @@
                     break;
                 case EquipTrainModel.TrainState.Allowable:
                     m_Inevitable.gameObject.SetActive(true);
+                    m_DeltaValue.gameObject.SetActive(true);
                     break;
             }
 
@@ -81,15 +82,25 @@
                 m_Progress.value = Mathf.Clamp01((float)value / maxValue);
             }
 
-            if (force || propertyBar.deltaValue.dirty)
+            if (force || propertyBar.deltaValue.dirty || propertyBar.operateType.dirty || propertyBar.inevitable.dirty)
             {
                 var deltaValue = propertyBar.deltaValue.Fetch();
+                var operateType = propertyBar.operateType.Fetch();
+                var inevitable = propertyBar.inevitable.Fetch();
 
-                var isPerfect = propertyBar.upperLimit > 0 && propertyBar.propertyValue.value >= propertyBar.upperLimit;
-                if (isPerfect)
+                m_Inevitable.isOn = inevitable;
+                if (operateType == EquipTrainModel.TrainOperateType.Train)
                 {
-                    m_DeltaValue.text = "瀹岀編";
-                    m_DeltaValue.color = UIHelper.GetUIColor(TextColType.Green, true);
+                    var isPerfect = propertyBar.upperLimit > 0 && propertyBar.propertyValue.value >= propertyBar.upperLimit;
+                    if (isPerfect)
+                    {
+                        m_DeltaValue.text = "瀹岀編";
+                        m_DeltaValue.color = UIHelper.GetUIColor(TextColType.Green, true);
+                    }
+                    else
+                    {
+                        m_DeltaValue.text = inevitable ? "蹇呭" : "";
+                    }
                 }
                 else
                 {
@@ -109,6 +120,7 @@
                         m_DeltaValue.color = UIHelper.GetUIColor(TextColType.Green, true);
                     }
                 }
+
             }
 
         }
diff --git a/System/EquipTrain/EquipTrainWin.cs b/System/EquipTrain/EquipTrainWin.cs
index 9f598bb..01d33d8 100644
--- a/System/EquipTrain/EquipTrainWin.cs
+++ b/System/EquipTrain/EquipTrainWin.cs
@@ -207,7 +207,7 @@
         private void DisplayInevitableMaterial(int level, int place, int need)
         {
             var trainable = model.GetEquipPlaceTrainState(level, place) == EquipTrainModel.TrainState.Allowable;
-            if (trainable)
+            if (trainable && need > 0)
             {
                 var own = packModel.GetItemCountByID(PackType.Item, GeneralDefine.equipTrainMustItemId);
                 var type = EquipTrainModel.GetTrainType(place);

--
Gitblit v1.8.0