From 78bfe524ea4776c47f6314e56e97f39970b00fce Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期二, 25 九月 2018 15:07:07 +0800
Subject: [PATCH] Merge branch 'master' into 1871天赋功能

---
 System/Strengthening/GodBeastAttributes.cs |  185 +++++++++++++++++++++++++++++++++------------
 1 files changed, 135 insertions(+), 50 deletions(-)

diff --git a/System/Strengthening/GodBeastAttributes.cs b/System/Strengthening/GodBeastAttributes.cs
index bbbfb5a..03cf1f7 100644
--- a/System/Strengthening/GodBeastAttributes.cs
+++ b/System/Strengthening/GodBeastAttributes.cs
@@ -35,9 +35,13 @@
 
         [SerializeField] UIAlphaTween m_UIAlphaTween;
         [SerializeField] Slider m_Slider;
+
+        [SerializeField] GameObject m_Text_two;//涓嬬骇灞炴��
+        [SerializeField] Button m_StrengthenDoubleBtn;//鍙屽�嶅己鍖栨寜閽�
+        [SerializeField] Text m_NeedFairy;//鎵�闇�鐨勪粰鐜�
+        [SerializeField] GameObject m_BottomBox;
         DogzModel Dogz_model;
-        DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } }
-        private Dictionary<int, int> QualityLimit = new Dictionary<int, int>();
+        DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } }
         PlayerPackModel _playerPack;
         PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } }
         ItemTipsModel _itemTipsModel;
@@ -57,6 +61,7 @@
         {
             m_DoubleToggle.onValueChanged.AddListener(OnClickToggle);
             m_StrengthenBtn.AddListener(OnClickStrengthBtn);
+            m_StrengthenDoubleBtn.AddListener(OnClickStrengthBtn);
         }
         private void OnEnable()
         {
@@ -69,17 +74,15 @@
         }
         private void OnDisable()
         {
+            GodBeast_Number = 0;
+            GodBeast_Part = 0;
+            
             GodBeastReinforcementWin.ChooseToModify -= ChooseToModify;
             godBeastModel.AbsorbEvent -= AbsorbEvent;
         }
 
         public void Init()
         {
-            if (QualityLimit.Count <= 0)
-            {
-                string DogzAssist = Config.Instance.Get<FuncConfigConfig>("DogzAssist").Numerical4;//鑾峰彇涓嶅悓鍝佽川鐨勭鍏藉己鍖栦笂闄�
-                QualityLimit = ConfigParse.GetDic<int, int>(DogzAssist);
-            }
         }
 
         public void Unit()
@@ -89,7 +92,11 @@
 
         private void OnClickToggle(bool Isbool)
         {
-            AttributeAssignment();
+            if (GodBeastNumber != 0 && GodBeastPart != 0)
+            {
+                AttributeAssignment();
+            }
+          
         }
         private void OnClickStrengthBtn()
         {
@@ -102,19 +109,28 @@
                 ListCount.Add(DicAb[key]);
             }
             if (m_DoubleToggle.isOn)
-            {                
+            {
+                if (ListIndex.Count <= 0)
+                {
+                    return;
+                }
                 dogz_model.SendDogzEquipStrength(m_DogZItemModel.itemInfo.ItemPlace, ListIndex, ListCount, 1);
             }
             else
             {
+                if (ListIndex.Count <= 0)
+                {
+                    return;
+                }
                 dogz_model.SendDogzEquipStrength(m_DogZItemModel.itemInfo.ItemPlace, ListIndex, ListCount, 0);
             }
         }
+
         private void ChooseToModify(int locationMarker)
         {
             GetGodBeastLocationMarker(locationMarker);
         }
-        private void AbsorbEvent()//閫変腑鍙栨秷鐨勬暟鎹埛鏂�
+        private void AbsorbEvent()//閫変腑涓庡彇娑堢殑鏁版嵁鍒锋柊
         {
             GetDogZLevelAndExp();
             AttributeAssignment();
@@ -144,21 +160,32 @@
                         }
                     }
                 }
+                m_UIAlphaTween.gameObject.SetActive(true);
                 m_FrameNull.SetActive(true);
-                m_FullLevel.SetActive(false);
+                m_FullLevel.SetActive(false);            
                 GetDogZLevelAndExp();
                 AttributeAssignment();
             }
             else
             {
+                GodBeastNumber = 0;
+                GodBeastPart = 0;
                 m_ItemCell.gameObject.SetActive(false);
                 m_ExpSlider.stage = 0;
                 m_ExpSlider.delay = 0f;
                 m_ExpSlider.ResetStage();
                 m_ExpSlider.value = 0;
                 m_ExpNum.text = "0/0";
+                m_TextAttributes1.gameObject.SetActive(false);
+                m_TextAttributes2.gameObject.SetActive(false);
+                m_TextAttributesAdd1.gameObject.SetActive(false);
+                m_TextAttributesAdd2.gameObject.SetActive(false);
+                m_StrengthenDoubleBtn.gameObject.SetActive(false);
+                m_Text_two.SetActive(false);
                 m_FrameNull.SetActive(false);
                 m_FullLevel.SetActive(false);
+                m_UIAlphaTween.gameObject.SetActive(false);
+                m_BottomBox.SetActive(false);
             }
         }
 
@@ -169,43 +196,71 @@
                 return;
             }
             GainProficiency();//鑾峰彇鐔熺粌搴�
+            m_BottomBox.SetActive(true);
             var IudetDogzEquipPlus = m_DogZItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
             if (IudetDogzEquipPlus != null)
             {
-                int lv = QualityLimit[m_DogZItemModel.chinItemModel.ItemColor];
+                int lv = godBeastModel.QualityLimit[m_DogZItemModel.chinItemModel.ItemColor];
                 var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv);
                 if (DogZLv >= lv)
                 {
+                    m_BottomBox.SetActive(false);
+                    m_Text_two.SetActive(false);
                     m_FrameNull.SetActive(false);
+                    m_TextAttributes1.gameObject.SetActive(false);
+                    m_TextAttributes2.gameObject.SetActive(false);
+                    m_TextAttributesAdd1.gameObject.SetActive(false);
+                    m_TextAttributesAdd2.gameObject.SetActive(false);
                     m_FullLevel.SetActive(true);
+                    GodBeast_Number = GodBeastNumber;
+                    GodBeast_Part = GodBeastPart;
                     m_ExpSlider.stage = lv;
                     m_ExpSlider.delay = 0f;
                     m_ExpSlider.ResetStage();
                     m_ExpSlider.value = 1;
                     m_Slider.gameObject.SetActive(false);
-                    m_ExpNum.text = DogzEquipConfig.upExpTotal + "/" + DogzEquipConfig.upExpTotal;
+                    int NeedExp = DogzEquipConfig.upExpTotal;
+                    if (DogZLv > 0)
+                    {
+                        var Dogz_EquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, DogZLv - 1);
+                        NeedExp -= Dogz_EquipConfig.upExpTotal;
+                    }
+                    m_ExpNum.text = NeedExp + "/" + NeedExp;
                 }
                 else
                 {
+                  
+                    m_StrengthenDoubleBtn.interactable = true;
+                    m_StrengthenBtn.interactable = true;
+                    m_Text_two.SetActive(true);
                     if (m_DoubleToggle.isOn)
                     {
+                        m_StrengthenBtn.gameObject.SetActive(false);
+                        m_StrengthenDoubleBtn.gameObject.SetActive(true);
+                        m_NeedFairy.text = NeedFairyJade.ToString();
                         PropertySetting(DogZExp, DoubleProficiency);
                     }
                     else
                     {
+                        m_StrengthenBtn.gameObject.SetActive(true);
+                        m_StrengthenDoubleBtn.gameObject.SetActive(false);
                         PropertySetting(DogZExp, SingleProficiency);
                     }
-
                 }
             }
             else
             {
                 if (m_DoubleToggle.isOn)
                 {
+                    m_StrengthenBtn.gameObject.SetActive(false);
+                    m_StrengthenDoubleBtn.gameObject.SetActive(true);
+                    m_NeedFairy.text = NeedFairyJade.ToString();
                     PropertySetting(0, DoubleProficiency);
                 }
                 else
                 {
+                    m_StrengthenBtn.gameObject.SetActive(true);
+                    m_StrengthenDoubleBtn.gameObject.SetActive(false);
                     PropertySetting(0, SingleProficiency);
                 }
             }
@@ -256,6 +311,12 @@
                 m_LvNextText.text = "+" + toLv.ToString();
             }
             var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, DogZLv);
+            int NeedExp = DogzEquipConfig.upExpTotal;
+            if (DogZLv > 0)
+            {
+                var Dogz_EquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, DogZLv - 1);
+                NeedExp -= Dogz_EquipConfig.upExpTotal;
+            }
             int[] AttType = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attType);
             int[] AttValue = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attValue);
             if (ToExpTotal == 0)
@@ -263,8 +324,9 @@
                 m_Slider.gameObject.SetActive(false);
                 m_TextAttributesAdd1.gameObject.SetActive(false);
                 m_TextAttributesAdd2.gameObject.SetActive(false);
-                m_ExpNum.text = DogZExp + "/" + DogzEquipConfig.upExpTotal;
-                float value = (float)DogZExp / DogzEquipConfig.upExpTotal;
+
+                m_ExpNum.text = DogZExp + "/" + NeedExp;
+                float value = (float)DogZExp / NeedExp;
                 SetExperienceBar(DogZLv, value);
                 if (AttType.Length > 1)
                 {
@@ -285,54 +347,30 @@
             else
             {
                 m_Slider.gameObject.SetActive(true);
-                if (DogZExp + ToExpTotal >= DogzEquipConfig.upExpTotal)
+                if (DogZExp + ToExpTotal >= NeedExp)
                 {
                     m_Slider.value = 1f;
                 }
                 else
                 {
-                    m_Slider.value = (float)(DogZExp + ToExpTotal) / (float)(DogzEquipConfig.upExpTotal);
+                    m_Slider.value = (float)(DogZExp + ToExpTotal) / (float)(NeedExp);
                 }
                 m_UIAlphaTween.Play();
-                var DogzEquipToConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, toLv);
-                int[] AttTypeTo = ConfigParse.GetMultipleStr<int>(DogzEquipToConfig.attType);
-                int[] AttValueTo = ConfigParse.GetMultipleStr<int>(DogzEquipToConfig.attValue);
                 string strColor = string.Format(Language.Get("DogzGreenText"), ToExpTotal);
-                m_ExpNum.text = DogZExp + strColor + "/" + DogzEquipConfig.upExpTotal;
-                float value= (float)DogZExp / DogzEquipConfig.upExpTotal;
+                m_ExpNum.text = DogZExp + strColor + "/" + NeedExp;
+                float value = (float)DogZExp / NeedExp;
                 SetExperienceBar(DogZLv, value);
-                if (AttType.Length > 1)
-                {
-                    m_TextAttributes1.gameObject.SetActive(true);
-                    m_TextAttributes2.gameObject.SetActive(true);
-                    m_TextAttributesAdd1.gameObject.SetActive(true);
-                    m_TextAttributesAdd2.gameObject.SetActive(true);
-                    string StrName1 = Config.Instance.Get<PlayerPropertyConfig>(AttType[0]).Name;
-                    string StrName2 = Config.Instance.Get<PlayerPropertyConfig>(AttType[1]).Name;
-                    m_TextAttributes1.text = StrName1 + ":" + AttValue[0];
-                    m_TextAttributes2.text = StrName2 + ":" + AttValue[1];
-                    m_TextAttributesAdd1.text = "+" + (AttValueTo[0] - AttValue[0]);
-                    m_TextAttributesAdd2.text = "+" + (AttValueTo[1] - AttValue[1]);
-                }
-                else
-                {
-                    m_TextAttributes1.gameObject.SetActive(true);
-                    m_TextAttributesAdd1.gameObject.SetActive(true);
-                    m_TextAttributes2.gameObject.SetActive(false);
-                    m_TextAttributesAdd2.gameObject.SetActive(false);
-                    string StrName1 = Config.Instance.Get<PlayerPropertyConfig>(AttType[0]).Name;
-                    m_TextAttributes1.text = StrName1 + ":" + AttValue[0];
-                    m_TextAttributesAdd1.text = "+" + (AttValueTo[0] - AttValue[0]);
-                }
             }
-
+            SetAddAttributes(DogzEquipConfig, GodBeastPart, toLv);//璁剧疆棰勮鐨勫睘鎬�
             if (ToExpTotal == 0)
             {
                 m_StrengthenBtn.interactable = false;
+                m_StrengthenDoubleBtn.interactable = false;
             }
             else
             {
                 m_StrengthenBtn.interactable = true;
+                m_StrengthenDoubleBtn.interactable = true;
             }
         }
 
@@ -343,7 +381,12 @@
             {
                 return DogzLv;
             }
-            int lv = QualityLimit[m_DogZItemModel.chinItemModel.ItemColor];
+            int lv = godBeastModel.QualityLimit[m_DogZItemModel.chinItemModel.ItemColor];
+            var IudetDogzEquipPlus = m_DogZItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
+            if (IudetDogzEquipPlus != null)
+            {
+                ToExpTotal+= IudetDogzEquipPlus[1];
+            }
             for (int i = lv; i >= 0; i--)
             {
                 var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, i);
@@ -386,14 +429,23 @@
             if (IudetDogzEquipPlus != null)
             {
                 DogZLv = IudetDogzEquipPlus[0];
-                DogZExp = IudetDogzEquipPlus[1];
+                if (DogZLv > 0)
+                {
+                    var Dogz_EquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, DogZLv - 1);
+                    DogZExp = IudetDogzEquipPlus[1] - Dogz_EquipConfig.upExpTotal;
+                }
+                else
+                {
+                    DogZExp = IudetDogzEquipPlus[1];
+                }
+
             }
         }
 
 
         int GodBeast_Number = 0;
         int GodBeast_Part = 0;
-        private void SetExperienceBar(int lv,float value)//璁剧疆缁忛獙鏉�
+        private void SetExperienceBar(int lv, float value)//璁剧疆缁忛獙鏉�
         {
             if (GodBeast_Number != GodBeastNumber || GodBeast_Part != GodBeastPart)
             {
@@ -411,6 +463,39 @@
                 m_ExpSlider.value = value;
             }
         }
+
+        private void SetAddAttributes(DogzEquipPlusConfig DogzEquipConfig, int GodBeastPart, int toLv)//璁剧疆棰勮鐨勫睘鎬�
+        {
+            int[] AttType = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attType);
+            int[] AttValue = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attValue);
+            var DogzEquipToConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, toLv);
+            int[] AttTypeTo = ConfigParse.GetMultipleStr<int>(DogzEquipToConfig.attType);
+            int[] AttValueTo = ConfigParse.GetMultipleStr<int>(DogzEquipToConfig.attValue);
+            if (AttType.Length > 1)
+            {
+                m_TextAttributes1.gameObject.SetActive(true);
+                m_TextAttributes2.gameObject.SetActive(true);
+                m_TextAttributesAdd1.gameObject.SetActive(true);
+                m_TextAttributesAdd2.gameObject.SetActive(true);
+                string StrName1 = Config.Instance.Get<PlayerPropertyConfig>(AttType[0]).Name;
+                string StrName2 = Config.Instance.Get<PlayerPropertyConfig>(AttType[1]).Name;
+                m_TextAttributes1.text = StrName1 + ":" + AttValue[0];
+                m_TextAttributes2.text = StrName2 + ":" + AttValue[1];
+                m_TextAttributesAdd1.text = "+" + (AttValueTo[0] - AttValue[0]);
+                m_TextAttributesAdd2.text = "+" + (AttValueTo[1] - AttValue[1]);
+            }
+            else
+            {
+                m_TextAttributes1.gameObject.SetActive(true);
+                m_TextAttributesAdd1.gameObject.SetActive(true);
+                m_TextAttributes2.gameObject.SetActive(false);
+                m_TextAttributesAdd2.gameObject.SetActive(false);
+                string StrName1 = Config.Instance.Get<PlayerPropertyConfig>(AttType[0]).Name;
+                m_TextAttributes1.text = StrName1 + ":" + AttValue[0];
+                m_TextAttributesAdd1.text = "+" + (AttValueTo[0] - AttValue[0]);
+            }
+
+        }
     }
 
 }

--
Gitblit v1.8.0