Ejemplo n.º 1
0
Archivo: Form1.cs Proyecto: 74805/Whist
        public void CardClick(object sender, EventArgs args)
        {
            Label label = (Label)sender;

            if (myICommon.IsCurrneTurn(clientid) && thisroundlabels[clientid].Image == null)
            {
                if (myICommon.GetLastWinner() == clientid || !myICommon.DoesHaveShape(clientid))
                {
                    cards.Remove(label);
                    myICommon.GetLastCcard((Card)label.Tag, clientid);
                    int p = label.Location.X;
                    label.Location            = new Point(670, 450);
                    thisroundlabels[clientid] = label;
                    this.cards.Remove(label);

                    for (int i = 0; i < this.cards.Count; i++)
                    {
                        if (this.cards[i].Location.X > p)
                        {
                            this.cards[i].Location = new Point(this.cards[i].Location.X - 28, 550);
                        }
                        else
                        {
                            this.cards[i].Location = new Point(this.cards[i].Location.X + 28, 550);
                        }
                    }
                }
                else
                {
                    Card cardtemp = (Card)label.Tag;
                    if (myICommon.IsCorrectShape(cardtemp))
                    {
                        cards.Remove(label);
                        myICommon.GetLastCcard((Card)label.Tag, clientid);
                        int p = label.Location.X;
                        label.Location            = new Point(670, 450);
                        thisroundlabels[clientid] = label;
                        this.cards.Remove(label);

                        for (int i = 0; i < this.cards.Count; i++)
                        {
                            if (this.cards[i].Location.X > p)
                            {
                                this.cards[i].Location = new Point(this.cards[i].Location.X - 28, 550);
                            }
                            else
                            {
                                this.cards[i].Location = new Point(this.cards[i].Location.X + 28, 550);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
Archivo: Form1.cs Proyecto: 74805/Whist
        public void CardClick(object sender, EventArgs args)
        {
            Label label = (Label)sender;

            if (myICommon.GetFrisch(clientid))
            {
                myICommon.NewFrischCard((Card)label.Tag, clientid);
                bool alreadyinfrisch = false;
                for (int i = 0; i < frischcounter; i++)
                {
                    if (frischcards[i] != null && ((Card)label.Tag).Equals(frischcards[i]))
                    {
                        alreadyinfrisch = true;
                    }
                }
                if (!alreadyinfrisch)
                {
                    frischcards.Add((Card)label.Tag);
                    int p = label.Location.X;

                    label.Location = new Point(615 + frischcounter * 56, 450);
                    frischlabels[clientid, frischcounter] = label;

                    this.cards.Remove(label);

                    for (int i = 0; i < this.cards.Count; i++)
                    {
                        if (this.cards[i].Location.X > p)
                        {
                            this.cards[i].Location = new Point(this.cards[i].Location.X - 28, 550);
                        }
                        else
                        {
                            this.cards[i].Location = new Point(this.cards[i].Location.X + 28, 550);
                        }
                    }
                    frischcounter++;
                }
            }
            else
            {
                if (frischcounter == 0)
                {
                    if (myICommon.IsCurrneTurn(clientid) && thisroundlabels[clientid].Image == null)
                    {
                        if (myICommon.GetLastWinner() == clientid || !myICommon.DoesHaveShape(clientid))
                        {
                            cards.Remove(label);
                            myICommon.GetLastCcard((Card)label.Tag, clientid);
                            int p = label.Location.X;
                            label.Location            = new Point(670, 450);
                            thisroundlabels[clientid] = label;
                            this.cards.Remove(label);

                            for (int i = 0; i < this.cards.Count; i++)
                            {
                                if (this.cards[i].Location.X > p)
                                {
                                    this.cards[i].Location = new Point(this.cards[i].Location.X - 28, 550);
                                }
                                else
                                {
                                    this.cards[i].Location = new Point(this.cards[i].Location.X + 28, 550);
                                }
                            }
                        }
                        else
                        {
                            Card cardtemp = (Card)label.Tag;
                            if (myICommon.IsCorrectShape(cardtemp))
                            {
                                cards.Remove(label);
                                myICommon.GetLastCcard((Card)label.Tag, clientid);
                                int p = label.Location.X;
                                label.Location            = new Point(670, 450);
                                thisroundlabels[clientid] = label;
                                this.cards.Remove(label);

                                for (int i = 0; i < this.cards.Count; i++)
                                {
                                    if (this.cards[i].Location.X > p)
                                    {
                                        this.cards[i].Location = new Point(this.cards[i].Location.X - 28, 550);
                                    }
                                    else
                                    {
                                        this.cards[i].Location = new Point(this.cards[i].Location.X + 28, 550);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }