hch
2025-07-23 2336d5e71a6ed9c00f9a86c29d7aa33b9a1e38d5
Main/System/KnapSack/PackManager.cs
@@ -161,7 +161,7 @@
    }
    public event Action<PackType> refrechPackEvent; //刷新整个背包数据
    public event Action<PackType, string> CreateItemEvent; //得到新物品,可能批量创建注意效率
    public event Action<PackType, string, bool> ChangeItemEvent; //物品刷新,可能批量创建注意效率; bool:true代表创建 false 刷新
    public event Action<PackType, string> DeleteItemEvent; //删除物品,可能批量删除注意效率
    public event Action<PackType, int, int> refreshItemCountEvent; // 慎用会卡(单个)最新物品数量刷新(旧的弃用)在得到新物品、物品数量的改变,清理该物品时均会触发 int 位置索引 int物品id
    public event Action<PackType> gridRefreshEvent; //背包空格刷新
@@ -429,10 +429,7 @@
    {
        itemGUIDDict[itemModel.guid] = itemModel;
        GetItemEventCtrl(itemModel, showNewItem);
        if (showNewItem)
        {
            CreateItemEvent?.Invoke(itemModel.packType, itemModel.guid);
        }
        ChangeItemEvent?.Invoke(itemModel.packType, itemModel.guid, showNewItem);
    }
    void DeleteItemDictByGUID(PackType type, string guid)
@@ -696,6 +693,20 @@
        return guid;
    }
    //通过index找GUID
    public string GetItemGUIDByIndex(PackType packType, int index)
    {
        string guid = string.Empty;
        if (playerPackDict.ContainsKey(packType))
        {
            var items = playerPackDict[packType].GetAllItems();
            guid = items[index].guid;
        }
        return guid;
    }
    /// <summary>
    /// 得到ID相同的物品数量
    /// </summary>