From fb294bdf89b7977ea041c54d42dbcd3763fd9b7c Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 27 八月 2018 15:08:36 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/Strengthening/GodBeastAttributes.cs |  299 ++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 233 insertions(+), 66 deletions(-)

diff --git a/System/Strengthening/GodBeastAttributes.cs b/System/Strengthening/GodBeastAttributes.cs
index 284a63d..0800be7 100644
--- a/System/Strengthening/GodBeastAttributes.cs
+++ b/System/Strengthening/GodBeastAttributes.cs
@@ -9,18 +9,32 @@
 using System;
 using TableConfig;
 //绁炲吔寮哄寲锛堢鍏藉睘鎬у睍绀猴級
-namespace Snxxz.UI {
+namespace Snxxz.UI
+{
 
-    public class GodBeastAttributes:MonoBehaviour {
+    public class GodBeastAttributes : MonoBehaviour
+    {
         [SerializeField] ItemCell m_ItemCell;
         [SerializeField] GameObject m_FrameNull;
         [SerializeField] GameObject m_FullLevel;
         [SerializeField] GameObject m_BottomDisplay;
+        [SerializeField] Text m_LvNowText;
+        [SerializeField] Text m_LvNextText;
+
         [SerializeField] IntensifySmoothSlider m_ExpSlider;
         [SerializeField] Text m_ExpNum;
-        [SerializeField] Text m_TextAttributes;
-        [SerializeField] Text m_TextAttributesAdd;
+
+        [SerializeField] Text m_TextAttributes1;
+        [SerializeField] Text m_TextAttributesAdd1;
+        [SerializeField] Text m_TextAttributes2;
+        [SerializeField] Text m_TextAttributesAdd2;
         [SerializeField] GodBeastSlidingList m_GodBeastSlidingList;
+
+        [SerializeField] Toggle m_DoubleToggle;
+        [SerializeField] Button m_StrengthenBtn;
+
+        [SerializeField] UIAlphaTween m_UIAlphaTween;
+        [SerializeField] Slider m_Slider;
         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>();
@@ -28,21 +42,30 @@
         PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } }
         ItemTipsModel _itemTipsModel;
         ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } }
-        private int GodBeastNumber=0;//绁炲吔缂栧彿
+        private int GodBeastNumber = 0;//绁炲吔缂栧彿
         private int GodBeastPart = 0;//绁炲吔瑁呭ID
 
+        private int DogZLv = 0;//鑾峰彇绁炲吔绛夌骇
+        private int DogZExp = 0;//鐔熺粌搴�
+
+        private ItemModel m_DogZItemModel = null;
         private int SingleProficiency = 0;//鍗曞�嶇啛缁冨害
         private int DoubleProficiency = 0;//鍙屽�嶇啛缁冨害
         private int NeedFairyJade = 0;//鎵�闇�浠欑帀
-        private  void Start()
+        private void Start()
         {
-            
+            m_DoubleToggle.onValueChanged.AddListener(OnClickToggle);
+            m_StrengthenBtn.AddListener(OnClickStrengthBtn);
         }
         private void OnEnable()
         {
+            if (m_DoubleToggle.isOn)
+            {
+                m_DoubleToggle.isOn = false;
+            }
             GodBeastReinforcementWin.ChooseToModify += ChooseToModify;
             GodBeastSlidingList.AbsorbEvent += AbsorbEvent;
-        }     
+        }
         private void OnDisable()
         {
             GodBeastReinforcementWin.ChooseToModify -= ChooseToModify;
@@ -63,12 +86,21 @@
 
         }
 
+        private void OnClickToggle(bool Isbool)
+        {
+            AttributeAssignment();
+        }
+        private void OnClickStrengthBtn()
+        {
+
+        }
         private void ChooseToModify(int locationMarker)
         {
             GetGodBeastLocationMarker(locationMarker);
         }
         private void AbsorbEvent(Dictionary<int, int> absorb)
         {
+            GetDogZLevelAndExp();
             AttributeAssignment();
         }
         public void GetGodBeastLocationMarker(int LocationMarker)//鑾峰彇绁炲吔瑁呭鐨勬爣璁颁俊鎭�
@@ -89,7 +121,7 @@
                             m_ItemCell.Init(ItemModel);
                             m_ItemCell.cellBtn.RemoveAllListeners();
                             int type = i;
-                            m_ItemCell.cellBtn.AddListener(()=> 
+                            m_ItemCell.cellBtn.AddListener(() =>
                             {
                                 itemTipsModel.SetItemTipsModel(PackType.rptDogzEquip, itemModel[type].itemInfo.ItemGUID);
                             });
@@ -98,6 +130,7 @@
                 }
                 m_FrameNull.SetActive(true);
                 m_FullLevel.SetActive(false);
+                GetDogZLevelAndExp();
                 AttributeAssignment();
             }
             else
@@ -115,8 +148,195 @@
 
         public void AttributeAssignment()
         {
+            if (m_DogZItemModel == null)
+            {
+                return;
+            }
+            GainProficiency();//鑾峰彇鐔熺粌搴�
+            var IudetDogzEquipPlus = m_DogZItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
+            if (IudetDogzEquipPlus != null)
+            {
+                int lv = QualityLimit[m_DogZItemModel.chinItemModel.ItemColor];
+                var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv);
+                if (DogZLv >= lv)
+                {
+                    m_FrameNull.SetActive(false);
+                    m_FullLevel.SetActive(true);
+                    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;
+                }
+                else
+                {
+                    if (m_DoubleToggle.isOn)
+                    {
+                        PropertySetting(DogZExp, DoubleProficiency);
+                    }
+                    else
+                    {
+                        PropertySetting(DogZExp, SingleProficiency);
+                    }
+
+                }
+            }
+            else
+            {
+                if (m_DoubleToggle.isOn)
+                {
+                    PropertySetting(0, DoubleProficiency);
+                }
+                else
+                {
+                    PropertySetting(0, SingleProficiency);
+                }
+            }
+        }
+        private void GainProficiency()//閫変腑瑁呭鐨勮幏鍙栫啛缁冨害
+        {
+            SingleProficiency = 0;
+            DoubleProficiency = 0;
+            NeedFairyJade = 0;
+            Dictionary<int, int> DicAb = m_GodBeastSlidingList.Absorption_Dic;
+            foreach (var key in DicAb.Keys)
+            {
+                ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptDogzItem, key);
+                if (itemModel != null)
+                {
+                    if (itemModel.chinItemModel.Effect1 == 235)
+                    {
+                        var IudetDogzEquipPlus = itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
+                        SingleProficiency += itemModel.chinItemModel.EffectValueA1 * DicAb[key];
+                        if (IudetDogzEquipPlus != null)
+                        {
+                            SingleProficiency += IudetDogzEquipPlus[1];
+                            DoubleProficiency += itemModel.chinItemModel.EffectValueA1;
+                        }
+                        else
+                        {
+                            DoubleProficiency += itemModel.chinItemModel.EffectValueA1 * 2 * DicAb[key];
+                            NeedFairyJade += itemModel.chinItemModel.Effect2 * DicAb[key];
+                        }
+                    }
+                }
+            }
+
+        }
+        private void PropertySetting(int ExpTotalNow, int ToExpTotal)//灞炴�ц缃�
+        {
+            m_FrameNull.gameObject.SetActive(true);
+            m_FullLevel.SetActive(false);
+            int toLv = ToLv(ToExpTotal);
+            m_LvNowText.text = "+" + DogZLv.ToString();
+            if (DogZLv == toLv)
+            {
+                m_LvNextText.text = "+" + (toLv + 1).ToString();
+            }
+            else
+            {
+                m_LvNextText.text = "+" + toLv.ToString();
+            }
+            var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, DogZLv);
+            int[] AttType = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attType);
+            int[] AttValue = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attValue);
+            if (ToExpTotal == 0)
+            {
+                m_Slider.gameObject.SetActive(false);
+                m_TextAttributesAdd1.gameObject.SetActive(false);
+                m_TextAttributesAdd2.gameObject.SetActive(false);
+                m_ExpNum.text = DogZExp + "/" + DogzEquipConfig.upExpTotal;
+                if (AttType.Length > 1)
+                {
+                    m_TextAttributes1.gameObject.SetActive(true);
+                    m_TextAttributes2.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];
+                }
+                else
+                {
+                    m_TextAttributes2.gameObject.SetActive(false);
+                    string StrName1 = Config.Instance.Get<PlayerPropertyConfig>(AttType[0]).Name;
+                    m_TextAttributes1.text = StrName1 + ":" + AttValue[0];
+                }
+            }
+            else
+            {
+                m_Slider.gameObject.SetActive(true);              
+                if (DogZExp + ToExpTotal >= DogzEquipConfig.upExpTotal)
+                {
+                    m_Slider.value = 1f;
+                }
+                else
+                {
+                    m_Slider.value = (float)(DogZExp + ToExpTotal) / (float)(DogzEquipConfig.upExpTotal);
+                }
+                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;
+                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]);
+                }
+            }
+        }
+
+        private int ToLv(int ToExpTotal)//鑾峰彇绛夊埌杈剧殑鐔熺粌搴︾瓑绾�
+        {
+            int DogzLv = 0;
+            if (m_DogZItemModel == null)
+            {
+                return DogzLv;
+            }
+            int lv = QualityLimit[m_DogZItemModel.chinItemModel.ItemColor];
+            for (int i = lv; i >= 0; i--)
+            {
+                var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, i);
+                if (ToExpTotal < DogzEquipConfig.upExpTotal)
+                {
+                    DogzLv = DogzEquipConfig.level;
+                }
+            }
+            var DogzEquipMaxConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv);
+            if (ToExpTotal >= DogzEquipMaxConfig.upExpTotal)
+            {
+                DogzLv = DogzEquipMaxConfig.level;
+            }
+            return DogzLv;
+        }
+
+        private void GetDogZLevelAndExp()//鑾峰彇褰撳墠鎵�閫夐�夋嫨绁炲吔鐨勭瓑绾у拰鐔熺粌搴�
+        {
+            DogZLv = 0;
+            DogZExp = 0;
+            m_DogZItemModel = null;
             List<ItemModel> itemModel = dogz_model.GetDogzEquips(GodBeastNumber);
-            ItemModel ItemModel=null;
+            ItemModel ItemModel = null;
             if (itemModel != null)
             {
                 for (int i = 0; i < itemModel.Count; i++)
@@ -131,67 +351,14 @@
             {
                 return;
             }
-
-            GainProficiency();//鑾峰彇鐔熺粌搴�
+            m_DogZItemModel = ItemModel;
             var IudetDogzEquipPlus = ItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
             if (IudetDogzEquipPlus != null)
             {
-                int lv = QualityLimit[ItemModel.chinItemModel.ItemColor];
-                var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv);
-                if (IudetDogzEquipPlus[0] >= lv)
-                {
-                    m_FrameNull.SetActive(false);
-                    m_FullLevel.SetActive(true);
-                    m_ExpSlider.stage = lv;
-                    m_ExpSlider.delay = 0f;
-                    m_ExpSlider.ResetStage();
-                    m_ExpSlider.value = 1;
-                    m_ExpNum.text = DogzEquipConfig.upExpTotal + "/" + DogzEquipConfig.upExpTotal;
-                }
-                else
-                {
-
-
-                }
-            }
-            else
-            {
-                var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart,0);
-                m_ExpNum.text =  "0/" + DogzEquipConfig.upExpTotal;
+                DogZLv = IudetDogzEquipPlus[0];
+                DogZExp = IudetDogzEquipPlus[1];
             }
         }
-        private void  GainProficiency()//鑾峰彇鐔熺粌搴�
-        {
-            SingleProficiency = 0;
-            DoubleProficiency = 0;
-            NeedFairyJade = 0;
-            Dictionary<int,int> DicAb=m_GodBeastSlidingList.Absorption_Dic;
-            foreach (var key in DicAb.Keys)
-            {
-                ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptDogzItem, key);
-                if (itemModel != null)
-                {
-                    if (itemModel.chinItemModel.Effect1 == 235)
-                    {
-                        var IudetDogzEquipPlus = itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
-                        SingleProficiency += itemModel.chinItemModel.EffectValueA1* DicAb[key];
-                        if (IudetDogzEquipPlus != null)
-                        {
-                            SingleProficiency += IudetDogzEquipPlus[1];
-                            DoubleProficiency += itemModel.chinItemModel.EffectValueA1;
-                        }
-                        else
-                        {
-                            DoubleProficiency += itemModel.chinItemModel.EffectValueA1 * 2* DicAb[key];
-                            NeedFairyJade += itemModel.chinItemModel.Effect2* DicAb[key];
-                        }
-                    }
-                }
-            }
-
-        }
-
-
     }
 
 }

--
Gitblit v1.8.0