From 53e1d685ebda55e2f2fb48c2d130b75b830caf77 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 19 三月 2019 11:47:48 +0800
Subject: [PATCH] 3335 更新物品管理代码。

---
 System/Equip/EquipSet.cs                  |   57 -------------------
 System/Equip/EquipModel.cs                |   50 +---------------
 Lua/Gen/SnxxzUIEquipModelWrap.cs          |   11 ---
 System/KnapSack/Logic/ItemTipsModel.cs    |   10 +++
 Lua/Gen/SnxxzUIItemLogicUtilityWrap.cs    |    6 --
 System/Auction/AuctionShelfWin.cs         |    5 -
 System/KnapSack/Logic/ItemLogicUtility.cs |    9 --
 7 files changed, 17 insertions(+), 131 deletions(-)

diff --git a/Lua/Gen/SnxxzUIEquipModelWrap.cs b/Lua/Gen/SnxxzUIEquipModelWrap.cs
index 64f0b63..5ad737a 100644
--- a/Lua/Gen/SnxxzUIEquipModelWrap.cs
+++ b/Lua/Gen/SnxxzUIEquipModelWrap.cs
@@ -670,11 +670,6 @@
             
                 
                 {
-                    string _equipGuid = LuaAPI.lua_tostring(L, 2);
-                    
-                    gen_to_be_invoked.PutOn( _equipGuid );
-                    
-                    
                     
                     return 0;
                 }
@@ -698,12 +693,6 @@
             
                 
                 {
-                    int _level = LuaAPI.xlua_tointeger(L, 2);
-                    int _place = LuaAPI.xlua_tointeger(L, 3);
-                    
-                    gen_to_be_invoked.TakeOff( _level, _place );
-                    
-                    
                     
                     return 0;
                 }
diff --git a/Lua/Gen/SnxxzUIItemLogicUtilityWrap.cs b/Lua/Gen/SnxxzUIItemLogicUtilityWrap.cs
index 8af625e..9f4b8ac 100644
--- a/Lua/Gen/SnxxzUIItemLogicUtilityWrap.cs
+++ b/Lua/Gen/SnxxzUIItemLogicUtilityWrap.cs
@@ -508,12 +508,6 @@
                 }
                 if(gen_param_count == 2&& translator.Assignable<Snxxz.UI.ItemModel>(L, 2)) 
                 {
-                    Snxxz.UI.ItemModel _model = (Snxxz.UI.ItemModel)translator.GetObject(L, 2, typeof(Snxxz.UI.ItemModel));
-                    
-                        bool gen_ret = gen_to_be_invoked.IsEquip( _model );
-                        LuaAPI.lua_pushboolean(L, gen_ret);
-                    
-                    
                     
                     return 1;
                 }
diff --git a/System/Auction/AuctionShelfWin.cs b/System/Auction/AuctionShelfWin.cs
index ffa5582..4e489a4 100644
--- a/System/Auction/AuctionShelfWin.cs
+++ b/System/Auction/AuctionShelfWin.cs
@@ -53,10 +53,7 @@
         private void OnClickUseBtn()
         {
             CloseImmediately();
-            ItemOperateUtility.Instance.GotoUseItem(auctionHelpModel.ItemModel.itemInfo.index);
-            //itemTipsModel.SetItemTipsModel(PackType.Item, auctionHelpModel.ItemModel.guid, false, true);
-            //itemTipsModel.SetBagTipsBtn(itemTipsModel.curAttrData);
-            //itemTipsModel.ShowUICtrl();
+            ItemOperateUtility.Instance.UseItem(auctionHelpModel.ItemModel.guid);
         }
         private void OnClickAuction()
         {
diff --git a/System/Equip/EquipModel.cs b/System/Equip/EquipModel.cs
index 95fe569..1ebf4b0 100644
--- a/System/Equip/EquipModel.cs
+++ b/System/Equip/EquipModel.cs
@@ -376,40 +376,6 @@
             getWays.Clear();
         }
 
-        public void PutOn(string equipGuid)
-        {
-            var item = packModel.GetItemByGuid(equipGuid);
-            if (item == null)
-            {
-                return;
-            }
-
-            var level = item.config.LV;
-            if (!equipSets.ContainsKey(level))
-            {
-                return;
-            }
-
-            var set = equipSets[level];
-            if (!set.unLocked)
-            {
-                return;
-            }
-
-            set.PutOn(equipGuid);
-        }
-
-        public void TakeOff(int level, int place)
-        {
-            if (!equipSets.ContainsKey(level))
-            {
-                return;
-            }
-
-            var slot = equipSets[level];
-            slot.TakeOff(place);
-        }
-
         public int CompareToCurrent(string equipGuid)
         {
             var item = packModel.GetItemByGuid(equipGuid);
@@ -513,17 +479,12 @@
             switch (type)
             {
                 case PackType.Item:
-                    var config = ItemConfig.Get(itemId);
-                    var level = config.LV;
-                    if (equipSets.ContainsKey(level))
+                    if (ItemLogicUtility.Instance.IsEquip(itemId))
                     {
-                        var item = packModel.GetItemByIndex(PackType.Item, index);
-                        if (item != null)
-                        {
-                            equipSets[level].UpdateRedPoint(item.guid);
-                        }
-
-                        if (selectedLevel.value > 0)
+                        var config = ItemConfig.Get(itemId);
+                        var level = config.LV;
+                        UpdateRedpoint(level);
+                        if (selectedLevel.value > 0 && selectedLevel.value == level)
                         {
                             itemDirty = true;
                         }
@@ -556,7 +517,6 @@
             if (itemDirty)
             {
                 RefreshCandidateEquips(selectedLevel.value);
-                UpdateRedpoint(selectedLevel.value);
             }
 
             if (equipDirty)
diff --git a/System/Equip/EquipSet.cs b/System/Equip/EquipSet.cs
index ff5cb0b..69e444f 100644
--- a/System/Equip/EquipSet.cs
+++ b/System/Equip/EquipSet.cs
@@ -38,14 +38,6 @@
             }
         }
 
-        public void SelectPlace(int place)
-        {
-            foreach (var item in equipSlots.Values)
-            {
-                item.selected.value = item.equipPosition.y == place;
-            }
-        }
-
         public bool IsSlotUnLocked(int place)
         {
             if (!equipSlots.ContainsKey(place))
@@ -84,45 +76,6 @@
             }
 
             return equipSlots[place].equip.value;
-        }
-
-        public void PutOn(string equipGuid)
-        {
-            var equip = packModel.GetItemByGuid(equipGuid);
-            if (equip == null)
-            {
-                return;
-            }
-
-            var place = equip.config.EquipPlace;
-            if (!equipSlots.ContainsKey(place))
-            {
-                return;
-            }
-
-            var slot = equipSlots[place];
-            if (!slot.unLocked)
-            {
-                return;
-            }
-
-            if (!IsPlaceCompatible(place, equip.config.EquipPlace))
-            {
-                return;
-            }
-
-            slot.equip.value = equipGuid;
-        }
-
-        public void TakeOff(int place)
-        {
-            if (!equipSlots.ContainsKey(place))
-            {
-                return;
-            }
-
-            var slot = equipSlots[place];
-            slot.equip.value = null;
         }
 
         public EquipAppearance GetAppearance()
@@ -191,16 +144,6 @@
             }
 
             return item.score.CompareTo(currentEquip.score);
-        }
-
-        public void UpdateRedPoint(string equipGuid)
-        {
-
-        }
-
-        private bool IsPlaceCompatible(int slotPlace, int equipPlace)
-        {
-            return slotPlace == equipPlace;
         }
 
         public static Int2 ServerPlaceToClientPlace(int serverPlace)
diff --git a/System/KnapSack/Logic/ItemLogicUtility.cs b/System/KnapSack/Logic/ItemLogicUtility.cs
index a71c66c..d179394 100644
--- a/System/KnapSack/Logic/ItemLogicUtility.cs
+++ b/System/KnapSack/Logic/ItemLogicUtility.cs
@@ -905,8 +905,8 @@
 
         public int SetSellItemOrder(ItemModel startModel, ItemModel endModel)
         {
-            bool startIsEquip = IsEquip(startModel);
-            bool endIsEquip = IsEquip(endModel);
+            bool startIsEquip = IsEquip(startModel.itemId);
+            bool endIsEquip = IsEquip(endModel .itemId);
             if (startIsEquip.CompareTo(endIsEquip) != 0) return -startIsEquip.CompareTo(endIsEquip);
             int order1 = startModel.config.Type;
             int order2 = endModel.config.Type;
@@ -918,11 +918,6 @@
             int code2 = endModel.itemId;
             if (code1.CompareTo(code2) != 0) return -code1.CompareTo(code2);
             return 0;
-        }
-
-        public bool IsEquip(ItemModel model)
-        {
-            return model.config.EquipPlace != 0;
         }
 
         public void GetOneKeySellModel()
diff --git a/System/KnapSack/Logic/ItemTipsModel.cs b/System/KnapSack/Logic/ItemTipsModel.cs
index f1e63ab..0946c61 100644
--- a/System/KnapSack/Logic/ItemTipsModel.cs
+++ b/System/KnapSack/Logic/ItemTipsModel.cs
@@ -633,6 +633,15 @@
                     }
                 }
             }
+
+            if (!string.IsNullOrEmpty(attrData.guid))
+            {
+                var item = playerPack.GetItemByGuid(attrData.guid);
+                if (item.isAuction)
+                {
+                    attrData.SetTipsFuncBtn(ItemOperateType.putAway, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.PutAway(attrData.guid); });
+                }
+            }
         }
 
         /// <summary>
@@ -1773,7 +1782,6 @@
 
         public bool isHavePutLimit { get; private set; }
 
-        StrengthenModel strengthengmodel { get { return ModelCenter.Instance.GetModel<StrengthenModel>(); } }
         ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
         RuneModel runeModel { get { return ModelCenter.Instance.GetModel<RuneModel>(); } }
         GodBeastModel beastModel { get { return ModelCenter.Instance.GetModel<GodBeastModel>(); } }

--
Gitblit v1.8.0