Exemplo n.º 1
0
        void cardView_CardDoubleClick(CardView sender, CardView.CardSetEventArgs e)
        {
            if (sender.Row == -1 && sender.Column > 3)
                return; //cant click on finishedCards

            if (sender.Row > -1)
            {
                foreach (List<CardView> col in cardsInPlay)
                {
                    int index;
                    if ((index = col.IndexOf(sender)) != -1 && index < col.Count - 1)
                        return; //can only dbl click on last card
                    }
            }

            List<CardView> fin = finishedCards[Convert.ToInt32(sender.Card.Suit)];
            if (fin.Count == 0 && sender.Card.Face == Face.Ace ||
                fin.Count > 0 && Convert.ToInt32(sender.Card.Face) == Convert.ToInt32(fin[fin.Count - 1].Card.Face) + 1)
            {
                if (sender.Row > -1)
                    cardsInPlay[sender.Column].RemoveRange(sender.Row, 1);
                else
                    for (int i = 0; i < 4; i++) if (tempCards[i] == sender) tempCards[i] = null;

                fin.Add(sender);
                sender.SetLocation(4 + Convert.ToInt32(sender.Card.Suit), -1);
            }
        }
Exemplo n.º 2
0
        void cardView_MoveComplete(CardView sender, CardView.CardSetEventArgs e)
        {
            if (null != target)
            {
                target.TargetedErrorNotOk = null;
            }

            if (e.Valid = dropOk)
            {
                if (sender.Row != -1)
                {
                    cardsInPlay[sender.Column].RemoveRange(sender.Row, e.CardSet.Count);
                }
                else
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (tempCards[i] == sender)
                        {
                            tempCards[i] = null;
                        }
                    }
                }


                bool belowBar = sender.Location.Y < 120;
                if (belowBar)
                {
                    tempCards[dropColumn] = sender;
                    sender.SetLocation(dropColumn, -1);
                }
                else
                {
                    foreach (CardView item in e.CardSet)
                    {
                        cardsInPlay[dropColumn].Add(item);
                        item.SetLocation(dropColumn, cardsInPlay[dropColumn].Count - 1);
                    }
                }
                target = null;
                dropOk = false;
            }
        }
Exemplo n.º 3
0
        void cardView_CardDoubleClick(CardView sender, CardView.CardSetEventArgs e)
        {
            if (sender.Row == -1 && sender.Column > 3)
            {
                return;                 //cant click on finishedCards
            }
            if (sender.Row > -1)
            {
                foreach (List <CardView> col in cardsInPlay)
                {
                    int index;
                    if ((index = col.IndexOf(sender)) != -1 && index < col.Count - 1)
                    {
                        return;                         //can only dbl click on last card
                    }
                }
            }

            List <CardView> fin = finishedCards[Convert.ToInt32(sender.Card.Suit)];

            if (fin.Count == 0 && sender.Card.Face == Face.Ace ||
                fin.Count > 0 && Convert.ToInt32(sender.Card.Face) == Convert.ToInt32(fin[fin.Count - 1].Card.Face) + 1)
            {
                if (sender.Row > -1)
                {
                    cardsInPlay[sender.Column].RemoveRange(sender.Row, 1);
                }
                else
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (tempCards[i] == sender)
                        {
                            tempCards[i] = null;
                        }
                    }
                }

                fin.Add(sender);
                sender.SetLocation(4 + Convert.ToInt32(sender.Card.Suit), -1);
            }
        }
Exemplo n.º 4
0
        void cardView_MoveComplete(CardView sender, CardView.CardSetEventArgs e)
        {
            if (null != target)
                target.TargetedErrorNotOk = null;

            if (e.Valid = dropOk)
            {
                if (sender.Row != -1)
                    cardsInPlay[sender.Column].RemoveRange(sender.Row, e.CardSet.Count);
                else
                    for (int i = 0; i < 4; i++) if (tempCards[i] == sender) tempCards[i] = null;

                bool belowBar = sender.Location.Y < 120;
                if (belowBar)
                {
                    tempCards[dropColumn] = sender;
                    sender.SetLocation(dropColumn, -1);
                }
                else
                {
                    foreach (CardView item in e.CardSet)
                    {
                        cardsInPlay[dropColumn].Add(item);
                        item.SetLocation(dropColumn, cardsInPlay[dropColumn].Count - 1);
                    }
                }
                target = null;
                dropOk = false;
            }
        }