private void HighlightDraggedItemSlots() { ResetHighlight(); var hoveredSlots = HoveredSlots.ToList(); var isInvalidSelection = hoveredSlots.Any(s => s == null); hoveredSlots = hoveredSlots .Where(s => s != null) .ToList(); foreach (var slot in hoveredSlots) { if (isInvalidSelection) { slot.HighlightInvalid(); } else if (slot.Item != null) { slot.HighlightInvalid(); } else { slot.HighlightHover(); } } }
public bool AcceptDraggedItem(InventoryItemView itemView) { if (!IsDraggedItemAcceptable) { DraggedItem = null; GunsInHandsUpdater.UpdateItemsList(AllItems); return(false); } foreach (var slot in HoveredSlots.Where(s => s.Item != null) .GroupBy(s => s.Item) .Select(s => s.First())) { slot.ItemView.DropAway(); ForgetAbout(slot.Item); } AcceptItem(itemView, hoveredSlot.Position); DraggedItem = null; ResetHighlight(); return(true); }