From e5530e1ca1f28ab70c783d2b3ec685bb6569504b Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期五, 21 十二月 2018 14:44:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into Cross_Server

---
 System/MainInterfacePanel/MainInterfaceWin.cs |   73 ++++++++++++++----------------------
 1 files changed, 28 insertions(+), 45 deletions(-)

diff --git a/System/MainInterfacePanel/MainInterfaceWin.cs b/System/MainInterfacePanel/MainInterfaceWin.cs
index c2cd1f4..4164d5c 100644
--- a/System/MainInterfacePanel/MainInterfaceWin.cs
+++ b/System/MainInterfacePanel/MainInterfaceWin.cs
@@ -77,9 +77,7 @@
         [SerializeField] Transform unctionForecastPosition1;
         [SerializeField] Transform unctionForecastPosition2;
 
-        [SerializeField] Button m_CollectBtn;
-        [SerializeField] Image m_CollectIcon;
-        [SerializeField] Text m_CollectBtnText;
+        [SerializeField] MainCollectBehaviour m_CollectBehaviour;
         [SerializeField] Button m_RedBag;//绾㈠寘鍏ュ彛鎸夐挳
         [SerializeField] UIEffect m_RedpackGetSfx;
         [SerializeField] Button m_SendRedbagBtn;
@@ -93,8 +91,6 @@
         [SerializeField] FairyLeagueRemindBehaviour m_FairyLeagueRemind;
 
         [SerializeField] Transform m_EffectTask;//浠诲姟瀹屾垚鐗规晥鎾斁浣嶇疆
-        private int m_CollectNPCID;
-        private uint m_CollectNPCSID;
         private bool TaskSwithBool = true;
 
         [SerializeField] Button _SwitchShowBtn;//鍒囨崲鎸夐挳
@@ -235,7 +231,6 @@
             GA_Hero.OnEnterOrExitArea += OnEnterOrExitArea;
             NewBieCenter.Instance.guideBeginEvent += OnGuideBegin;
             NewBieCenter.Instance.guideCompletedEvent += OnGuideCompleted;
-            m_CollectBtn.AddListener(OnCollectBtnClick);
             GA_NpcCollect.OnArrive += OnArriveCollectNPC;
             GA_NpcCollect.OnLeave += OnLeaveCollectNpc;
             PlayerRedPacketDatas.OnRedBagGetEvent += OnRedBagGet;
@@ -405,6 +400,7 @@
             m_TeamInvitationEntrance.UnInit();
             m_FairyCallBehaviour.UnInit();
             m_FairyLeagueRemind.UnInit();
+            m_CollectBehaviour.Dispose();
             horseRidBool = false;
             purchaseModel.UpdateNewMysticalEvent -= UpdateMysticalPurchaseImag;
             assistModel.UpdateRedpointEvent -= UpdateDungeonAssistImag;
@@ -428,12 +424,11 @@
             {
                 WindowCenter.Instance.CloseImmediately<FunctionForecastWin>();
             }
-            m_CollectBtn.RemoveAllListeners();
             GA_NpcCollect.OnArrive -= OnArriveCollectNPC;
             GA_NpcCollect.OnLeave -= OnLeaveCollectNpc;
             fairyGrabBossModel.bossGrabHintEvent -= bossGrabHintEvent;
             wishModel.UpdateWishAwardEvent -= UpdateWishAwardImag;
-            m_CollectBtn.gameObject.SetActive(false);
+            m_CollectBehaviour.gameObject.SetActive(false);
         }
 
         private void GuideBeginEvent()
@@ -518,22 +513,7 @@
             if ((_areaType == MapArea.E_Type.Neutral || _areaType == MapArea.E_Type.Boss) && _enter)
             {
                 WindowCenter.Instance.Open<NeutralMarkWin>();
-                int mapID = PlayerDatas.Instance.baseData.MapID;
-                var config = Config.Instance.Get<MapConfig>(mapID);
-                int[] atkInt = pKModel.GetArea(config.AtkType).ToArray();
-                if (onMainModel.ShieldedArea.Contains(PlayerDatas.Instance.baseData.MapID) || fairyGrabBossModel.grabBossHintOpen)
-                {
-                    //return;
-                }
-                else
-                {
-                    if (atkInt.Length > 1 && Buffmodel.PkType != 5)
-                    {
-                        onMainModel.AreaState = Buffmodel.PkType;
-                        DTCA202_tagMCAttackMode.Send_SwitchAttackMode((E_AttackMode)5);
-                    }
-                }
-                
+                AtkTypeChange();
             }
 
             if (_areaType == MapArea.E_Type.Neutral && !_enter)
@@ -588,6 +568,25 @@
             }
         }
 
+        private void AtkTypeChange()//楠戝疇浜夊ず鏄惁鍒囨崲鐘舵��
+        {
+            int mapID = PlayerDatas.Instance.baseData.MapID;
+            var config = Config.Instance.Get<MapConfig>(mapID);
+            int[] atkInt = pKModel.GetArea(config.AtkType).ToArray();
+            if (onMainModel.ShieldedArea.Contains(PlayerDatas.Instance.baseData.MapID))
+            {
+  
+            }
+            else
+            {
+                if (fairyGrabBossModel.grabBossHintOpen && atkInt.Length > 1 && Buffmodel.PkType != 5)
+                {
+                    onMainModel.AreaState = Buffmodel.PkType;
+                    DTCA202_tagMCAttackMode.Send_SwitchAttackMode((E_AttackMode)5);
+                }
+            }
+
+        }
         private void OnMaininterCDTime()
         {
             MarkRayButton();
@@ -998,33 +997,16 @@
             }
         }
 
-        void OnCollectBtnClick()
-        {
-            if (m_CollectNPCID != 0 && m_CollectNPCSID != 0)
-            {
-                NPCInteractProcessor.InvokeEvent(E_NpcType.Collect, m_CollectNPCID, m_CollectNPCSID);
-            }
-        }
-
         void OnArriveCollectNPC(uint sid, int npcID)
         {
-            m_CollectNPCID = npcID;
-            m_CollectNPCSID = sid;
-            m_CollectBtn.gameObject.SetActive(true);
-            var mapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID);
-            m_CollectIcon.SetSprite(mapId == 31230 ? "TY_UI_8" : "TY_UI_6");
-            m_CollectIcon.SetNativeSize();
-            m_CollectBtnText.text = mapId == 31230 ? Language.Get("Collect_FairyFeast") : Language.Get("Collect_Normal");
+            m_CollectBehaviour.gameObject.SetActive(true);
+            m_CollectBehaviour.Display(npcID, sid);
         }
 
         void OnLeaveCollectNpc(uint sid, int npcID)
         {
-            if (m_CollectNPCID == npcID && m_CollectNPCSID == sid)
-            {
-                m_CollectNPCID = 0;
-                m_CollectNPCSID = 0;
-            }
-            m_CollectBtn.gameObject.SetActive(false);
+            m_CollectBehaviour.Dispose();
+            m_CollectBehaviour.gameObject.SetActive(false);
         }
 
         #endregion
@@ -1174,6 +1156,7 @@
         {
             IsShowTaskPanel();
             ShowFairyGrabBoss();
+            AtkTypeChange();
         }
 
         private void ShowFairyGrabBoss()

--
Gitblit v1.8.0