/// <summary> /// Recieve an object awaiting an item from any slot in the inventory. /// </summary> /// <param name="querySender"></param> public void QueryForItem(ItemQuerySender querySender) { //Do not handle another query if there is one that has not yet been resolved. if (this.querySender != null) { throw new InventoryBusyException(); } this.querySender = querySender; eligibleSlots = null; }
protected override void SlotSelected(int num) { //If eligible slots are specified, make sure that the selected slot is one of those slota if (eligibleSlots != null && !eligibleSlots.Contains(num)) { return; } //If there is no query to be resolved, just equip an item as per usual. if (querySender == null) { base.SlotSelected(num); return; } //Resolve the query, use the result, and then clear the query. QueryResolved(querySender.ResolveQuery(GetItemAt(num))); querySender = null; }
/// <summary> /// Recieve an object awaiting an item only from the given slots in the inventory. /// </summary> /// <param name="querySender"></param> /// <param name="eligiblePositions"></param> public void QueryForItem(ItemQuerySender querySender, List <int> eligiblePositions) { QueryForItem(querySender); eligibleSlots = new List <int>(eligiblePositions); }