//Dictionary<CardViewModel, int> query = new Dictionary<CardViewModel, int>(); //public void Add(CardViewModel card) //{ // if (cards.Count() >= Settings.MAXCARDS) return; // var maxDups = (cards.Where(x => x == card).Select(x => x).Count() >= Settings.MAXDUPLICATES); // if (maxDups == true) return; // cards.Add(card); // Sort(); //} //private void Sort() //{ // query = cards.GroupBy(x => x) // .Where(g => g.Count() >= 1) // .OrderBy(x => x.Key.ManaCost) // .ToDictionary(x => x.Key, y => y.Count()); //} //public void Remove(CardViewModel card) //{ // cards.Remove(card); // Sort(); //} public CardViewModel GetSelectedCard(InputState input) { MouseState ms = Mouse.GetState(); Vector2 mousePosition = new Vector2(ms.Position.X, ms.Position.Y); foreach (var item in cards) { if (input.OnMouseOver(item.Card.Source, mousePosition)) { if (input.CurrentCursorState.LeftButton == ButtonState.Pressed && input.LastCursorState.LeftButton == ButtonState.Released) { return item; } } } return null; }
public CardViewModel GetHoverCard(InputState input) { MouseState ms = Mouse.GetState(); Vector2 mousePosition = new Vector2(ms.Position.X, ms.Position.Y); foreach (var item in cards) { if (input.OnMouseOver(item.Card.Source, mousePosition)) { return item; } } return null; }