From 022d5f4d5ce8a9d057eaf76d02ea9591b5cf9912 Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期二, 09 十月 2018 11:47:56 +0800
Subject: [PATCH] 1834 分解装备时获得物品,分解了错误的物品

---
 System/KnapSack/Logic/EquipDevourWin.cs     |    4 ++--
 System/KnapSack/Logic/PackModelInterface.cs |    3 ++-
 System/KnapSack/Logic/PlayerPackModels.cs   |    3 ++-
 System/SystemSetting/SettingEffectMgr.cs    |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
 4 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/System/KnapSack/Logic/EquipDevourWin.cs b/System/KnapSack/Logic/EquipDevourWin.cs
index dbc6b37..0be8c37 100644
--- a/System/KnapSack/Logic/EquipDevourWin.cs
+++ b/System/KnapSack/Logic/EquipDevourWin.cs
@@ -588,10 +588,10 @@
 
         public void SendEquipdevourQuest()
         {
-            if (!modelInterface.isPackResetOk) return;
+            if (!modelInterface.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return;
 
             playerPack.isAutoDecompose = false;
-
+            SettingEffectMgr.Instance.isStartDecompose = true;
             CA32C_tagCMEquipDecompose _petEat = new CA32C_tagCMEquipDecompose();
             byte[] _petIndex = new byte[realDevourlist.Count];
             for (int i = 0; i < realDevourlist.Count; i++)
diff --git a/System/KnapSack/Logic/PackModelInterface.cs b/System/KnapSack/Logic/PackModelInterface.cs
index e1b454a..aa04277 100644
--- a/System/KnapSack/Logic/PackModelInterface.cs
+++ b/System/KnapSack/Logic/PackModelInterface.cs
@@ -1213,8 +1213,9 @@
         /// <param name="_oneKeySelllist"></param>
         public void SendOneKeySellQuest(List<ItemModel> _oneKeySelllist)
         {
-            if (!isPackResetOk) return;
+            if (!isPackResetOk || SettingEffectMgr.Instance.isStartOneKeySell) return;
 
+            SettingEffectMgr.Instance.isStartOneKeySell = true;
             byte[] itemIndexs = new byte[_oneKeySelllist.Count];
             int i = 0;
             for (i = 0; i < _oneKeySelllist.Count; i++)
diff --git a/System/KnapSack/Logic/PlayerPackModels.cs b/System/KnapSack/Logic/PlayerPackModels.cs
index 8a42104..9abb6e0 100644
--- a/System/KnapSack/Logic/PlayerPackModels.cs
+++ b/System/KnapSack/Logic/PlayerPackModels.cs
@@ -1398,8 +1398,9 @@
         public void SendEquipdevourQuest()
         {
             List<ItemModel> itemModels = GetCanDevourModellist();
-            if (itemModels == null || itemModels.Count < minDecomposeNum || !modelInterface.isPackResetOk) return;
+            if (itemModels == null || itemModels.Count < minDecomposeNum || !modelInterface.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return;
 
+            SettingEffectMgr.Instance.isStartDecompose = true;
             isAutoDecompose = true;
             recordAutoDecomNum = itemModels.Count;
             CA32C_tagCMEquipDecompose _petEat = new CA32C_tagCMEquipDecompose();
diff --git a/System/SystemSetting/SettingEffectMgr.cs b/System/SystemSetting/SettingEffectMgr.cs
index acc5687..f420d9e 100644
--- a/System/SystemSetting/SettingEffectMgr.cs
+++ b/System/SystemSetting/SettingEffectMgr.cs
@@ -52,6 +52,8 @@
 
     private float delayTime = 2f;
     private bool isGetNewItem = false;
+    public bool isStartDecompose { get; set; }
+    public bool isStartOneKeySell { get; set; }
 
     private void Awake()
     {
@@ -68,15 +70,21 @@
         DeadModel.playerDieEvent += OnPlayerDie;
         m_storeModel.RefreshBuyResultEvent += RefreshBuySuccess;
         DeadModel.CloseRebornWinEvent += PlayerRebornSuccess;
+        playerPack.RefreshDecomAttrAct += DecomposeSuccess;
+        DTC0721_tagMakeItemAnswer.MakeItemAnswerEvent += OneKeySellSuccess;
     }
 
+  
     public void Begin()
     {
-
+        isStartDecompose = false;
+        isStartOneKeySell = false;
     }
 
     float secondTimer = 0;
     float halfSecondTimer = 0;
+    float autoSellCoolTimer = 0;
+    float autoDecomposeCoolTimer = 0;
     private void LateUpdate()
     {
         if (!(StageManager.Instance.CurrentStage is DungeonStage))
@@ -100,11 +108,32 @@
             }
         }
      
+        if(isStartDecompose)
+        {
+            autoDecomposeCoolTimer += Time.deltaTime;
+            if(autoDecomposeCoolTimer >= 5f)
+            {
+                autoDecomposeCoolTimer = 0;
+                isStartDecompose = false;
+            }
+        }
+
+        if (isStartOneKeySell)
+        {
+            autoSellCoolTimer += Time.deltaTime;
+            if (autoSellCoolTimer >= 5f)
+            {
+                autoSellCoolTimer = 0;
+                isStartOneKeySell = false;
+            }
+        }
+
         if (secondTimer >= 1f)
         {
             secondTimer = 0f;
             RefreshBagItem();
         }
+    
     }
 
     private void PlayerRebornSuccess()
@@ -112,6 +141,18 @@
         isPlayerDie = false;
     }
 
+    private void OneKeySellSuccess(H0721_tagMakeItemAnswer obj)
+    {
+        if (obj.MakeType != (byte)MakeType.Def_mitKeySell)
+            return;
+
+        isStartOneKeySell = false;
+    }
+
+    private void DecomposeSuccess()
+    {
+        isStartDecompose = false;
+    }
 
     public bool GetSettingEffect()
     {
@@ -158,7 +199,7 @@
     {
         if (playerPack.GetReaminGridCount(PackType.rptItem) < 5 && modelInterface.isPackResetOk)
         {
-            if (HangUpSetModel.Instance.GetBool(HangUpAutoBoolType.isAutoDevour))
+            if (HangUpSetModel.Instance.GetBool(HangUpAutoBoolType.isAutoDevour) && !isStartDecompose)
             {
                 if(playerPack.IsReachMinDecomposeNum())
                 {
@@ -167,7 +208,9 @@
                 }
             }
 
-            if (HangUpSetModel.Instance.GetBool(HangUpAutoBoolType.isAutoSell) && modelInterface.GetSellItemList().Count > 0)
+            if (HangUpSetModel.Instance.GetBool(HangUpAutoBoolType.isAutoSell) 
+                && !isStartOneKeySell
+                && modelInterface.GetSellItemList().Count > 0)
             {
                 modelInterface.SendOneKeySellQuest(modelInterface.GetSellItemList());
                 return;

--
Gitblit v1.8.0