| | |
| | | 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 List<int> composeItemIDList = new List<int>(); //合成列表物品ID |
| | | List<int> canComposeItemIDList = new List<int>(); //数量足够合成列表物品ID 排序判断用 |
| | | |
| | | //开格子 |
| | | public Dictionary<int, int> openGirdMoneyDict = new Dictionary<int, int>(); //背包类型:消耗货币类型 |
| | |
| | | SinglePack singlePack = GetSinglePack(PackType.Item); |
| | | var items = singlePack.GetAllItems(); |
| | | |
| | | redpointComposePack.state = RedPointState.None; |
| | | foreach (var item in items.Values) |
| | | { |
| | | if (ItemCompoundConfig.IsCompoundItem(item.itemId)) |
| | | int makeID = ItemCompoundConfig.GetMakeIDByMaterial(item.itemId); |
| | | if (makeID != 0) |
| | | { |
| | | var config = ItemCompoundConfig.GetItemCompoundConfig(item.itemId); |
| | | var config = ItemCompoundConfig.GetItemCompoundConfig(makeID); |
| | | var targetID = config.itemID; |
| | | var targetCnt = config.itemCount; |
| | | if (GetItemCountByID(PackType.Item, targetID) >= targetCnt) |
| | |
| | | public void RefreshItemComposeList() |
| | | { |
| | | //收集合成物品 |
| | | composeItemGuidList.Clear(); |
| | | composeItemIDList.Clear(); |
| | | canComposeItemIDList.Clear(); |
| | | |
| | | SinglePack singlePack = GetSinglePack(PackType.Item); |
| | | var items = singlePack.GetAllItems(); |
| | | |
| | | foreach (var item in items.Values) |
| | | { |
| | | if (ItemCompoundConfig.IsCompoundItem(item.itemId)) |
| | | var makeID = ItemCompoundConfig.GetMakeIDByMaterial(item.itemId); |
| | | if (makeID != 0) |
| | | { |
| | | composeItemGuidList.Add(item.guid); |
| | | composeItemIDList.Add(makeID); |
| | | |
| | | var config = ItemCompoundConfig.GetItemCompoundConfig(makeID); |
| | | var targetID = config.itemID; |
| | | var targetCnt = config.itemCount; |
| | | if (GetItemCountByID(PackType.Item, targetID) >= targetCnt) |
| | | { |
| | | canComposeItemIDList.Add(makeID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | composeItemGuidList.Sort(SortItemCompose); |
| | | composeItemIDList.Sort(SortItemCompose); |
| | | } |
| | | |
| | | int SortItemCompose(string guidA, string guidB) |
| | | int SortItemCompose(int itemIDA, int itemIDB) |
| | | { |
| | | var itemA = GetItemByGuid(guidA); |
| | | var itemB = GetItemByGuid(guidB); |
| | | // 合成材料够不够 |
| | | var isEnoughA = canComposeItemIDList.Contains(itemIDA); |
| | | var isEnoughB = canComposeItemIDList.Contains(itemIDB); |
| | | if (isEnoughA != isEnoughB) |
| | | { |
| | | return isEnoughA ? -1 : 1; |
| | | } |
| | | |
| | | var colorA = itemA.config.ItemColor; |
| | | var colorB = itemB.config.ItemColor; |
| | | var itemA = ItemConfig.Get(itemIDA); |
| | | var itemB = ItemConfig.Get(itemIDB); |
| | | |
| | | var colorA = itemA.ItemColor; |
| | | var colorB = itemB.ItemColor; |
| | | if (colorA != colorB) |
| | | { |
| | | return colorB - colorA; |
| | | } |
| | | |
| | | return itemA.itemId - itemB.itemId; |
| | | return itemA.ID - itemB.ID; |
| | | } |
| | | |
| | | #endregion |