From 7813b760419c2d5de3ee8a3b9fb9ff2c170c12e7 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期五, 31 八月 2018 17:29:18 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0419_tagPlayerReborn.cs                 |    6 +
 System/FairyAu/FairyGrabBossHintWin.cs                                                      |   55 ++++++++++++++++++
 Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA605_tagCMFamilyDonate.cs      |   16 +++++
 System/MainInterfacePanel/CombatModeWin.cs                                                  |   10 +++
 Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA605_tagCMFamilyDonate.cs.meta |   12 ++++
 System/MainInterfacePanel/MainInterfaceWin.cs                                               |   14 ++++
 System/FairyAu/FairyBossModel.cs                                                            |   20 ++++++
 System/FairyAu/FairyGrabBossModel.cs                                                        |    4 
 System/FairyAu/FairyBoss.cs                                                                 |   36 ++++++++++++
 System/GeneralConfig/GeneralConfig.cs                                                       |    4 
 10 files changed, 169 insertions(+), 8 deletions(-)

diff --git a/Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA605_tagCMFamilyDonate.cs b/Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA605_tagCMFamilyDonate.cs
new file mode 100644
index 0000000..fc37abf
--- /dev/null
+++ b/Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA605_tagCMFamilyDonate.cs
@@ -0,0 +1,16 @@
+using UnityEngine;
+using System.Collections;
+
+// A6 05  家族捐献兽粮 #tagCMFamilyDonate

+

+public class CA605_tagCMFamilyDonate : GameNetPackBasic {

+

+    public CA605_tagCMFamilyDonate () {

+        combineCmd = (ushort)0x03FE;

+        _cmd = (ushort)0xA605;

+    }

+

+    public override void WriteToBytes () {

+    }

+

+}

diff --git a/Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA605_tagCMFamilyDonate.cs.meta b/Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA605_tagCMFamilyDonate.cs.meta
new file mode 100644
index 0000000..256a404
--- /dev/null
+++ b/Core/NetworkPackage/ClientPack/ClientToMapServer/CA6_Family/CA605_tagCMFamilyDonate.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d4fd9bb9c199d164ea33281a7d748a8d
+timeCreated: 1535706665
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0419_tagPlayerReborn.cs b/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0419_tagPlayerReborn.cs
index 202dd3c..de1056c 100644
--- a/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0419_tagPlayerReborn.cs
+++ b/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0419_tagPlayerReborn.cs
@@ -59,7 +59,11 @@
                         case 0:
                             if (DungeonStage.CurrentMapType != MapType.OpenCountry)
                             {
-                                if (!GeneralConfig.Instance.RebornAutoFightMapID.Contains(PlayerDatas.Instance.baseData.MapID))
+                                if (GeneralConfig.Instance.RebornAutoFightMapID.Contains(PlayerDatas.Instance.baseData.MapID))
+                                {
+                                    _hero.Behaviour.StartHandupAI();
+                                }
+                                else
                                 {
                                     _hero.Behaviour.StopHandupAI();
                                     _hero.Behaviour.StopKillUntilDieAI();
diff --git a/System/FairyAu/FairyBoss.cs b/System/FairyAu/FairyBoss.cs
index 8f9b3ed..86445be 100644
--- a/System/FairyAu/FairyBoss.cs
+++ b/System/FairyAu/FairyBoss.cs
@@ -23,6 +23,8 @@
         [SerializeField] RawImage model;
         [SerializeField] GameObject enterText;
         [SerializeField] GameObject openText;
+        [SerializeField] ItemCell m_FairyFood;
+        [SerializeField] Button m_HandIn;
 
         FairyBossModel m_Model;
         FairyBossModel fairyBossModel {
@@ -30,6 +32,8 @@
                 return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<FairyBossModel>());
             }
         }
+
+        PlayerPackModel packModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
 
         FairyBossTime m_TimeStage;
         DateTime m_StartTime;
@@ -228,6 +232,33 @@
             }
         }
 
+        private void RefreshItemCountAct(PackType packType, int arg2, int id)
+        {
+            if (packType == PackType.rptItem && id == fairyBossModel.fairyBossFood)
+            {
+                DisplayFairyFood();
+            }
+        }
+
+        void DisplayFairyFood()
+        {
+            var singlepack = packModel.GetSinglePackModel(PackType.rptItem);
+            var count = 0;
+            if (singlepack != null)
+            {
+                count = singlepack.GetItemCountByID(fairyBossModel.fairyBossFood);
+            }
+            ItemCellModel itemCellModel = new ItemCellModel(fairyBossModel.fairyBossFood, true, (ulong)count);
+            m_FairyFood.Init(itemCellModel);
+            m_FairyFood.countText.color = UIHelper.GetUIColor(count > 0 ? TextColType.Green : TextColType.Red);
+            m_FairyFood.countText.gameObject.SetActive(true);
+        }
+
+        private void HandIn()
+        {
+            fairyBossModel.HandInFairyFood();
+        }
+
         protected override void BindController()
         {
 
@@ -239,6 +270,8 @@
             previewBtn.onClick.AddListener(OnPreviewAward);
             beginBtn.onClick.AddListener(OnBeginBtn);
             m_GetWayBtn.onClick.AddListener(OnFoodGetWay);
+            m_HandIn.onClick.AddListener(HandIn);
+            m_FairyFood.cellBtn.AddListener(OnFoodGetWay);
         }
 
         protected override void OnPreOpen()
@@ -246,9 +279,11 @@
             PlayerDatas.Instance.fairyData.OnRefreshFairyBoss += OnRefreshFairyBoss;
             PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += OnRefreshFairyBoss;
             TimeMgr.Instance.OnHourEvent += OnRefreshFairyBoss;
+            packModel.RefreshItemCountAct += RefreshItemCountAct;
             InitData();
             OnRefreshFairyBoss();
             OnShowFairyBossModel();
+            DisplayFairyFood();
         }
 
 
@@ -269,6 +304,7 @@
             PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= OnRefreshFairyBoss;
             PlayerDatas.Instance.fairyData.OnRefreshFairyBoss -= OnRefreshFairyBoss;
             TimeMgr.Instance.OnHourEvent -= OnRefreshFairyBoss;
+            packModel.RefreshItemCountAct -= RefreshItemCountAct;
         }
 
         float m_Time = 0;
diff --git a/System/FairyAu/FairyBossModel.cs b/System/FairyAu/FairyBossModel.cs
index 302f79e..80daa2b 100644
--- a/System/FairyAu/FairyBossModel.cs
+++ b/System/FairyAu/FairyBossModel.cs
@@ -21,6 +21,7 @@
         }
 
         DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
+        PlayerPackModel packModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
 
         public int MapId { get; private set; }
         public int OpenFairyBossNeed { get; private set; }
@@ -148,6 +149,25 @@
             fairyBossContinueTime = int.Parse(_stepTime.Split(',')[1]);
             fairyBossPrepareTime = int.Parse(_stepTime.Split(',')[0]);
         }
+
+        public void HandInFairyFood()
+        {
+            var singlepack = packModel.GetSinglePackModel(PackType.rptItem);
+            var count = 0;
+            if (singlepack != null)
+            {
+                count = singlepack.GetItemCountByID(fairyBossFood);
+            }
+            if (count > 0)
+            {
+                CA605_tagCMFamilyDonate pak = new CA605_tagCMFamilyDonate();
+                GameNetSystem.Instance.SendInfo(pak);
+            }
+            else
+            {
+                SysNotifyMgr.Instance.ShowTip("FairyFoodHandError");
+            }
+        }
     }
 }
 
diff --git a/System/FairyAu/FairyGrabBossHintWin.cs b/System/FairyAu/FairyGrabBossHintWin.cs
index 4c7e330..322aa8a 100644
--- a/System/FairyAu/FairyGrabBossHintWin.cs
+++ b/System/FairyAu/FairyGrabBossHintWin.cs
@@ -25,6 +25,9 @@
         float m_Timer = 0f;
         const float Interval = 10f;
 
+        float m_DieTimer = 0f;
+        const float DieCloseDuration = 15f;
+
         int bossId = 0;
         uint objId = 0;
 
@@ -44,6 +47,7 @@
         protected override void OnPreOpen()
         {
             m_Timer = 0f;
+            m_DieTimer = 0f;
             var list = GAMgr.Instance.GetTypeList(E_ActorClassType.NpcFightBoss);
             bossId = 0;
             if (list != null)
@@ -97,10 +101,26 @@
         protected override void LateUpdate()
         {
             base.LateUpdate();
+
+            if (CheckBossDie())
+            {
+                m_DieTimer += Time.deltaTime;
+                if (m_DieTimer >= DieCloseDuration)
+                {
+                    CloseImmediately();
+                    model.RecheckGrabBoss();
+                    return;
+                }
+            }
+
             m_Timer += Time.deltaTime;
             if (m_Timer >= Interval && bossId != 0)
             {
                 m_Timer = 0f;
+                if (CheckBossDie())
+                {
+                    return;
+                }
                 model.QueryGrabBossHurt(bossId, 0, objId);
             }
         }
@@ -144,6 +164,10 @@
                     }
                 }
             }
+            if (currentHp <= 0)
+            {
+                return;
+            }
             for (int i = index; i < m_RankBehaviours.Length; i++)
             {
                 m_RankBehaviours[i].Display(string.Empty, 0);
@@ -178,9 +202,40 @@
                 currentHp = hp;
                 totalHp = _totalHp;
                 DisplayProgress();
+                if (currentHp > 0)
+                {
+                    m_DieTimer = 0f;
+                }
             }
         }
 
+        bool CheckBossDie()
+        {
+            bool hasBoss = false;
+            var list = GAMgr.Instance.GetTypeList(E_ActorClassType.NpcFightBoss);
+            if (list != null)
+            {
+                for (int i = 0; i < list.Count; i++)
+                {
+                    GA_NpcFightBoss bossActor = list[i] as GA_NpcFightBoss;
+                    if (bossActor != null && model.bosses.Contains(bossActor.NpcConfig.NPCID))
+                    {
+                        hasBoss = true;
+                        break;
+                    }
+                }
+            }
+            if (!hasBoss)
+            {
+                currentHp = 0;
+            }
+            if (currentHp == 0 && !m_ContainerKilled.gameObject.activeSelf)
+            {
+                DisplayProgress();
+            }
+            return bossId == 0 || currentHp <= 0;
+        }
+
         private void SecondEvent()
         {
             DisplayTimer();
diff --git a/System/FairyAu/FairyGrabBossModel.cs b/System/FairyAu/FairyGrabBossModel.cs
index 3089bef..4ba5747 100644
--- a/System/FairyAu/FairyGrabBossModel.cs
+++ b/System/FairyAu/FairyGrabBossModel.cs
@@ -99,7 +99,7 @@
             FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
             GA_Hero.OnEnterOrExitArea += OnEnterOrExitArea;
             GAMgr.Instance.OnFightNpcRequest += OnFightNpcUpdate;
-            GAMgr.Instance.OnFightNpcRelease += OnFightNpcUpdate;
+            //GAMgr.Instance.OnFightNpcRelease += OnFightNpcUpdate;
             PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent;
         }
 
@@ -119,7 +119,7 @@
             DailyQuestActionTimer.Instance.RefreshDailyQuestState -= RefreshDailyQuestState;
             GA_Hero.OnEnterOrExitArea -= OnEnterOrExitArea;
             GAMgr.Instance.OnFightNpcRequest -= OnFightNpcUpdate;
-            GAMgr.Instance.OnFightNpcRelease -= OnFightNpcUpdate;
+            //GAMgr.Instance.OnFightNpcRelease -= OnFightNpcUpdate;
             PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent;
         }
 
diff --git a/System/GeneralConfig/GeneralConfig.cs b/System/GeneralConfig/GeneralConfig.cs
index fa51a80..8fad424 100644
--- a/System/GeneralConfig/GeneralConfig.cs
+++ b/System/GeneralConfig/GeneralConfig.cs
@@ -478,8 +478,8 @@
                 }
             }
 
-            func = Config.Instance.Get<FuncConfigConfig>("RebornAutoFightDungeon");
-            RebornAutoFightMapID = new List<int>(GetIntArray(func.Numerical1));
+            int[] mapIDs = GetIntArray("RebornAutoFightDungeon");
+            RebornAutoFightMapID = new List<int>(mapIDs);
         }
         catch (Exception ex)
         {
diff --git a/System/MainInterfacePanel/CombatModeWin.cs b/System/MainInterfacePanel/CombatModeWin.cs
index 54a6339..7304a97 100644
--- a/System/MainInterfacePanel/CombatModeWin.cs
+++ b/System/MainInterfacePanel/CombatModeWin.cs
@@ -50,7 +50,15 @@
         {
             int MapID = PlayerDatas.Instance.baseData.MapID;
             var config = Config.Instance.Get<MapConfig>(MapID);
-            AtkTypeList = pKModel.GetArea(config.AtkType).ToArray();
+            if (fairyGrabBossModel.grabBossHintOpen)//鍐嶅墠鍥涚珷鏂版墜鍦板浘涓斿湪娲诲姩鍖哄煙
+            {
+                AtkTypeList = new int[] { 0, 5 };
+            }
+            else
+            {
+                AtkTypeList = pKModel.GetArea(config.AtkType).ToArray();
+            }
+
             _PkType = Buffmodel.PkType;//鑾峰彇褰撳墠PK鐘舵��
             if (_PkType != 2)
             {
diff --git a/System/MainInterfacePanel/MainInterfaceWin.cs b/System/MainInterfacePanel/MainInterfaceWin.cs
index 772b49d..67b4980 100644
--- a/System/MainInterfacePanel/MainInterfaceWin.cs
+++ b/System/MainInterfacePanel/MainInterfaceWin.cs
@@ -1054,9 +1054,19 @@
             IsShowTaskPanel();
             int mapID = PlayerDatas.Instance.baseData.MapID;
             var config = Config.Instance.Get<MapConfig>(mapID);
-            if (!fairyGrabBossModel.grabBossHintOpen && Buffmodel.PkType != config.Camp)
+            if (fairyGrabBossModel.grabBossHintOpen)
             {
-                DTCA202_tagMCAttackMode.Send_SwitchAttackMode((E_AttackMode)config.Camp);
+                if (Buffmodel.PkType != config.Camp)
+                {
+                    DTCA202_tagMCAttackMode.Send_SwitchAttackMode((E_AttackMode)config.Camp);
+                }
+            }
+            else
+            {
+                if (Buffmodel.PkType != config.Camp)
+                {
+                    DTCA202_tagMCAttackMode.Send_SwitchAttackMode((E_AttackMode)config.Camp);
+                }
             }
         }
     }

--
Gitblit v1.8.0