yyl
2025-08-11 b2d7bb59dc37c7b350786b076ee2f344b7c8911f
Main/System/KnapSack/PackManager.cs
@@ -24,6 +24,7 @@
    public event Action<int> refreshItemDayUseCountEvent;  //刷新物品每日使用数量
    public event Action<int> refreshItemSumUseCountEvent;  //刷新物品总使用数量
    public event Action<PackType, string, bool> RefreshItemLockEvent; //物品锁定刷新 背包类型,guid,锁定状态
    public bool isPlayBetterEquipEffect { get; set; }  //整理背包时是否播放特效
@@ -57,7 +58,6 @@
    public override void Init()
    {
        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
        DTC0102_tagCDBPlayer.afterPlayerDataInitializeEvent += OnAfterPlayerDataInitialize;
        DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
        ParseConfig();
        //SysNotifyMgr.Instance.sysNotifyEvent += RefreshSysInfo;
@@ -89,7 +89,6 @@
    public override void Release()
    {
        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
        DTC0102_tagCDBPlayer.afterPlayerDataInitializeEvent -= OnAfterPlayerDataInitialize;
        DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
        FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
        // SysNotifyMgr.Instance.sysNotifyEvent -= RefreshSysInfo;
@@ -111,13 +110,11 @@
        itemDayUseCntDict.Clear();
        itemSumUseCntDict.Clear();
        itemGUIDDict.Clear();
        PackGirdServerBuyCountDict.Clear();
        isPlayBetterEquipEffect = false;
    }
    public void OnAfterPlayerDataInitialize()
    {
    }
    public void OnPlayerLoginOk()
    {
@@ -257,10 +254,22 @@
    }
    public void UpdateItemLockState(H0722_tagItemDeadLockRefresh netPack)
    {
        var singlePack = GetSinglePack((PackType)netPack.PackType);
        var item = singlePack.GetItemByIndex(netPack.ItemIndex);
        if (item == null)
        {
            return;
        }
        item.itemInfo.isLock = netPack.IsLock == 1;
        RefreshItemLockEvent?.Invoke((PackType)netPack.PackType, item.guid, item.itemInfo.isLock);
    }
    public void UpdateBuyPackGirdCount(HA207_tagSCPackBuyInfo netPack)
    {
        for (int i = 0; i < netPack.BuyInfoList.Length; i++)
        {
        {
            PackGirdServerBuyCountDict[netPack.BuyInfoList[i].PackType] = netPack.BuyInfoList[i].BuyCnt;
        }
    }
@@ -306,6 +315,8 @@
        UpdatePackRedpoint(type);
    }
    public void RefreshItemCount(H0707_tagItemCountRefresh refresh)
    {
@@ -765,14 +776,14 @@
    /// <summary>
    /// 得到ID相同的物品数量
    /// 得到ID相同的物品数量; 也可以获得部分货币和物品绑定的数量
    /// </summary>
    /// <param name="type"></param>
    /// <param name="id"></param>
    /// <returns></returns>
    public int GetItemCountByID(PackType type, int id, bool includeAuction = true)
    public ulong GetItemCountByID(PackType type, int id, bool includeAuction = true)
    {
        int count = 0;
        ulong count = 0;
        var singlePack = GetSinglePack(type);
        if (singlePack != null)
        {
@@ -913,22 +924,23 @@
    public void SetLookIndex(string guid, int singleRowCount = 5)
    {
        if (string.IsNullOrEmpty(guid) || guid == "")
        {
            lookLineIndex = -1;
            lookItemGUID = "";
        }
        else
        {
            int index = GetItemByGuid(guid).gridIndex;
            lookLineIndex = index / singleRowCount;
            lookItemGUID = guid;
        }
        return;
        // if (string.IsNullOrEmpty(guid) || guid == "")
        // {
        //     lookLineIndex = -1;
        //     lookItemGUID = "";
        // }
        // else
        // {
        //     int index = GetItemByGuid(guid).gridIndex;
        //     lookLineIndex = index / singleRowCount;
        //     lookItemGUID = guid;
        // }
        if (lookEquipEvent != null)
        {
            lookEquipEvent();
        }
        // if (lookEquipEvent != null)
        // {
        //     lookEquipEvent();
        // }
    }
    public event Action RefreshBagEvent;