hch
2025-07-15 1597500ffb8817259fa1c508fc2aeff79bb80770
Main/System/KnapSack/PackManager.cs
@@ -12,10 +12,7 @@
    public static string StrengthAttrShift_RecordKey = "";
    public const string RecordKnapsackTitle = "RecordKnapsackTitle";
    Dictionary<int, int> DrugToDungeonDict { get; set; }   //key 丹药ID,value副本ID
    Dictionary<int, int[]> DungeonToDrugDict { get; set; }  //key 副本ID,value丹药ID列表
    //public List<AttrFruitConfig> makeDruglist { get; private set; }
    Dictionary<int, Dictionary<int, int>> decomposeAttrDict = new Dictionary<int, Dictionary<int, int>>();
    string RoleEquipLocalSave = "";
    List<int> LocalSavePlaceArray { get; set; }
    Dictionary<int, List<int>> sharedUseCountItemDict { get; set; }
@@ -164,6 +161,8 @@
    }
    public event Action<PackType> refrechPackEvent; //刷新整个背包数据
    public event Action<PackType, string> CreateItemEvent; //得到新物品,可能批量创建注意效率
    public event Action<PackType, string> DeleteItemEvent; //删除物品,可能批量删除注意效率
    public event Action<PackType, int, int> refreshItemCountEvent; // 慎用会卡(单个)最新物品数量刷新(旧的弃用)在得到新物品、物品数量的改变,清理该物品时均会触发 int 位置索引 int物品id
    public event Action<PackType> gridRefreshEvent; //背包空格刷新
    public event Action<PackType, int, int> itemCntAddEvent; //物品数量增加 int 位置索引 int物品id
@@ -336,10 +335,21 @@
        PackType type = (PackType)clearPack.PackIndex;
        SinglePack singlePack = null;
        playerPackDict.TryGetValue(type, out singlePack);
        List<string> guidList = new List<string>();
        if (singlePack != null)
        {
            singlePack.Clear();
            foreach (var item in singlePack.GetAllItems().Values)
            {
                guidList.Add(item.guid);
        }
            singlePack.Clear();
            foreach (var guid in guidList)
            {
                DeleteItemDictByGUID(type, guid);
            }
        }
    }
    public void RemoveItem(H0709_tagClearItem clearItem)
@@ -419,6 +429,10 @@
    {
        itemGUIDDict[itemModel.guid] = itemModel;
        GetItemEventCtrl(itemModel, showNewItem);
        if (showNewItem)
        {
            CreateItemEvent?.Invoke(itemModel.packType, itemModel.guid);
        }
    }
    void DeleteItemDictByGUID(PackType type, string guid)
@@ -428,6 +442,7 @@
            if (itemGUIDDict[guid].packType == type)
            {
                itemGUIDDict.Remove(guid);
                DeleteItemEvent?.Invoke(type, guid);
            }
        }
    }