Example #1
0
 public ClassData(string name, PowerSource power_source, PrimaryAbility key_ability, HeroRoleType role)
 {
     Name        = name;
     PowerSource = power_source;
     KeyAbility  = key_ability;
     Role        = role;
 }
Example #2
0
 public ClassData(string name, Masterplan.PowerSource power_source, PrimaryAbility key_ability, HeroRoleType role)
 {
     this.Name        = name;
     this.PowerSource = power_source;
     this.KeyAbility  = key_ability;
     this.Role        = role;
 }
Example #3
0
 private void analyse_party()
 {
     if (this.fHeroes == null)
     {
         return;
     }
     this.fRows = new List <HeroRoleType>();
     foreach (HeroRoleType value in Enum.GetValues(typeof(HeroRoleType)))
     {
         this.fRows.Add(value);
     }
     this.fColumns = new List <string>();
     foreach (Hero fHero in this.fHeroes)
     {
         if (this.fColumns.Contains(fHero.PowerSource))
         {
             continue;
         }
         this.fColumns.Add(fHero.PowerSource);
     }
     this.fColumns.Sort();
     this.fCells        = new Dictionary <Point, int>();
     this.fRowTotals    = new Dictionary <int, int>();
     this.fColumnTotals = new Dictionary <int, int>();
     for (int i = 0; i != this.fRows.Count; i++)
     {
         HeroRoleType item = this.fRows[i];
         if (!this.fRowTotals.ContainsKey(i))
         {
             this.fRowTotals[i] = 0;
         }
         for (int j = 0; j != this.fColumns.Count; j++)
         {
             string str = this.fColumns[j];
             int    num = 0;
             foreach (Hero hero in this.fHeroes)
             {
                 if (hero.Role != item || !(hero.PowerSource == str))
                 {
                     continue;
                 }
                 num++;
             }
             this.fCells[new Point(i, j)] = num;
             Dictionary <int, int> nums  = this.fRowTotals;
             Dictionary <int, int> nums1 = nums;
             int num1 = i;
             nums[num1] = nums1[num1] + num;
             if (!this.fColumnTotals.ContainsKey(j))
             {
                 this.fColumnTotals[j] = 0;
             }
             Dictionary <int, int> item1 = this.fColumnTotals;
             Dictionary <int, int> nums2 = item1;
             int num2 = j;
             item1[num2] = nums2[num2] + num;
         }
     }
 }
Example #4
0
        public int Count(HeroRoleType role)
        {
            int num = 0;

            foreach (HeroData hero in this.Heroes)
            {
                if (hero.Class == null || hero.Class.Role != role)
                {
                    continue;
                }
                num++;
            }
            return(num);
        }
Example #5
0
        public int Count(HeroRoleType role)
        {
            int count = 0;

            foreach (HeroData hero in Heroes)
            {
                if (hero.Class == null)
                {
                    continue;
                }

                if (hero.Class.Role == role)
                {
                    count += 1;
                }
            }

            return(count);
        }
Example #6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            if (this.fHeroes == null)
            {
                e.Graphics.DrawString("(no heroes)", this.Font, SystemBrushes.WindowText, base.ClientRectangle, this.fCentred);
                return;
            }
            this.analyse_party();
            System.Drawing.Font font = new System.Drawing.Font(this.Font, FontStyle.Bold);
            for (int i = 0; i != this.fRows.Count + 1; i++)
            {
                string str = "Total";
                if (i != this.fRows.Count)
                {
                    str = this.fRows[i].ToString();
                }
                RectangleF _rect = this.get_rect(0, i + 1);
                e.Graphics.DrawString(str, font, SystemBrushes.WindowText, _rect, this.fCentred);
            }
            for (int j = 0; j != this.fColumns.Count + 1; j++)
            {
                string item = "Total";
                if (j != this.fColumns.Count)
                {
                    item = this.fColumns[j];
                }
                RectangleF rectangleF = this.get_rect(j + 1, 0);
                e.Graphics.DrawString(item, font, SystemBrushes.WindowText, rectangleF, this.fCentred);
            }
            for (int k = 0; k != this.fRows.Count; k++)
            {
                for (int l = 0; l != this.fColumns.Count; l++)
                {
                    int        num    = this.fCells[new Point(k, l)];
                    RectangleF _rect1 = this.get_rect(l + 1, k + 1);
                    e.Graphics.DrawString(num.ToString(), this.Font, SystemBrushes.WindowText, _rect1, this.fCentred);
                }
            }
            for (int m = 0; m != this.fRows.Count; m++)
            {
                HeroRoleType heroRoleType = this.fRows[m];
                int          item1        = this.fRowTotals[m];
                RectangleF   rectangleF1  = this.get_rect(this.fColumns.Count + 1, m + 1);
                e.Graphics.DrawString(item1.ToString(), font, SystemBrushes.WindowText, rectangleF1, this.fCentred);
            }
            for (int n = 0; n != this.fColumns.Count; n++)
            {
                string     str1   = this.fColumns[n];
                int        num1   = this.fColumnTotals[n];
                RectangleF _rect2 = this.get_rect(n + 1, this.fRows.Count + 1);
                e.Graphics.DrawString(num1.ToString(), font, SystemBrushes.WindowText, _rect2, this.fCentred);
            }
            RectangleF rectangleF2 = this.get_rect(this.fColumns.Count + 1, this.fRows.Count + 1);
            Graphics   graphics    = e.Graphics;
            int        count       = this.fHeroes.Count;

            graphics.DrawString(count.ToString(), font, SystemBrushes.WindowText, rectangleF2, this.fCentred);
            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);
            Pen       pen             = new Pen(SystemColors.ControlDark);

            for (int o = 0; o != this.fRows.Count + 1; o++)
            {
                float     single           = (float)(o + 1) * height;
                Graphics  graphic          = e.Graphics;
                PointF    pointF           = new PointF((float)base.ClientRectangle.Left, single);
                Rectangle clientRectangle1 = base.ClientRectangle;
                graphic.DrawLine(pen, pointF, new PointF((float)clientRectangle1.Right, single));
            }
            for (int p = 0; p != this.fColumns.Count + 1; p++)
            {
                float     single1    = (float)(p + 1) * width;
                Graphics  graphics1  = e.Graphics;
                PointF    pointF1    = new PointF(single1, (float)base.ClientRectangle.Top);
                Rectangle rectangle1 = base.ClientRectangle;
                graphics1.DrawLine(pen, pointF1, new PointF(single1, (float)rectangle1.Bottom));
            }
        }
Example #7
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

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

            analyse_party();

            #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)
                {
                    HeroRoleType role = fRows[row];
                    str = role.ToString();
                }

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

            for (int col = 0; col != fColumns.Count + 1; ++col)
            {
                string str = "Total";
                if (col != fColumns.Count)
                {
                    str = fColumns[col];
                }

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

            #endregion

            #region Matrix cells

            for (int row = 0; row != fRows.Count; ++row)
            {
                for (int col = 0; col != fColumns.Count; ++col)
                {
                    int heroes = fCells[new Point(row, col)];

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

            #endregion

            #region Totals

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

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

            // Column totals
            for (int col = 0; col != fColumns.Count; ++col)
            {
                string source = 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(fHeroes.Count.ToString(), header, SystemBrushes.WindowText, total_rect, fCentred);

            #endregion

            #region Grid

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

            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));
            }

            #endregion
        }
Example #8
0
        void analyse_party()
        {
            if (fHeroes == null)
            {
                return;
            }

            // Rows
            fRows = new List <HeroRoleType>();
            foreach (HeroRoleType role in Enum.GetValues(typeof(HeroRoleType)))
            {
                fRows.Add(role);
            }

            // Columns
            fColumns = new List <string>();
            foreach (Hero h in fHeroes)
            {
                if (!fColumns.Contains(h.PowerSource))
                {
                    fColumns.Add(h.PowerSource);
                }
            }
            fColumns.Sort();

            fCells        = new Dictionary <Point, int>();
            fRowTotals    = new Dictionary <int, int>();
            fColumnTotals = new Dictionary <int, int>();

            for (int row = 0; row != fRows.Count; ++row)
            {
                HeroRoleType role = fRows[row];

                if (!fRowTotals.ContainsKey(row))
                {
                    fRowTotals[row] = 0;
                }

                for (int col = 0; col != fColumns.Count; ++col)
                {
                    string source = fColumns[col];

                    // Get list of heroes for this cell
                    int heroes = 0;
                    foreach (Hero card in fHeroes)
                    {
                        if ((card.Role == role) && (card.PowerSource == source))
                        {
                            heroes += 1;
                        }
                    }

                    fCells[new Point(row, col)] = heroes;

                    // Add to row total
                    fRowTotals[row] += heroes;

                    // Add to column total
                    if (!fColumnTotals.ContainsKey(col))
                    {
                        fColumnTotals[col] = 0;
                    }
                    fColumnTotals[col] += heroes;
                }
            }
        }