public override List <Items> GetItems() { Items mCraftItem = GetComponentInParent <CraftLine>().CurItem; if (!mCraftItem) { return(null); } List <Items> tList = new List <Items>(); Items.ItemRecipe[] recipe = mCraftItem.Recipe; for (int i = 0; i < recipe.Length; i++) { List <Items> temp = new List <Items>(); if (recipe[i].Recipe.Length > slotId) { Items.ITEM_DETAILTYPE type = recipe[i].Recipe[slotId]; List <Items> ttemp = Inventory.GetInvenItemList(type); if (ttemp != null) { temp.AddRange(ttemp); } } if (recipe[i].SpecialRecipe.Length > slotId) { InvenSlot tSlot = Inventory.GetInvenSlot(recipe[i].SpecialRecipe[slotId]); if (tSlot) { temp.Add(tSlot.Item); } } if (temp.Count != 0) { tList.AddRange(temp); } } if (tList.Count == 0) { return(null); } return(tList); }
static public List <Items> GetInvenItemList(Items.ITEM_DETAILTYPE type) { List <Items> temp = new List <Items>(); for (int y = 0; y < Slots.Count; y++) { for (int x = 0; x < Slots[y].Count; x++) { if (!Slots[y][x].Item) { continue; } Items tItem = Slots[y][x].Item; if (tItem.DetailType != type) { continue; } bool isExist = false; for (int i = 0; i < temp.Count; i++) { if (tItem.ItemName == temp[i].ItemName) { isExist = true; break; } } if (isExist) { continue; } temp.Add(GameManager.Instance.ObjPool.GetItem(tItem.ItemName)); } } if (temp.Count == 0) { return(null); } return(temp); }
public Dictionary <int, List <Items> > GetItems(Items.ITEM_DETAILTYPE detailType) { Dictionary <int, List <Items> > dTemp = new Dictionary <int, List <Items> >(); foreach (var fKey in mItemPool) { foreach (var sKey in mItemPool[fKey.Key]) { foreach (var tKey in sKey.Value) { List <Items> lTemp = null; for (int i = 0; i < tKey.Value.Count; i++) { if (tKey.Value[i].DetailType != detailType) { break; } if (tKey.Value[i].IsUse) { continue; } Items temp = tKey.Value[i]; temp.IsUse = true; if (dTemp.TryGetValue(sKey.Key, out lTemp)) { lTemp.Add(temp); break; } else { lTemp = new List <Items>(); dTemp.Add(sKey.Key, lTemp); lTemp.Add(temp); break; } } } } } return(dTemp); }