From 39001a600fcae2bcf27c225df8752d75fb92fef4 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 31 十月 2025 11:18:26 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/System/KnapSack/PackManager.cs |  631 ++++++++++++++++++++++++++++++++------------------------
 1 files changed, 358 insertions(+), 273 deletions(-)

diff --git a/Main/System/KnapSack/PackManager.cs b/Main/System/KnapSack/PackManager.cs
index 3aff3c2..afefa1c 100644
--- a/Main/System/KnapSack/PackManager.cs
+++ b/Main/System/KnapSack/PackManager.cs
@@ -3,12 +3,45 @@
 using System.Linq;
 using UnityEngine;
 using LitJson;
-using System.Text.RegularExpressions;
 using System.Collections;
+using System.IO;
 
 public class PackManager : GameSystemManager<PackManager>
-//public class PackModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk
 {
+    public event Action<PackType> refrechPackEvent; //鍒锋柊鏁翠釜鑳屽寘鏁版嵁
+
+    //鐗╁搧锛堝垱寤猴級鍒锋柊锛屽彲鑳芥壒閲忓垱寤烘敞鎰忔晥鐜�; bool锛歵rue浠h〃鍒涘缓 false 鍒锋柊; 娉ㄦ剰0707鐗╁搧鏁伴噺鍒锋柊涓嶅寘鍚湪姝や簨浠�
+    public event Action<PackType, string, bool> ChangeItemEvent; // 鑳屽寘绫诲瀷锛孏UID锛屾槸鍚﹀垱寤�
+
+    //鍒犻櫎鐗╁搧锛屽彲鑳芥壒閲忓垹闄ゆ敞鎰忔晥鐜�
+    public event Action<PackType, string, int, int, int> DeleteItemEvent; // 鑳屽寘绫诲瀷锛孏UID, 鐗╁搧ID锛岀储寮�, 鍒犻櫎鍘熷洜
+
+    // 鍗曠墿鍝佸埛鏂� 鍦ㄥ緱鍒版柊鐗╁搧銆佺墿鍝佹暟閲忕殑鏀瑰彉锛屾竻鐞嗚鐗╁搧鏃跺潎浼氳Е鍙� ; 浣�0725鏁翠釜鑳屽寘鍒锋柊涓嶈Е鍙戯紝濡傛灉鏈夐渶瑕佸崟鐙暟閲忓埛鏂颁簨浠跺彟澶栧鐞�
+    // 瑙﹀彂姣旇緝棰戠箒锛岀晫闈娇鐢ㄦ椂鍙互鍋氫釜姹囨�诲悗寤惰繜鍒锋柊
+    public event Action<PackType, int, int> RefreshItemEvent; //鑳屽寘绫诲瀷锛屼綅缃储寮曪紝鐗╁搧id
+    public event Action<PackType> gridRefreshEvent; //鑳屽寘鍙敤鏍煎瓙鏁板埛鏂�
+    public event Action<int, int> useItemSuccessEvent; //鐗╁搧浣跨敤鎴愬姛 int 浣嶇疆绱㈠紩 int鐗╁搧id
+
+    public event Action<int> refreshItemDayUseCountEvent;  //鍒锋柊鐗╁搧姣忔棩浣跨敤鏁伴噺
+    public event Action<int> refreshItemSumUseCountEvent;  //鍒锋柊鐗╁搧鎬讳娇鐢ㄦ暟閲�
+    public event Action<PackType, string, bool> RefreshItemLockEvent; //鐗╁搧閿佸畾鍒锋柊 鑳屽寘绫诲瀷锛実uid锛岄攣瀹氱姸鎬�
+
+    
+    private Dictionary<PackType, SinglePack> playerPackDict = new Dictionary<PackType, SinglePack>();
+    private Dictionary<string, ItemModel> itemGUIDDict = new Dictionary<string, ItemModel>();
+
+    private Dictionary<int, int> PackGirdServerBuyCountDict = new Dictionary<int, int>(); //鑳屽寘绫诲瀷锛氳喘涔版牸瀛愮殑娆℃暟
+
+    //璇昏〃鏁版嵁
+    public Dictionary<int, int> PackMaxCountDict = new Dictionary<int, int>(); //鑳屽寘绫诲瀷锛氳儗鍖呮牸瀛愭渶澶ф暟閲�
+    public int initBagGridCount { get; private set; } //鍒濆鐗╁搧鑳屽寘鏍煎瓙鏁�
+    public int[] itemPackSortTyps { get; private set; }    //鑳屽寘鐗╁搧鐨勬寜绫诲瀷鎺掑簭
+    public List<string> composeItemGuidList = new List<string>();  //鍚堟垚鍒楄〃鐗╁搧guid
+
+    //寮�鏍煎瓙
+    public Dictionary<int, int> openGirdMoneyDict = new Dictionary<int, int>(); //鑳屽寘绫诲瀷锛氭秷鑰楄揣甯佺被鍨�
+    public Dictionary<int, int[]> openGirdMoneyValueDict = new Dictionary<int, int[]>(); //鑳屽寘绫诲瀷锛氭秷鑰楄揣甯佸��(鎸夋鏁板畾浠�)
+    public Dictionary<int, int[]> openGirdCountDict = new Dictionary<int, int[]>(); //鑳屽寘绫诲瀷锛氭瘡娆″紑鐨勬牸瀛愭暟閲�
     public static string StrengthAttrShift_RecordKey = "";
     public const string RecordKnapsackTitle = "RecordKnapsackTitle";
 
@@ -16,18 +49,14 @@
     string RoleEquipLocalSave = "";
     List<int> LocalSavePlaceArray { get; set; }
     Dictionary<int, List<int>> sharedUseCountItemDict { get; set; }
-    bool isUpdatePlayerLv = false;
+    // bool isUpdatePlayerLv = false;
+    bool isItemChange = false;  //寤惰繜澶勭悊鐗╁搧鍙樺寲
 
-    //AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } }
-    //ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
-
-    List<string> commonShowAwardEvents = new List<string>();
-
+    public int[] gameCashShow;  //浠i噾鍒哥壒娈婃樉绀� 闄や互100
     public int[] autoUseItemIDs;
     public override void Init()
     {
         DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
-        DTC0102_tagCDBPlayer.afterPlayerDataInitializeEvent += OnAfterPlayerDataInitialize;
         DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
         ParseConfig();
         //SysNotifyMgr.Instance.sysNotifyEvent += RefreshSysInfo;
@@ -51,38 +80,20 @@
         //     }
         // }
 
-        ParseItemCount();
 
-        autoUseItemIDs = JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("ItemTipsNum").Numerical2);
+        
     }
 
 
     public override void Release()
     {
         DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
-        DTC0102_tagCDBPlayer.afterPlayerDataInitializeEvent -= OnAfterPlayerDataInitialize;
         DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
         FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
         // SysNotifyMgr.Instance.sysNotifyEvent -= RefreshSysInfo;
     }
 
-    public Dictionary<int, string> textCountShow = new Dictionary<int, string>();
-    public int[] textCountShow2;
-    public List<int> gameCashShow = new List<int>();
-
-    public void ParseItemCount()
-    {
-        var textConfig = FuncConfigConfig.Get("ItemCountShow");
-        var json = JsonMapper.ToObject(textConfig.Numerical1);
-        foreach (var key in json.Keys)
-        {
-            var itemID = int.Parse(key);
-            textCountShow[itemID] = json[key].ToString();
-        }
-
-        textCountShow2 = JsonMapper.ToObject<int[]>(textConfig.Numerical2);
-        gameCashShow = JsonMapper.ToObject<List<int>>(textConfig.Numerical3);
-    }
+    
 
 
     private void OnFuncStateChangeEvent(int id)
@@ -92,19 +103,16 @@
     public void OnBeforePlayerDataInitialize()
     {
         GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
-        PlayerDatas.Instance.playerDataRefreshEvent -= UpdatePlayerLv;
+        // PlayerDatas.Instance.playerDataRefreshEvent -= UpdatePlayerLv;
         LocalSave.DeleteKey(RecordKnapsackTitle);
         playerPackDict.Clear();
         itemDayUseCntDict.Clear();
         itemSumUseCntDict.Clear();
         itemGUIDDict.Clear();
-        isPlayBetterEquipEffect = false;
+        PackGirdServerBuyCountDict.Clear();
     }
 
-    public void OnAfterPlayerDataInitialize()
-    {
 
-    }
 
     public void OnPlayerLoginOk()
     {
@@ -120,8 +128,8 @@
             LocalSavePlaceArray = null;
         }
         GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
-        PlayerDatas.Instance.playerDataRefreshEvent += UpdatePlayerLv;
-        isUpdatePlayerLv = true;
+        // PlayerDatas.Instance.playerDataRefreshEvent += UpdatePlayerLv;
+        // isUpdatePlayerLv = true;
         FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
     }
 
@@ -160,28 +168,7 @@
         // }
     }
 
-    public event Action<PackType> refrechPackEvent; //鍒锋柊鏁翠釜鑳屽寘鏁版嵁
-
-    //鐗╁搧锛堝垱寤猴級鍒锋柊锛屽彲鑳芥壒閲忓垱寤烘敞鎰忔晥鐜�; bool锛歵rue浠h〃鍒涘缓 false 鍒锋柊; 娉ㄦ剰0707鐗╁搧鏁伴噺鍒锋柊涓嶅寘鍚湪姝や簨浠�
-    public event Action<PackType, string, bool> ChangeItemEvent; // 鑳屽寘绫诲瀷锛孏UID锛屾槸鍚﹀垱寤�
-
-    //鍒犻櫎鐗╁搧锛屽彲鑳芥壒閲忓垹闄ゆ敞鎰忔晥鐜�
-    public event Action<PackType, string> DeleteItemEvent; // 鑳屽寘绫诲瀷锛孏UID
-
-    // 鍗曠墿鍝佸埛鏂� 鍦ㄥ緱鍒版柊鐗╁搧銆佺墿鍝佹暟閲忕殑鏀瑰彉锛屾竻鐞嗚鐗╁搧鏃跺潎浼氳Е鍙� ; 浣�0725鏁翠釜鑳屽寘鍒锋柊涓嶈Е鍙戯紝濡傛灉鏈夐渶瑕佸崟鐙暟閲忓埛鏂颁簨浠跺彟澶栧鐞�
-    // 瑙﹀彂姣旇緝棰戠箒锛岀晫闈娇鐢ㄦ椂鍙互鍋氫釜姹囨�诲悗寤惰繜鍒锋柊
-    public event Action<PackType, int, int> RefreshItemEvent; //鑳屽寘绫诲瀷锛屼綅缃储寮曪紝鐗╁搧id
-    public event Action<PackType> gridRefreshEvent; //鑳屽寘鍙敤鏍煎瓙鏁板埛鏂�
-    public event Action<int, int> useItemSuccessEvent; //鐗╁搧浣跨敤鎴愬姛 int 浣嶇疆绱㈠紩 int鐗╁搧id
-
-    public event Action<int> refreshItemDayUseCountEvent;  //鍒锋柊鐗╁搧姣忔棩浣跨敤鏁伴噺
-    public event Action<int> refreshItemSumUseCountEvent;  //鍒锋柊鐗╁搧鎬讳娇鐢ㄦ暟閲�
-
-    public bool isPlayBetterEquipEffect { get; set; }  //鏁寸悊鑳屽寘鏃舵槸鍚︽挱鏀剧壒鏁�
-
-    #region 鎺ユ敹鏈嶅姟绔暟鎹�
-    private Dictionary<PackType, SinglePack> playerPackDict = new Dictionary<PackType, SinglePack>();
-    private Dictionary<string, ItemModel> itemGUIDDict = new Dictionary<string, ItemModel>();
+    
 
     public void UpdatePack(H0725_tagRolePackRefreshEx packInfo)
     {
@@ -192,10 +179,6 @@
             playerPackDict.Add(packType, new SinglePack(packType));
         }
 
-        if (isPlayBetterEquipEffect)
-        {
-            ItemLogicUtility.Instance.ClearSortedBetterEquip();
-        }
 
         for (int i = 0; i < packInfo.ItemCount; i++)
         {
@@ -203,23 +186,19 @@
             var item = playerPackDict[packType].UpdateItem(itemInfo);
             AddItemGUIDDict(item, true);
 
-            if (isPlayBetterEquipEffect)
-            {
-                ItemLogicUtility.Instance.SetBagSortBetterEquipList(GetItemByGuid(itemInfo.guid));
-            }
+
         }
 
         if (refrechPackEvent != null)
         {
             refrechPackEvent(packType);
         }
-
-        UpdatePackRedpoint(packType);
+        
+        DelayNotifyPackChange(packType);
     }
 
     public void UpdateItem(H0704_tagRolePackRefresh serverItem)
     {
-        isPlayBetterEquipEffect = false;
         SetLookIndex(null);
         PackType type = (PackType)serverItem.PackType;
         if (!playerPackDict.ContainsKey(type))
@@ -258,14 +237,56 @@
         //         ItemOperateUtility.Instance.ShowPutOnNewEquipRemind(itemInfo.itemId);
         //     }
         // }
-
-        UpdatePackRedpoint(type);
+        
+        DelayNotifyPackChange(type);
         //EquipDecomRedCtrl();
         AutoUseItem(itemInfo.itemId, serverItem.ItemGUID);
     }
 
 
+    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;
+        }
+    }
+
+    //璐拱鎵�闇�淇℃伅 [璐у竵绫诲瀷锛岃揣甯佹暟閲忥紝璐拱鏍兼暟]
+    public int[] BuyPackGirdNeedData(PackType packType)
+    {
+        var curPackGirdCnt = GetSinglePack(packType).unlockedGridCount;
+        if (curPackGirdCnt >= PackMaxCountDict[(int)packType])
+            return null;
+
+        int buyTimes = 0;
+        PackGirdServerBuyCountDict.TryGetValue((int)packType, out buyTimes);
+        var moneyType = openGirdMoneyDict[(int)packType];
+        var moneyCntList = openGirdMoneyValueDict[(int)packType];
+        var money = moneyCntList[Math.Min(buyTimes, moneyCntList.Length - 1)];
+        var girdCntList = openGirdCountDict[(int)packType];
+        var buyGirdCnt = girdCntList[Math.Min(buyTimes, girdCntList.Length - 1)];
+        return new[] {moneyType, money, buyGirdCnt};
+    }
+
+    public void BuyPackGird(PackType packType)
+    {
+        var netPack = new C0741_tagCOpenPackCount();
+        netPack.PackType = (byte)packType;
+        GameNetSystem.Instance.SendInfo(netPack);
+    }
 
     public void UpdateUnlockedGridCount(H0724_tagRolePackCanUseCount useCount)
     {
@@ -282,13 +303,15 @@
             gridRefreshEvent(type);
         }
 
-        UpdatePackRedpoint(type);
+        
+        DelayNotifyPackChange(type);
     }
+
+    
 
     public void RefreshItemCount(H0707_tagItemCountRefresh refresh)
     {
         SetLookIndex(null);
-        isPlayBetterEquipEffect = false;
         PackType type = (PackType)refresh.PackType;
         SinglePack singlePack = null;
         playerPackDict.TryGetValue(type, out singlePack);
@@ -308,6 +331,7 @@
 
             }
         }
+        DelayNotifyPackChange(type);
 
     }
 
@@ -329,11 +353,11 @@
                 DeleteItemDictByGUID(type, guid);
             }
         }
+        refrechPackEvent?.Invoke(type);
     }
 
     public void RemoveItem(H0709_tagClearItem clearItem)
     {
-        isPlayBetterEquipEffect = false;
         SetLookIndex(null);
         PackType type = (PackType)clearItem.PackType;
 
@@ -351,9 +375,9 @@
             guid = itemModel.guid;
             int itemId = itemModel.itemId;
 
-            DeleteItemDictByGUID(type, itemModel.guid);
-
             singlePack.RemoveItem(clearItem.ItemIndex);
+            DeleteItemDictByGUID(type, itemModel.guid,itemId, clearItem.ItemIndex, clearItem.ClearType);
+
             if (RefreshItemEvent != null)
             {
                 RefreshItemEvent(type, clearItem.ItemIndex, itemId);
@@ -361,7 +385,7 @@
 
         }
 
-        UpdatePackRedpoint(type);
+        DelayNotifyPackChange(type);
 
         if (GetItemByGuid(guid) == null)
         {
@@ -377,7 +401,6 @@
 
     public void UseItemSuccess(H0706_tagUseItemSuccess success)
     {
-        isPlayBetterEquipEffect = false;
         SetLookIndex(null);
         if (success.PlayerID != PlayerDatas.Instance.baseData.PlayerID)
         {
@@ -407,15 +430,16 @@
         ChangeItemEvent?.Invoke(itemModel.packType, itemModel.guid, showNewItem);
     }
 
-    void DeleteItemDictByGUID(PackType type, string guid)
+    void DeleteItemDictByGUID(PackType type, string guid, int itemID = 0, int index = 0, int clearType = -1)
     {
         if (itemGUIDDict.ContainsKey(guid))
         {
             if (itemGUIDDict[guid].packType == type)
             {
                 itemGUIDDict.Remove(guid);
-                DeleteItemEvent?.Invoke(type, guid);
             }
+            //鍙槸鑳屽寘杞Щ锛屼笉鍒犻櫎浣嗕篃瑕侀�氱煡
+            DeleteItemEvent?.Invoke(type, guid, itemID, index, clearType);
         }
     }
 
@@ -469,34 +493,91 @@
     //     }
     // }
 
-    #endregion
 
     #region 鐜╁瑁呭鐗规畩閫昏緫
     void ParseConfig()
     {
-        
 
-        var config = FuncConfigConfig.Get("CommonShowAwards");
-        commonShowAwardEvents = JsonMapper.ToObject<List<string>>(config.Numerical1);
+        ParsePackConfigIni();
+        autoUseItemIDs = JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("AutoUseItem").Numerical1);
+        var config= FuncConfigConfig.Get("InitBagCellCount");
+        initBagGridCount = int.Parse(config.Numerical1);
 
+        config = FuncConfigConfig.Get("PackageSortPriority");
+        itemPackSortTyps = ConfigParse.GetMultipleStr<int>(config.Numerical1);
+
+        config = FuncConfigConfig.Get("OpenPack");
+        openGirdMoneyDict = ConfigParse.ParseIntDict(config.Numerical1);
+        openGirdMoneyValueDict = ConfigParse.ParseIntArrayDict(config.Numerical2);
+        openGirdCountDict = ConfigParse.ParseIntArrayDict(config.Numerical3);
+
+        config = FuncConfigConfig.Get("ItemCountShow");
+        gameCashShow = JsonMapper.ToObject<int[]>(config.Numerical1);
     }
 
+    void ParsePackConfigIni()
+    {
+        string[] lines = LoadConfigIni("MapServerConfig");
+        foreach (string line in lines)
+        {
+            if (line.StartsWith("PackCnt") && line.Contains("="))
+            {
+                string[] parts = line.Split('=');
+                if (parts.Length == 2 && int.TryParse(parts[1], out int count))
+                {
+                    string packTypeStr = parts[0].Replace("PackCnt", "");
+                    if (int.TryParse(packTypeStr, out int packTypeIndex))
+                    {
+                        PackMaxCountDict[packTypeIndex] = count;
+                    }
+                }
+            }
+        }
+    }
+
+    public string[] LoadConfigIni(string name)
+    {
+        string path = string.Empty;
+#if UNITY_EDITOR
+        if (!AssetSource.isUseAssetBundle)
+        {
+            path = ResourcesPath.CONFIG_FODLER + "/" + name + ".ini";
+        }
+        else
+#endif
+        {
+            //浠庢湇鍔$鎷疯礉鏄痠ni锛屾墦鍖呯敤txt缁熶竴澶勭悊
+            path = AssetVersionUtility.GetAssetFilePath($"Config/{name}.txt");
+        }
+
+        return File.ReadAllLines(path);
+    }
+
+    public int GetCanBuyPackGirdCount(PackType type)
+    {
+        if (!PackMaxCountDict.ContainsKey((int)type))
+        { 
+            return 0;
+        }
+        return PackMaxCountDict[(int)type] - GetSinglePack(type).unlockedGridCount;
+    }
 
 
     private void UpdateSecond()
     {
-        if (isUpdatePlayerLv)
+        if (isItemChange)
         {
-            isUpdatePlayerLv = false;
+            isItemChange = false;
+            DelayRefreshItemPackEvent();
         }
     }
 
-    private void UpdatePlayerLv(PlayerDataType type)
-    {
-        if (type != PlayerDataType.LV) return;
+    // private void UpdatePlayerLv(PlayerDataType type)
+    // {
+    //     if (type != PlayerDataType.LV) return;
 
-        isUpdatePlayerLv = true;
-    }
+    //     isUpdatePlayerLv = true;
+    // }
 
     #endregion
 
@@ -550,7 +631,11 @@
     public SinglePack GetSinglePack(PackType type)
     {
         SinglePack singlePack = null;
-        playerPackDict.TryGetValue(type, out singlePack);
+        if (!playerPackDict.TryGetValue(type, out singlePack))
+        { 
+            singlePack = new SinglePack(type);
+            playerPackDict.Add(type, singlePack);
+        }
         return singlePack;
     }
 
@@ -647,6 +732,18 @@
         }
     }
 
+    public List<ItemModel> GetItems(PackType packType)
+    {
+        if (playerPackDict.ContainsKey(packType))
+        {
+            return playerPackDict[packType].GetItems();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
     //閫氳繃id鎵剧墿鍝侊紝娉ㄦ剰妫�鏌ユ槸鍚︽寚瀹氳儗鍖�
     public string GetItemGUIDByID(int itemId, bool includeAuction = true, PackType packType = PackType.Item)
     {
@@ -683,14 +780,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 long GetItemCountByID(PackType type, int id, bool includeAuction = true)
     {
-        int count = 0;
+        long count = 0;
         var singlePack = GetSinglePack(type);
         if (singlePack != null)
         {
@@ -735,17 +832,17 @@
     {
         int useCnt = 0;
         List<int> shareIdlist = null;
-        bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
-        if (isShare)
-        {
-            foreach (var id in shareIdlist)
-            {
-                int singleUseCnt = 0;
-                itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
-                useCnt += singleUseCnt;
-            }
-        }
-        else
+        // bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
+        // if (isShare)
+        // {
+        //     foreach (var id in shareIdlist)
+        //     {
+        //         int singleUseCnt = 0;
+        //         itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
+        //         useCnt += singleUseCnt;
+        //     }
+        // }
+        // else
         {
             itemDayUseCntDict.TryGetValue(itemId, out useCnt);
         }
@@ -778,60 +875,103 @@
         return useCnt;
     }
 
-    public void GotoWashAttributePoint(string guid)
-    {
-        // ItemModel itemModel = GetItemByGuid(guid);
-        // if (itemModel == null) return;
-
-        // WashAttrPointWin.itemModel = itemModel;
-        // WindowCenter.Instance.Open<WashAttrPointWin>();
-    }
 
     #region 绾㈢偣閫昏緫鍒ゆ柇
 
-    const int ITEMPACK_REDKEY = 102011003;
-    Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY);
+    Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_MainPackKey, MainRedDot.RedPoint_BagFuncKey);
+    Redpoint redpointComposePack = new Redpoint(MainRedDot.RedPoint_MainPackKey, MainRedDot.RedPoint_ComposeFuncKey);
 
-    const int LS_REDKEY = 102011015;
-    Redpoint redpointLS = new Redpoint(MainRedDot.RedPoint_BagFuncKey, LS_REDKEY);
-
-
-    private void UpdatePackRedpoint(PackType type)
+    //寤惰繜閫氱煡鑳屽寘鍙樺寲锛岄伩鍏嶅湪鍚屼竴甯у唴澶氭閫氱煡
+    private void DelayNotifyPackChange(PackType type)
     {
-        var singlePack = GetSinglePack(type);
-        if (singlePack == null)
+        if (type == PackType.Item)
         {
-            return;
-        }
-
-        switch (type)
-        {
-            case PackType.Item:
-                if (singlePack.GetEmptyGridCount() <= 0)
-                {
-                    redpointItemPack.state = RedPointState.Full;
-                    //SysNotifyMgr.Instance.ShowTip("BagFull");
-                }
-                else
-                {
-                    redpointItemPack.state = RedPointState.None;
-                }
-
-                break;
-            case PackType.Warehouse:
-                if (singlePack.GetEmptyGridCount() <= 0)
-                {
-                    MainRedDot.Instance.redPointDepotFunc.state = RedPointState.Full;
-                }
-                else
-                {
-                    MainRedDot.Instance.redPointDepotFunc.state = RedPointState.None;
-                }
-                break;
+            isItemChange = true;
         }
     }
 
-    
+
+    void DelayRefreshItemPackEvent()
+    {
+        //鍚堟垚绾㈢偣
+        SinglePack singlePack = GetSinglePack(PackType.Item);
+        var items = singlePack.GetAllItems();
+
+        foreach (var item in items.Values)
+        {
+            if (ItemCompoundConfig.IsCompoundItem(item.itemId))
+            {
+                var config = ItemCompoundConfig.GetItemCompoundConfig(item.itemId);
+                var targetID = config.itemID;
+                var targetCnt = config.itemCount;
+                if (GetItemCountByID(PackType.Item, targetID) >= targetCnt)
+                {
+                    redpointComposePack.state = RedPointState.Simple;
+                    break;
+                }
+            }
+        }
+
+
+        //鑳屽寘绾㈢偣
+        if (singlePack.GetEmptyGridCount() <= 0)
+        {
+            redpointItemPack.state = RedPointState.Full;
+            SysNotifyMgr.Instance.ShowTip("BagFull");
+        }
+        else
+        {
+            redpointItemPack.state = RedPointState.None;
+
+            //鏃犳潯浠跺紑鍚殑瀹濈绾㈢偣
+            foreach (var item in items.Values)
+            {
+                var chestConfig = ChestsConfig.Get(item.itemId);
+                if (chestConfig != null && chestConfig.ExpendItemID == 0 && chestConfig.OpenMoney == 0)
+                {
+                    redpointItemPack.state = RedPointState.Simple;
+                    break;
+                }
+            }
+        }
+
+
+    }
+
+    public void RefreshItemComposeList()
+    {
+        //鏀堕泦鍚堟垚鐗╁搧
+        composeItemGuidList.Clear();
+
+        SinglePack singlePack = GetSinglePack(PackType.Item);
+        var items = singlePack.GetAllItems();
+
+        foreach (var item in items.Values)
+        {
+            if (ItemCompoundConfig.IsCompoundItem(item.itemId))
+            {
+                composeItemGuidList.Add(item.guid);
+            }
+        }
+
+        composeItemGuidList.Sort(SortItemCompose);
+    }
+
+    int SortItemCompose(string guidA, string guidB)
+    {
+        var itemA = GetItemByGuid(guidA);
+        var itemB = GetItemByGuid(guidB);
+
+        var colorA = itemA.config.ItemColor;
+        var colorB = itemB.config.ItemColor;
+        if (colorA != colorB)
+        {
+            return colorB - colorA;
+        }
+
+        return itemA.itemId - itemB.itemId;
+    }
+
     #endregion
 
     #region 鏌ョ湅鏌愪釜浣嶇疆鐨勭墿鍝�
@@ -843,22 +983,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;
@@ -887,23 +1028,23 @@
 
     private void AddItemUseTypeDict(int id)
     {
-        SkillConfig skillConfig = GetSkillConfig(id);
-        int itemCount = GetItemCountByID(PackType.Item, id);
-        if (skillConfig != null && itemCount > 0)
-        {
-            if (!itemUseTypeDict.ContainsKey(skillConfig.SkillTypeID))
-            {
-                itemUseTypeDict.Add(skillConfig.SkillTypeID, id);
-            }
-            else
-            {
-                SkillConfig preSkillConfig = GetSkillConfig(itemUseTypeDict[skillConfig.SkillTypeID]);
-                if (skillConfig.SkillLV > preSkillConfig.SkillLV)
-                {
-                    itemUseTypeDict[skillConfig.SkillTypeID] = id;
-                }
-            }
-        }
+        // SkillConfig skillConfig = GetSkillConfig(id);
+        // int itemCount = GetItemCountByID(PackType.Item, id);
+        // if (skillConfig != null && itemCount > 0)
+        // {
+        //     if (!itemUseTypeDict.ContainsKey(skillConfig.SkillTypeID))
+        //     {
+        //         itemUseTypeDict.Add(skillConfig.SkillTypeID, id);
+        //     }
+        //     else
+        //     {
+        //         SkillConfig preSkillConfig = GetSkillConfig(itemUseTypeDict[skillConfig.SkillTypeID]);
+        //         if (skillConfig.SkillLV > preSkillConfig.SkillLV)
+        //         {
+        //             itemUseTypeDict[skillConfig.SkillTypeID] = id;
+        //         }
+        //     }
+        // }
     }
 
 
@@ -921,44 +1062,44 @@
     #endregion
 
     #region 鍒ゆ柇鐗╁搧鏄惁杈惧埌浣跨敤涓婇檺
-    // public bool IsReachUseLimit(string guid, out ulong count)
-    // {
-    //     count = 0;
-    //     ItemModel itemModel = GetItemByGuid(guid);
-    //     if (itemModel == null) return false;
+    public bool IsReachUseLimit(string guid, out ulong count)
+    {
+        count = 0;
+        ItemModel itemModel = GetItemByGuid(guid);
+        if (itemModel == null) return false;
 
-    //     AttrFruitConfig fruitConfig = AttrFruitConfig.Get(itemModel.itemId);
-    //     int haveUseCnt = GetItemUsedTimesToday(itemModel.itemId);
-    //     int sumHaveUseCnt = GetItemTotalUsedTimes(itemModel.itemId);
-    //     count = (ulong)itemModel.count;
-    //     bool isReach = false;
-    //     int remainDayCnt = 0;
-    //     if (itemModel.config.MaxSkillCnt > 0)
-    //     {
-    //         remainDayCnt = itemModel.config.MaxSkillCnt - haveUseCnt;
-    //         if (itemModel.count > remainDayCnt)
-    //         {
-    //             count = (ulong)remainDayCnt;
-    //         }
-    //     }
+        // AttrFruitConfig fruitConfig = AttrFruitConfig.Get(itemModel.itemId);
+        int haveUseCnt = GetItemUsedTimesToday(itemModel.itemId);
+        int sumHaveUseCnt = GetItemTotalUsedTimes(itemModel.itemId);
+        count = (ulong)itemModel.count;
+        bool isReach = false;
+        int remainDayCnt = 0;
+        if (itemModel.config.MaxSkillCnt > 0)
+        {
+            remainDayCnt = itemModel.config.MaxSkillCnt - haveUseCnt;
+            if (itemModel.count > remainDayCnt)
+            {
+                count = (ulong)remainDayCnt;
+            }
+        }
 
-    //     int remainSumCnt = 0;
-    //     if (fruitConfig != null)
-    //     {
-    //         remainSumCnt = fruitConfig.basicUseLimit - sumHaveUseCnt;
-    //         if (remainSumCnt <= remainDayCnt && itemModel.count > remainSumCnt)
-    //         {
-    //             count = (ulong)remainSumCnt;
-    //         }
-    //     }
+        int remainSumCnt = 0;
+        // if (fruitConfig != null)
+        // {
+        //     remainSumCnt = fruitConfig.basicUseLimit - sumHaveUseCnt;
+        //     if (remainSumCnt <= remainDayCnt && itemModel.count > remainSumCnt)
+        //     {
+        //         count = (ulong)remainSumCnt;
+        //     }
+        // }
 
-    //     if (count < (ulong)itemModel.count)
-    //     {
-    //         isReach = true;
-    //     }
+        if (count < (ulong)itemModel.count)
+        {
+            isReach = true;
+        }
 
-    //     return isReach;
-    // }
+        return isReach;
+    }
     #endregion
 
     
@@ -977,60 +1118,4 @@
     }
 
 
-    
-
-    public void ReceiveAwardNotify(HA801_tagMCGiveAwardInfo netPack)
-    {
-        var eventName = UIHelper.ServerStringTrim(netPack.EventName);
-        if (eventName == "BuyItem")
-            return;
-
-        // 浠欑洘鏀诲煄鎴�
-        // if (eventName == "FamilyGCZSQGrid" || eventName == "FamilyGCZSQPass" || eventName == "FamilyGCZSQPassAll" ||
-        //     eventName == "FamilyGCZContiribution" || eventName == "FamilyGCZAtk")
-        // {
-        //     ModelCenter.Instance.GetModel<FairySiegeActModel>()?.OnUpdateAwardInfoAction(netPack);
-        //     return;
-        // }
-        if (!commonShowAwardEvents.Contains(eventName))
-            return;
-
-        List<Item> showItems = new List<Item>();
-
-        if (netPack.Exp != 0 || netPack.ExpPoint != 0)
-        {
-            ulong expValue = netPack.Exp + netPack.ExpPoint * (ulong)Constants.ExpPointValue;
-            showItems.Add(new Item(GeneralDefine.expDisplayId, expValue));
-        }
-        if (netPack.MoneyList.Length != 0)
-        {
-            for (int i = 0; i < netPack.MoneyLen; i++)
-            {
-                var moneyType = netPack.MoneyList[i].MoneyType;
-                if (GeneralDefine.moneyDisplayIds.ContainsKey(moneyType) && netPack.MoneyList[i].MoneyValue != 0)
-                {
-                    showItems.Add(new Item(GeneralDefine.moneyDisplayIds[moneyType], netPack.MoneyList[i].MoneyValue));
-                }
-
-            }
-        }
-
-        if (netPack.ItemList.Length != 0)
-        {
-            for (int i = 0; i < netPack.ItemLen; i++)
-            {
-                showItems.Add(new Item((int)netPack.ItemList[i].ItemID, netPack.ItemList[i].Count, netPack.ItemList[i].IsBind));
-            }
-        }
-
-
-        string info = string.Empty;
-        if (LanguageConfig.HasKey("commonShowAwardEvents_" + eventName))
-            info = Language.Get("commonShowAwardEvents_" + eventName);
-
-        if (showItems.Count == 0)
-            return;
-
-        ItemLogicUtility.Instance.ShowGetItem(showItems, info, 0, eventName: eventName);
-    }
 }

--
Gitblit v1.8.0