示例#1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.FillRectangle(Brushes.White, base.ClientRectangle);
            if (this.fDeck == null)
            {
                e.Graphics.DrawString("(no deck)", this.Font, SystemBrushes.WindowText, base.ClientRectangle, this.fCentred);
                return;
            }
            this.analyse_deck();
            Rectangle clientRectangle = base.ClientRectangle;
            float     width           = (float)clientRectangle.Width / (float)(this.fColumns.Count + 2);
            Rectangle rectangle       = base.ClientRectangle;
            float     height          = (float)rectangle.Height / (float)(this.fRows.Count + 2);

            using (Pen pen = new Pen(SystemColors.ControlDark))
            {
                for (int i = 0; i != this.fRows.Count + 1; i++)
                {
                    float     single           = (float)(i + 1) * height;
                    Graphics  graphics         = e.Graphics;
                    PointF    pointF           = new PointF((float)base.ClientRectangle.Left, single);
                    Rectangle clientRectangle1 = base.ClientRectangle;
                    graphics.DrawLine(pen, pointF, new PointF((float)clientRectangle1.Right, single));
                }
                for (int j = 0; j != this.fColumns.Count + 1; j++)
                {
                    float     single1    = (float)(j + 1) * width;
                    Graphics  graphic    = e.Graphics;
                    PointF    pointF1    = new PointF(single1, (float)base.ClientRectangle.Top);
                    Rectangle rectangle1 = base.ClientRectangle;
                    graphic.DrawLine(pen, pointF1, new PointF(single1, (float)rectangle1.Bottom));
                }
            }
            e.Graphics.FillRectangle(Brushes.Black, this.get_rect(0, 0));
            for (int k = 1; k != this.fColumns.Count + 2; k++)
            {
                RectangleF _rect = this.get_rect(k, 0);
                e.Graphics.FillRectangle(Brushes.Black, _rect);
            }
            for (int l = 1; l != this.fRows.Count + 2; l++)
            {
                RectangleF rectangleF = this.get_rect(0, l);
                e.Graphics.FillRectangle(Brushes.Black, rectangleF);
            }
            using (Brush solidBrush = new SolidBrush(Color.FromArgb(30, Color.Gray)))
            {
                for (int m = 1; m != this.fColumns.Count + 1; m++)
                {
                    RectangleF _rect1 = this.get_rect(m, this.fRows.Count + 1);
                    e.Graphics.FillRectangle(solidBrush, _rect1);
                }
                for (int n = 1; n != this.fRows.Count + 1; n++)
                {
                    RectangleF rectangleF1 = this.get_rect(this.fColumns.Count + 1, n);
                    e.Graphics.FillRectangle(solidBrush, rectangleF1);
                }
            }
            if (this.fHoverCell != Point.Empty && this.fHoverCell.X <= this.fColumns.Count && this.fHoverCell.Y <= this.fRows.Count)
            {
                RectangleF _rect2 = this.get_rect(this.fHoverCell.X, this.fHoverCell.Y);
                e.Graphics.DrawRectangle(SystemPens.Highlight, _rect2.X, _rect2.Y, _rect2.Width, _rect2.Height);
                using (Brush brush = new SolidBrush(Color.FromArgb(30, SystemColors.Highlight)))
                {
                    e.Graphics.FillRectangle(brush, _rect2);
                }
            }
            if (this.fSelectedCell != Point.Empty)
            {
                RectangleF rectangleF2 = this.get_rect(this.fSelectedCell.X, this.fSelectedCell.Y);
                using (Brush solidBrush1 = new SolidBrush(Color.FromArgb(100, SystemColors.Highlight)))
                {
                    e.Graphics.FillRectangle(solidBrush1, rectangleF2);
                }
            }
            System.Drawing.Font font = new System.Drawing.Font(this.Font, FontStyle.Bold);
            for (int o = 0; o != this.fRows.Count + 1; o++)
            {
                string str = "Total";
                if (o != this.fRows.Count)
                {
                    CardCategory item = this.fRows[o];
                    str = item.ToString();
                    if (item == CardCategory.SoldierBrute)
                    {
                        str = "Sldr / Brute";
                    }
                }
                RectangleF _rect3 = this.get_rect(0, o + 1);
                e.Graphics.DrawString(str, font, Brushes.White, _rect3, this.fCentred);
            }
            for (int p = 0; p != this.fColumns.Count + 1; p++)
            {
                string str1 = "Total";
                if (p != this.fColumns.Count)
                {
                    switch (this.fColumns[p])
                    {
                    case Difficulty.Trivial:
                    {
                        str1 = "Lower";
                        break;
                    }

                    case Difficulty.Easy:
                    {
                        int      num   = Math.Max(1, this.fDeck.Level - 1);
                        object[] level = new object[] { "Lvl ", num, " to ", this.fDeck.Level + 1 };
                        str1 = string.Concat(level);
                        break;
                    }

                    case Difficulty.Moderate:
                    {
                        object[] objArray = new object[] { "Lvl ", this.fDeck.Level + 2, " to ", this.fDeck.Level + 3 };
                        str1 = string.Concat(objArray);
                        break;
                    }

                    case Difficulty.Hard:
                    {
                        object[] level1 = new object[] { "Lvl ", this.fDeck.Level + 4, " to ", this.fDeck.Level + 5 };
                        str1 = string.Concat(level1);
                        break;
                    }

                    case Difficulty.Extreme:
                    {
                        str1 = "Higher";
                        break;
                    }
                    }
                }
                RectangleF rectangleF3 = this.get_rect(p + 1, 0);
                e.Graphics.DrawString(str1, font, Brushes.White, rectangleF3, this.fCentred);
            }
            for (int q = 0; q != this.fRows.Count; q++)
            {
                for (int r = 0; r != this.fColumns.Count; r++)
                {
                    Point point = new Point(q, r);
                    int   item1 = this.fCells[point];
                    if (item1 != 0)
                    {
                        RectangleF _rect4 = this.get_rect(r + 1, q + 1);
                        e.Graphics.DrawString(item1.ToString(), this.Font, SystemBrushes.WindowText, _rect4, this.fCentred);
                    }
                }
            }
            for (int s = 0; s != this.fRows.Count; s++)
            {
                CardCategory cardCategory = this.fRows[s];
                int          num1         = this.fRowTotals[s];
                int          num2         = 0;
                switch (cardCategory)
                {
                case CardCategory.Artillery:
                {
                    num2 = 5;
                    break;
                }

                case CardCategory.Controller:
                {
                    num2 = 5;
                    break;
                }

                case CardCategory.Lurker:
                {
                    num2 = 2;
                    break;
                }

                case CardCategory.Skirmisher:
                {
                    num2 = 14;
                    break;
                }

                case CardCategory.SoldierBrute:
                {
                    num2 = 18;
                    break;
                }

                case CardCategory.Minion:
                {
                    num2 = 5;
                    break;
                }

                case CardCategory.Solo:
                {
                    num2 = 1;
                    break;
                }
                }
                RectangleF rectangleF4 = this.get_rect(this.fColumns.Count + 1, s + 1);
                Graphics   graphics1   = e.Graphics;
                object[]   objArray1   = new object[] { num1, " (", num2, ")" };
                graphics1.DrawString(string.Concat(objArray1), font, SystemBrushes.WindowText, rectangleF4, this.fCentred);
            }
            for (int t = 0; t != this.fColumns.Count; t++)
            {
                Difficulty difficulty = this.fColumns[t];
                int        item2      = this.fColumnTotals[t];
                RectangleF _rect5     = this.get_rect(t + 1, this.fRows.Count + 1);
                e.Graphics.DrawString(item2.ToString(), font, SystemBrushes.WindowText, _rect5, this.fCentred);
            }
            RectangleF rectangleF5 = this.get_rect(this.fColumns.Count + 1, this.fRows.Count + 1);

            e.Graphics.DrawString(string.Concat(this.fDeck.Cards.Count, " cards"), font, SystemBrushes.WindowText, rectangleF5, this.fCentred);
        }
示例#2
0
 public CardCategoryInfo(CardCategory _category)
 {
     name     = _category.ToString();
     category = _category;
 }
示例#3
0
		protected override void OnPaint(PaintEventArgs e)
		{
			e.Graphics.FillRectangle(Brushes.White, ClientRectangle);

			if (fDeck == null)
			{
				e.Graphics.DrawString("(no deck)", Font, SystemBrushes.WindowText, ClientRectangle, fCentred);
				return;
			}

			analyse_deck();

			#region Grid

			float cellwidth = (float)ClientRectangle.Width / (fColumns.Count + 2);
			float cellheight = (float)ClientRectangle.Height / (fRows.Count + 2);

			using (Pen p = new Pen(SystemColors.ControlDark))
			{
				// Draw horizontal lines
				for (int row = 0; row != fRows.Count + 1; ++row)
				{
					float y = (row + 1) * cellheight;
					e.Graphics.DrawLine(p, new PointF(ClientRectangle.Left, y), new PointF(ClientRectangle.Right, y));
				}

				// Draw vertical lines
				for (int col = 0; col != fColumns.Count + 1; ++col)
				{
					float x = (col + 1) * cellwidth;
					e.Graphics.DrawLine(p, new PointF(x, ClientRectangle.Top), new PointF(x, ClientRectangle.Bottom));
				}
			}

			e.Graphics.FillRectangle(Brushes.Black, get_rect(0, 0));

			for (int index = 1; index != fColumns.Count + 2; ++index)
			{
				RectangleF cellrect = get_rect(index, 0);
				e.Graphics.FillRectangle(Brushes.Black, cellrect);
			}
			for (int index = 1; index != fRows.Count + 2; ++index)
			{
				RectangleF cellrect = get_rect(0, index);
				e.Graphics.FillRectangle(Brushes.Black, cellrect);
			}
			using (Brush b = new SolidBrush(Color.FromArgb(30, Color.Gray)))
			{
				for (int index = 1; index != fColumns.Count + 1; ++index)
				{
					RectangleF cellrect = get_rect(index, fRows.Count + 1);
					e.Graphics.FillRectangle(b, cellrect);
				}
				for (int index = 1; index != fRows.Count + 1; ++index)
				{
					RectangleF cellrect = get_rect(fColumns.Count + 1, index);
					e.Graphics.FillRectangle(b, cellrect);
				}
			}

			// Draw highlighted cell
			if (fHoverCell != Point.Empty)
			{
				if ((fHoverCell.X <= fColumns.Count) && (fHoverCell.Y <= fRows.Count))
				{
					RectangleF cellrect = get_rect(fHoverCell.X, fHoverCell.Y);
					e.Graphics.DrawRectangle(SystemPens.Highlight, cellrect.X, cellrect.Y, cellrect.Width, cellrect.Height);

					using (Brush b = new SolidBrush(Color.FromArgb(30, SystemColors.Highlight)))
					{
						e.Graphics.FillRectangle(b, cellrect);
					}
				}
			}

			// Draw selected cell
			if (fSelectedCell != Point.Empty)
			{
				RectangleF cellrect = get_rect(fSelectedCell.X, fSelectedCell.Y);
				using (Brush b = new SolidBrush(Color.FromArgb(100, SystemColors.Highlight)))
				{
					e.Graphics.FillRectangle(b, cellrect);
				}
			}

			#endregion

			#region Row / column headers

			Font header = new Font(Font, FontStyle.Bold);

			for (int row = 0; row != fRows.Count + 1; ++row)
			{
				string str = "Total";
				if (row != fRows.Count)
				{
					CardCategory cat = fRows[row];
					str = cat.ToString();

					if (cat == CardCategory.SoldierBrute)
						str = "Sldr / Brute";
				}

				// Draw row header cell
				RectangleF rowhdr = get_rect(0, row + 1);
				e.Graphics.DrawString(str, header, Brushes.White, rowhdr, fCentred);
			}

			for (int col = 0; col != fColumns.Count + 1; ++col)
			{
				string str = "Total";
				if (col != fColumns.Count)
				{
					switch (fColumns[col])
					{
						case Difficulty.Trivial:
							str = "Lower";
							break;
						case Difficulty.Easy:
							int min = Math.Max(1, fDeck.Level - 1);
							str = "Lvl " + min + " to " + (fDeck.Level + 1);
							break;
						case Difficulty.Moderate:
							str = "Lvl " + (fDeck.Level + 2) + " to " + (fDeck.Level + 3);
							break;
						case Difficulty.Hard:
							str = "Lvl " + (fDeck.Level + 4) + " to " + (fDeck.Level + 5);
							break;
						case Difficulty.Extreme:
							str = "Higher";
							break;
					}
				}

				// Draw col header cell
				RectangleF colhdr = get_rect(col + 1, 0);
				e.Graphics.DrawString(str, header, Brushes.White, colhdr, fCentred);
			}

			#endregion

			#region Matrix cells

			for (int row = 0; row != fRows.Count; ++row)
			{
				for (int col = 0; col != fColumns.Count; ++col)
				{
					Point pt = new Point(row, col);

					int count = fCells[pt];
					if (count == 0)
						continue;

					RectangleF rect = get_rect(col + 1, row + 1);
					e.Graphics.DrawString(count.ToString(), Font, SystemBrushes.WindowText, rect, fCentred);
				}
			}

			#endregion

			#region Totals

			// Row totals
			for (int row = 0; row != fRows.Count; ++row)
			{
				CardCategory cat = fRows[row];
				int count = fRowTotals[row];

				int suggested = 0;
				switch (cat)
				{
					case CardCategory.Artillery:
						suggested = 5;
						break;
					case CardCategory.Controller:
						suggested = 5;
						break;
					case CardCategory.Lurker:
						suggested = 2;
						break;
					case CardCategory.Skirmisher:
						suggested = 14;
						break;
					case CardCategory.SoldierBrute:
						suggested = 18;
						break;
					case CardCategory.Minion:
						suggested = 5;
						break;
					case CardCategory.Solo:
						suggested = 1;
						break;
				}

				// Draw row header cell
				RectangleF rowhdr = get_rect(fColumns.Count + 1, row + 1);
				e.Graphics.DrawString(count + " (" + suggested + ")", header, SystemBrushes.WindowText, rowhdr, fCentred);
			}

			// Column totals
			for (int col = 0; col != fColumns.Count; ++col)
			{
				Difficulty diff = fColumns[col];
				int count = fColumnTotals[col];

				// Draw col header cell
				RectangleF colhdr = get_rect(col + 1, fRows.Count + 1);
				e.Graphics.DrawString(count.ToString(), header, SystemBrushes.WindowText, colhdr, fCentred);
			}

			// Total
			RectangleF total_rect = get_rect(fColumns.Count + 1, fRows.Count + 1);
			e.Graphics.DrawString(fDeck.Cards.Count + " cards", header, SystemBrushes.WindowText, total_rect, fCentred);

			#endregion
		}