public void ShowShopMenu() { List <Item> list = heldItems.ToList(); list.Sort(SortItems); Dictionary <ISalable, int[]> contents = new Dictionary <ISalable, int[]>(); foreach (Item item in list) { contents[item] = new int[2] { 0, 1 }; } Game1.activeClickableMenu = new ShopMenu(contents, 0, null, onDresserItemWithdrawn, onDresserItemDeposited, GetShopMenuContext()) { source = this, behaviorBeforeCleanup = delegate { mutex.ReleaseLock(); OnMenuClose(); } }; }
public override bool checkForAction(Farmer who, bool justCheckingForActivity = false) { if (justCheckingForActivity) { return(true); } mutex.RequestLock(delegate { List <Item> list = heldItems.ToList(); list.Sort(SortItems); Dictionary <ISalable, int[]> dictionary = new Dictionary <ISalable, int[]>(); foreach (Item current in list) { dictionary[current] = new int[2] { 0, 1 }; } Game1.activeClickableMenu = new ShopMenu(dictionary, 0, null, onDresserItemWithdrawn, onDresserItemDeposited, "Dresser") { source = this, behaviorBeforeCleanup = delegate { mutex.ReleaseLock(); } }; }); return(true); }
public override NetObjectList <Item> UpdateFilter(NetObjectList <Item> filteredItems) { Filter = new NetObjectList <Item>(); if (filteredItems == null) { Filter.Add(Farm.lastItemShipped); } else { foreach (Item item in filteredItems.ToList()) { Filter.Add(item); } } return(Filter); }
public override bool CanStackItem(Item item) { bool canStack = false; NetObjectList <Item> itemList = GetItemList(); if (itemList.Any(i => i.ParentSheetIndex.Equals(item.ParentSheetIndex))) { foreach (Item i in itemList.ToList()) { if (i.ParentSheetIndex == item.ParentSheetIndex && i.canStackWith(item)) { canStack = true; } } } return(canStack); }
public override NetObjectList <Item> UpdateFilter(NetObjectList <Item> filteredItems) { Filter = new NetObjectList <Item>(); if (filteredItems == null) { NetObjectList <Item> itemList = GetItemList(); foreach (Item item in itemList.ToList()) { Filter.Add(item); } } else { foreach (Item item in filteredItems.ToList()) { Filter.Add(item); } } return(Filter); }