예제 #1
0
파일: Renderer.cs 프로젝트: andyld97/Spider
        public virtual void DoOnPaint(Graphics.IGraphics e)
        {
            StringFormat alginment = new StringFormat()
            {
                Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Near
            };
            int i = 0, c = 0;

            foreach (Class.Structure mStr in currentGame.MStructures)
            {
                c = 0;
                int cCard = 0;

                if (mStr.lstCards.Count == 0)
                {
                    // Empty field
                    e.DrawRectangle(new Pen(Color.Violet), new Rectangle(i * (this.info.Distance + this.info.Width), this.info.Y + 10, 100, 150));
                    i++; // Because \/ there will be continued!!!!
                    continue;
                }

                foreach (Class.Cart mCart in mStr.lstCards)
                {
                    int x = i * (this.info.Width + this.info.Distance);
                    int y = this.info.Y + 10 + (c * 10);
                    if (!mCart.Active)
                    {
                        e.FillRectangle(new SolidBrush(this.info.ActiveCardsColor), new Rectangle(x, y, this.info.Width, 5));
                    }
                    else
                    {
                        Rectangle actCard;
                        if (mStr.lstCards.IndexOf(mCart) == mStr.lstCards.Count - 1)
                        {
                            actCard = new Rectangle(i * (this.info.Width + this.info.Distance), y + (cCard * this.info.Distance2), this.info.Width, this.info.Height);
                        }
                        else
                        {
                            actCard = new Rectangle(i * (this.info.Width + this.info.Distance), y + (cCard * this.info.Distance2), this.info.Width, this.info.Distance2 * 2);
                        }

                        e.DrawImageUnscaledAndClipped(mCart.ToImage(), actCard);

                        if (mCart.Selection)
                        {
                            e.DrawRectangle(new Pen(this.info.SelectColor, 3), actCard);
                        }
                        int fact = 3;
                        if (mCart.IsTipp)
                        {
                            e.DrawRectangle(new Pen(this.info.TipColor, 1), new Rectangle(actCard.X + fact, actCard.Y + fact, actCard.Width - fact * 2, actCard.Height - fact * 2));
                        }
                        cCard++;
                    }
                    c++;
                }
                i++;
            }

            // Draw winning cards
            for (int f = 1; f <= this.currentGame.WinningCards.Length; f++)
            {
                Rectangle currentRectangle = new Rectangle(this.Width - (this.info.Distance * f) - (this.info.Width * f), this.Height - this.info.Distance - this.info.Height, this.info.Width, this.info.Height);
                if (this.currentGame.WinningCards[f - 1] != null)
                {
                    // Draw card
                    e.DrawImage(this.currentGame.WinningCards[f - 1].ToImage(), currentRectangle);
                }
                else
                {
                    // Draw rectangle
                    e.FillRectangle(Brushes.Green, currentRectangle);
                }
            }

            if (currentGame.EndOfGame)
            {
                e.DrawString("Sie haben gewonnen!", new Font("Segoe UI", 36, FontStyle.Regular), new SolidBrush(this.info.FontColor), this.DisplayRectangle, new StringFormat()
                {
                    Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center
                });
            }
        }
예제 #2
0
파일: Renderer.cs 프로젝트: andyld97/Spider
 public virtual void BeforePaint(Graphics.IGraphics e)
 {
     this.DoOnPaint(e);
 }