From 4d9e4eec1e433353fa46a4edb191868fd39662ea Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期四, 20 九月 2018 20:41:44 +0800
Subject: [PATCH] 2614  【前端】神兽——强化功能

---
 Utility/EnumHelper.cs                            |    1 
 System/Strengthening/GodBeastModel.cs            |    1 
 System/Strengthening/GodBeastReinforcementWin.cs |   60 ++++++++++++---
 System/Strengthening/GodBeastAttributes.cs       |  137 ++++++++++++++++++++++++---------
 4 files changed, 148 insertions(+), 51 deletions(-)

diff --git a/System/Strengthening/GodBeastAttributes.cs b/System/Strengthening/GodBeastAttributes.cs
index bbbfb5a..d5a1570 100644
--- a/System/Strengthening/GodBeastAttributes.cs
+++ b/System/Strengthening/GodBeastAttributes.cs
@@ -35,6 +35,10 @@
 
         [SerializeField] UIAlphaTween m_UIAlphaTween;
         [SerializeField] Slider m_Slider;
+
+        [SerializeField] GameObject m_Text_two;//涓嬬骇灞炴��
+        [SerializeField] Button m_StrengthenDoubleBtn;//鍙屽�嶅己鍖栨寜閽�
+        [SerializeField] Text m_NeedFairy;//鎵�闇�鐨勪粰鐜�
         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>();
@@ -57,6 +61,7 @@
         {
             m_DoubleToggle.onValueChanged.AddListener(OnClickToggle);
             m_StrengthenBtn.AddListener(OnClickStrengthBtn);
+            m_StrengthenDoubleBtn.AddListener(OnClickStrengthBtn);
         }
         private void OnEnable()
         {
@@ -102,7 +107,7 @@
                 ListCount.Add(DicAb[key]);
             }
             if (m_DoubleToggle.isOn)
-            {                
+            {
                 dogz_model.SendDogzEquipStrength(m_DogZItemModel.itemInfo.ItemPlace, ListIndex, ListCount, 1);
             }
             else
@@ -110,11 +115,12 @@
                 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();
@@ -176,36 +182,59 @@
                 var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv);
                 if (DogZLv >= lv)
                 {
+                    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 = DogZExp + "/" + NeedExp;
                 }
                 else
                 {
+                    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 +285,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 +298,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 +321,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;
             }
         }
 
@@ -344,6 +356,11 @@
                 return DogzLv;
             }
             int lv = 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 +403,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 +437,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]);
+            }
+
+        }
     }
 
 }
diff --git a/System/Strengthening/GodBeastModel.cs b/System/Strengthening/GodBeastModel.cs
index 0864a34..f890d88 100644
--- a/System/Strengthening/GodBeastModel.cs
+++ b/System/Strengthening/GodBeastModel.cs
@@ -17,6 +17,7 @@
     public event Action AbsorbEvent;
     public int ItemInde = 0;//鐗╁搧涓嬫爣
     public ItemModel Crystal_ItemModel;
+    public int ItemPlace =-1;//绁炲吔瑁呭浣嶇疆淇℃伅
     DogzModel Dogz_model;
     DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } }
     PlayerPackModel _playerPack;
diff --git a/System/Strengthening/GodBeastReinforcementWin.cs b/System/Strengthening/GodBeastReinforcementWin.cs
index 1d4769e..f6aa787 100644
--- a/System/Strengthening/GodBeastReinforcementWin.cs
+++ b/System/Strengthening/GodBeastReinforcementWin.cs
@@ -21,6 +21,7 @@
         public int GodBeastStar;//绁炲吔鏄熺骇
         public int LocationMarker;//浣嶇疆鏍囪
         public int EquipScore;//瑁呭璇勫垎
+        public int ItemPlace;//鑳屽寘瑁呭浣嶇疆
     }
     public class GodBeastReinforcementWin : Window
     {
@@ -32,6 +33,8 @@
         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>()); } }
+        GodBeastModel GodBeastModel;
+        GodBeastModel godBeastModel { get { return GodBeastModel ?? (GodBeastModel = ModelCenter.Instance.GetModel<GodBeastModel>()); } }
         public static event Action<int> ChooseToModify;
         private List<GodBeastClass> GodBeastList = new List<GodBeastClass>();
         private int CurrentlySelected = 0;
@@ -49,13 +52,33 @@
         {
             CurrentlySelected = 0;
             GetGodBeast();//鑾峰彇绁炲吔寮哄寲瑁呭淇℃伅
-            if (GodBeastList.Count > 0)
+
+            if (godBeastModel.ItemPlace != -1)
             {
-                CurrentlySelected = GodBeastList[0].LocationMarker;
-                m_ScrollerController.JumpIndex(0);
+                for (int i = 0; i < GodBeastList.Count; i++)
+                {
+                    if (GodBeastList[i].ItemPlace == godBeastModel.ItemPlace)
+                    {
+                        CurrentlySelected = GodBeastList[i].LocationMarker;
+                        int Index = 0;
+                        Index = GodBeastList.FindIndex((x) =>
+                        {
+                            return x.ItemPlace == godBeastModel.ItemPlace;
+                        });
+                        m_ScrollerController.JumpIndex(Index);
+                    }
+                }
+            }
+            else
+            {
+                if (GodBeastList.Count > 0)
+                {
+                    CurrentlySelected = GodBeastList[0].LocationMarker;
+                    m_ScrollerController.JumpIndex(0);
+                }
             }
             m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
-            OnCreateGridLineCell(m_ScrollerController);          
+            OnCreateGridLineCell(m_ScrollerController);
             m_GodBeastSlidingList.Init();
             m_GodBeastAttributes.Init();
             m_GodBeastAttributes.GetGodBeastLocationMarker(CurrentlySelected);
@@ -63,20 +86,32 @@
 
         protected override void OnAfterOpen()
         {
-            playerPack.RefreshItemCountAct += RefreshItemCountAct;
+            playerPack.RefreshItemCountAct += RefreshItemCountAct;
+            DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += MakeItemAnswerEvent;
         }
 
         protected override void OnPreClose()
         {
+            godBeastModel.ItemPlace = -1;
             playerPack.RefreshItemCountAct -= RefreshItemCountAct;
-            m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
+            m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
+            DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= MakeItemAnswerEvent;
+        }
+
+        private void MakeItemAnswerEvent(HA814_tagMCMakeItemAnswer obj)
+        {
+            if ((int)obj.MakeType == (int)MakeType.Def_mitDogzEquipPlus)
+            {
+
+            }
         }
 
         private void RefreshItemCountAct(PackType arg1, int arg2, int arg3)
         {
             if (arg1 == PackType.rptDogzEquip)
             {
-                OnCreateGridLineCell(m_ScrollerController);
+                //OnCreateGridLineCell(m_ScrollerController);
+                m_ScrollerController.m_Scorller.RefreshActiveCellViews();//鍒锋柊鍙
                 m_GodBeastSlidingList.Init();
                 m_GodBeastAttributes.Init();
                 m_GodBeastAttributes.GetGodBeastLocationMarker(CurrentlySelected);
@@ -96,7 +131,7 @@
             {
                 if (DogzEquipDict[key] == 1)
                 {
-                   
+
                     List<ItemModel> itemModel = dogz_model.GetDogzEquips(key);
                     for (int i = 0; i < itemModel.Count; i++)
                     {
@@ -106,6 +141,7 @@
                         godBeastClass.GodBeastQuality = itemModel[i].chinItemModel.ItemColor;
                         godBeastClass.GodBeastStar = itemModel[i].chinItemModel.StarLevel;
                         godBeastClass.EquipScore = itemModel[i].equipScore;
+                        godBeastClass.ItemPlace = itemModel[i].itemInfo.ItemPlace;
                         var IudetDogzEquipPlus = itemModel[i].GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);// 绁炲吔瑁呭寮哄寲淇℃伅鍒楄〃 [寮哄寲绛夌骇, 寮哄寲鐔熺粌搴
                         if (IudetDogzEquipPlus == null)
                         {
@@ -116,8 +152,8 @@
                         {
                             godBeastClass.GodBeastLv = IudetDogzEquipPlus[0];
                             godBeastClass.GodBeasProficiency = IudetDogzEquipPlus[1];
-                        }                                  
-                        godBeastClass.LocationMarker=itemModel[i].EquipPlace*100+key;
+                        }
+                        godBeastClass.LocationMarker = itemModel[i].EquipPlace * 100 + key;
                         GodBeastList.Add(godBeastClass);
                     }
                 }
@@ -177,7 +213,7 @@
             int locationMarker = cell.index;
             godBeastEntry.GetGodBeastLocationMarker(locationMarker, CurrentlySelected);
             godBeastEntry.GodBeastButton.RemoveAllListeners();
-            godBeastEntry.GodBeastButton.AddListener(()=> 
+            godBeastEntry.GodBeastButton.AddListener(() =>
             {
                 if (locationMarker != CurrentlySelected)
                 {
@@ -187,7 +223,7 @@
                     {
                         ChooseToModify(CurrentlySelected);
                     }
-                }             
+                }
             });
         }
     }
diff --git a/Utility/EnumHelper.cs b/Utility/EnumHelper.cs
index 5e4e87b..c0ff39d 100644
--- a/Utility/EnumHelper.cs
+++ b/Utility/EnumHelper.cs
@@ -787,6 +787,7 @@
     Def_mitRefine = 18,            // 鐐间腹
     Def_mitMWUpLevel = 19,         //娉曞疂杩涢樁
     Def_DanRecycle = 20, //涓硅嵂鍥炴敹
+    Def_mitDogzEquipPlus=21,// 绁炲吔瑁呭寮哄寲 
 }
 /// <summary>
 /// 閲戦挶绫诲瀷(铏氭嫙鐗╁搧)

--
Gitblit v1.8.0