Example #1
0
        private void OnClick(Card hit)
        {
            if (hit.Selected)
            {
                hit.Selected = false;
                selections.Remove(hit);
                return;
            }

            if (selections.IsFull)
            {
                return;
            }
            Debug.Write(hit.Value + "\t");

            selections.AddCardo(hit);
            hit.Selected = true;

            if (selections.IsFull)
            {
                bool match = selections.IsMatch();
                if (match)
                {
                    HandleMatch();
                }
                else
                {
                    Debug.WriteLine("NOOO");
                    selections.Clear();
                }
            }
        }
        private void OnClicked(MouseState mouse)
        {
            var hit = GameBoard.CheckClicksOrNull(new Vector2(mouse.X, mouse.Y));

            if (hit != null)
            {
                if (hit.Selected)
                {
                    hit.Selected = false;
                    selections.Remove(hit);
                    return;
                }

                if (selections.IsFull)
                {
                    return;
                }
                Debug.Write(hit.Value + "\t");

                selections.AddCardo(hit);
                hit.Selected = true;

                if (selections.IsFull)
                {
                    bool match = selections.IsMatch();
                    if (match)
                    {
                        HandleMatch();
                    }
                    else
                    {
                        Debug.WriteLine("NOOO");
                        selections.Clear();
                    }
                }
            }
        }