Ejemplo n.º 1
0
        public void InitializeSupply()
        {
            List<String> supplyCards = new List<String>(DLLInterface.GetString("supplyCards").Split('|'));
            panelSupply.Controls.Clear();

            supply = new List<SupplyEntry>();

            int supplyX = 0, supplyY = 0;

            foreach(String s in supplyCards)
            {
                SupplyEntry newEntry = new SupplyEntry();
                newEntry.index = supply.Count;
                supply.Add(newEntry);

                int baseX = supplyX * 60;
                int baseY = supplyY * 85;

                newEntry.c = database.GetCard(s);
                newEntry.c.LoadBitmaps();
                newEntry.p = new PictureBox();

                newEntry.p.Size = newEntry.c.croppedImage.Size;
                newEntry.p.Left = baseX + 4;
                newEntry.p.Top = baseY + 18;
                newEntry.p.BorderStyle = BorderStyle.FixedSingle;

                newEntry.p.Image = newEntry.c.croppedImage;
                newEntry.p.MouseMove += delegate { pictureBoxCardImage.BackgroundImage = newEntry.c.fullImage; };

                newEntry.nameLabel = new Label();
                newEntry.nameLabel.Left = baseX;
                newEntry.nameLabel.Top = baseY;
                newEntry.nameLabel.Width = 58;
                newEntry.nameLabel.Height = 60;
                newEntry.nameLabel.BorderStyle = BorderStyle.FixedSingle;
                newEntry.nameLabel.Text = newEntry.c.PrettyName();
                newEntry.nameLabel.TextAlign = ContentAlignment.TopCenter;
                newEntry.nameLabel.BackColor = newEntry.c.BackColor();
                newEntry.nameLabel.Font = this.Font;

                newEntry.countLabel = new Label();
                newEntry.countLabel.Left = baseX;
                newEntry.countLabel.Top = baseY + 61;
                newEntry.countLabel.Width = 58;
                newEntry.countLabel.Height = 20;
                newEntry.countLabel.Text = "";
                newEntry.countLabel.TextAlign = ContentAlignment.TopCenter;
                newEntry.countLabel.Font = this.Font;
                newEntry.countLabel.BackColor = Color.Transparent;

                panelSupply.Controls.Add(newEntry.p);
                panelSupply.Controls.Add(newEntry.nameLabel);
                panelSupply.Controls.Add(newEntry.countLabel);

                supplyX++;

                if (supplyX == 3 && supplyY == 0 && !supplyCards.Contains("platinum")) supplyX++;
                if (supplyX == 4 && supplyY == 0 && !supplyCards.Contains("potion")) supplyX++;
                if (supplyX == 3 && supplyY == 1 && !supplyCards.Contains("colony")) supplyX++;

                if (supplyX >= 5)
                {
                    supplyX = 0;
                    supplyY++;
                }
            }
        }
Ejemplo n.º 2
0
        public void InitializeSupply()
        {
            List <String> supplyCards = new List <String>(DLLInterface.GetString("supplyCards").Split('|'));

            panelSupply.Controls.Clear();

            supply = new List <SupplyEntry>();

            int supplyX = 0, supplyY = 0;

            foreach (String s in supplyCards)
            {
                SupplyEntry newEntry = new SupplyEntry();
                newEntry.index = supply.Count;
                supply.Add(newEntry);

                int baseX = supplyX * 60;
                int baseY = supplyY * 85;

                newEntry.c = database.GetCard(s);
                newEntry.c.LoadBitmaps();
                newEntry.p = new PictureBox();

                newEntry.p.Size        = newEntry.c.croppedImage.Size;
                newEntry.p.Left        = baseX + 4;
                newEntry.p.Top         = baseY + 18;
                newEntry.p.BorderStyle = BorderStyle.FixedSingle;

                newEntry.p.Image      = newEntry.c.croppedImage;
                newEntry.p.MouseMove += delegate { pictureBoxCardImage.BackgroundImage = newEntry.c.fullImage; };

                newEntry.nameLabel             = new Label();
                newEntry.nameLabel.Left        = baseX;
                newEntry.nameLabel.Top         = baseY;
                newEntry.nameLabel.Width       = 58;
                newEntry.nameLabel.Height      = 60;
                newEntry.nameLabel.BorderStyle = BorderStyle.FixedSingle;
                newEntry.nameLabel.Text        = newEntry.c.PrettyName();
                newEntry.nameLabel.TextAlign   = ContentAlignment.TopCenter;
                newEntry.nameLabel.BackColor   = newEntry.c.BackColor();
                newEntry.nameLabel.Font        = this.Font;

                newEntry.countLabel           = new Label();
                newEntry.countLabel.Left      = baseX;
                newEntry.countLabel.Top       = baseY + 61;
                newEntry.countLabel.Width     = 58;
                newEntry.countLabel.Height    = 20;
                newEntry.countLabel.Text      = "";
                newEntry.countLabel.TextAlign = ContentAlignment.TopCenter;
                newEntry.countLabel.Font      = this.Font;
                newEntry.countLabel.BackColor = Color.Transparent;

                panelSupply.Controls.Add(newEntry.p);
                panelSupply.Controls.Add(newEntry.nameLabel);
                panelSupply.Controls.Add(newEntry.countLabel);

                supplyX++;

                if (supplyX == 3 && supplyY == 0 && !supplyCards.Contains("platinum"))
                {
                    supplyX++;
                }
                if (supplyX == 4 && supplyY == 0 && !supplyCards.Contains("potion"))
                {
                    supplyX++;
                }
                if (supplyX == 3 && supplyY == 1 && !supplyCards.Contains("colony"))
                {
                    supplyX++;
                }

                if (supplyX >= 5)
                {
                    supplyX = 0;
                    supplyY++;
                }
            }
        }