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/GodBeastReinforcementWin.cs |   90 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 75 insertions(+), 15 deletions(-)

diff --git a/System/Strengthening/GodBeastReinforcementWin.cs b/System/Strengthening/GodBeastReinforcementWin.cs
index 1d4769e..8b00ff1 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
     {
@@ -28,13 +29,17 @@
         [SerializeField] GodBeastSlidingList m_GodBeastSlidingList;
         [SerializeField] GameObject m_Listprompt_Text;
         [SerializeField] GodBeastAttributes m_GodBeastAttributes;
+        [SerializeField] UIEffect m_UIEffect;
         DogzModel Dogz_model;
         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;
+        private int JumpIndex = 0;
         #region Built-in
         protected override void BindController()
         {
@@ -49,34 +54,73 @@
         {
             CurrentlySelected = 0;
             GetGodBeast();//鑾峰彇绁炲吔寮哄寲瑁呭淇℃伅
-            if (GodBeastList.Count > 0)
-            {
-                CurrentlySelected = GodBeastList[0].LocationMarker;
-                m_ScrollerController.JumpIndex(0);
-            }
             m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
-            OnCreateGridLineCell(m_ScrollerController);          
+            if (godBeastModel.ItemPlace != -1)
+            {
+                for (int i = 0; i < GodBeastList.Count; i++)
+                {
+                    if (GodBeastList[i].ItemPlace == godBeastModel.ItemPlace)
+                    {
+                        CurrentlySelected = GodBeastList[i].LocationMarker;
+                        GetDogZBagIndex();
+                        int Index = 0;
+                        Index = GodBeastList.FindIndex((x) =>
+                        {
+                            return x.ItemPlace == godBeastModel.ItemPlace;
+                        });
+                        JumpIndex = Index;
+                    }
+                }
+            }
+            else
+            {
+                if (GodBeastList.Count > 0)
+                {
+                    CurrentlySelected = GodBeastList[0].LocationMarker;
+                    GetDogZBagIndex();
+                    JumpIndex = 0;                 
+                }
+            }
+            OnCreateGridLineCell(m_ScrollerController);
             m_GodBeastSlidingList.Init();
             m_GodBeastAttributes.Init();
-            m_GodBeastAttributes.GetGodBeastLocationMarker(CurrentlySelected);
+            m_GodBeastAttributes.GetGodBeastLocationMarker(CurrentlySelected);
+            m_ScrollerController.JumpIndex(JumpIndex);
+
+
+
         }
 
         protected override void OnAfterOpen()
         {
-            playerPack.RefreshItemCountAct += RefreshItemCountAct;
+            playerPack.RefreshItemCountAct += RefreshItemCountAct;
+            DTC0721_tagMakeItemAnswer.MakeItemAnswerEvent += MakeItemAnswerEvent;
         }
 
         protected override void OnPreClose()
         {
+            JumpIndex = 0;
+            godBeastModel.ItemPlace = -1;
+           // godBeastModel.Absorption_Dic.Clear();
             playerPack.RefreshItemCountAct -= RefreshItemCountAct;
-            m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
+            m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
+            DTC0721_tagMakeItemAnswer.MakeItemAnswerEvent -= MakeItemAnswerEvent;
+        }
+
+        private void MakeItemAnswerEvent(H0721_tagMakeItemAnswer obj)
+        {
+            if ((int)obj.MakeType == (int)MakeType.Def_mitDogzEquipPlus)
+            {
+                m_UIEffect.Play();
+            }
         }
 
         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 +140,7 @@
             {
                 if (DogzEquipDict[key] == 1)
                 {
-                   
+
                     List<ItemModel> itemModel = dogz_model.GetDogzEquips(key);
                     for (int i = 0; i < itemModel.Count; i++)
                     {
@@ -106,6 +150,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 +161,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,19 +222,34 @@
             int locationMarker = cell.index;
             godBeastEntry.GetGodBeastLocationMarker(locationMarker, CurrentlySelected);
             godBeastEntry.GodBeastButton.RemoveAllListeners();
-            godBeastEntry.GodBeastButton.AddListener(()=> 
+            godBeastEntry.GodBeastButton.AddListener(() =>
             {
                 if (locationMarker != CurrentlySelected)
                 {
                     CurrentlySelected = locationMarker;
+                    GetDogZBagIndex();
                     m_ScrollerController.m_Scorller.RefreshActiveCellViews();//鍒锋柊鍙
                     if (ChooseToModify != null)
                     {
                         ChooseToModify(CurrentlySelected);
                     }
-                }             
+                }
             });
         }
+
+        private void GetDogZBagIndex()//鑾峰彇閫夋嫨鐨勭鍏借澶囩殑瑁呭涓嬫爣
+        {
+            for (int i = 0; i < GodBeastList.Count; i++)
+            {
+                if (CurrentlySelected == GodBeastList[i].LocationMarker)
+                {
+                    godBeastModel.DogZBagIndex = GodBeastList[i].ItemPlace;
+                   // DebugEx.LogError(godBeastModel.DogZBagIndex);
+                    return;
+                }
+            }
+
+        }
     }
 
 }

--
Gitblit v1.8.0