Пример #1
0
        void LoadCards(CardDatabase database, String s)
        {
            string[] parts    = s.Split('@');
            String[] cardList = parts[0].Split(',');
            foreach (String c in cardList)
            {
                Card curCard = database.GetCard(c);
                if (curCard != null)
                {
                    cards.Add(curCard);
                }
            }

            splitType = "";
            if (parts.Contains("34Split"))
            {
                splitType = "data/34SplitSmall.png";
            }
            if (parts.Contains("25Split"))
            {
                splitType = "data/25SplitSmall.png";
            }
            prosperity = parts.Contains("Prosperity");
        }
Пример #2
0
        private void UpdateDecision()
        {
            panelDecision.Controls.Clear();
            labelError.Text = null;

            int x = 0;
            int y = 0;

            List <String> s = new List <String>(DLLInterface.GetString("decision").Split('@'));

            decision.type = s[0];

            if (decision.type == "none")
            {
                labelDecision.Text = "No decision?";
            }
            else if (decision.type == "gameover")
            {
                labelActiveCard.Text        = "";
                labelActiveCardName.Visible = false;
                labelDecision.Text          = "Game Over!";
            }
            else if (decision.type == "selectCard")
            {
                String playerName = s[2];
                labelDecision.Text    = "(" + playerName + ") " + s[3];
                decision.minimumCount = Convert.ToInt32(s[4]);
                decision.maximumCount = Convert.ToInt32(s[5]);

                String activeCardName = s[6];
                if (activeCardName.StartsWith("phase"))
                {
                    labelActiveCard.Text        = Utility.PhaseName(Convert.ToInt32(activeCardName.Split('|')[1])) + " Phase";
                    labelActiveCardName.Visible = false;
                }
                else
                {
                    Card activeCard = database.GetCard(activeCardName);
                    labelActiveCard.Text          = "Active Card:";
                    labelActiveCardName.Text      = activeCard.PrettyName();
                    labelActiveCardName.BackColor = activeCard.BackColor();
                    labelActiveCardName.Visible   = true;
                }

                var sortedList = new List <String>(s[7].Split('|'));
                var cards      = sortedList.Select(z => database.GetCard(z));
                cards = cards.OrderByDescending(a => a.cost).ThenBy(a => a.name).ToList();
                foreach (Card c in cards)
                {
                    ButtonBase button;
                    if (decision.maximumCount == 1)
                    {
                        button        = new CardRadioButton(c);
                        button.Click += delegate { ProcessDecision(); };
                    }
                    else
                    {
                        button = new CardCheckBox(c);
                    }

                    button.Left        = x * 150 + 3;
                    button.Top         = y * 25 + 3;
                    button.MaximumSize = new Size(145, 23);
                    button.Text        = c.PrettyName();
                    button.BackColor   = c.BackColor();
                    button.Font        = panelDecision.Font;
                    button.AutoSize    = true;
                    button.MouseMove  += delegate { pictureBoxCardImage.BackgroundImage = c.fullImage; };
                    button.Padding     = new Padding(3, 1, 1, 1);
                    panelDecision.Controls.Add(button);

                    y++;
                    if (y == 5)
                    {
                        x++;
                        y = 0;
                    }
                }
            }
            else if (decision.type == "choice")
            {
                String   playerName = s[2];
                String[] parts      = s[3].Split('|');
                labelDecision.Text = "(" + playerName + ") " + parts[0];

                for (int choiceIndex = 1; choiceIndex < parts.Length; choiceIndex++)
                {
                    ButtonBase button = new ChoiceRadioButton(choiceIndex - 1);
                    button.Click += delegate { ProcessDecision(); };

                    button.Left        = x * 190 + 3;
                    button.Top         = y * 25 + 3;
                    button.MaximumSize = new Size(185, 23);
                    button.Text        = parts[choiceIndex];
                    button.Font        = panelDecision.Font;
                    button.AutoSize    = true;
                    button.Padding     = new Padding(3, 1, 1, 1);
                    panelDecision.Controls.Add(button);

                    y++;
                    if (y == 5)
                    {
                        x++;
                        y = 0;
                    }
                }
            }
        }
Пример #3
0
        void DrawStrategy(CardDatabase database, String s, string leaderName, bool displayRating, int x, int y)
        {
            //Leader 0:	4.18262	e1-d3-p4-gold@99|laboratory@3|militia@1|silver@99
            String[] parts = s.Split('\t');
            g.DrawString(leaderName, bigFont, blackBrush, x, y);

            x += 55;

            double d = Convert.ToDouble(parts[1]);

            g.DrawString(FormatPercentage(d), drawFont, PercentageBrush(d), x, y + 20);

            x += 90;

            int estateThreshold   = Convert.ToInt32(parts[2].Split('-')[0].Replace("e", ""));
            int duchyThreshold    = Convert.ToInt32(parts[2].Split('-')[1].Replace("d", ""));
            int provinceThreshold = Convert.ToInt32(parts[2].Split('-')[2].Replace("p", ""));

            if (prosperity)
            {
                Image  template = Bitmap.FromFile("data/prosperityBuyTemplate.png");
                double ratio    = (double)template.Height / (double)template.Width;
                g.DrawImage(template, new Rectangle(x, y, 120, (int)(120.0 * ratio)), new Rectangle(0, 0, template.Width, template.Height), GraphicsUnit.Pixel);
                template.Dispose();

                int yOffset  = -3;
                int ySpacing = 21;
                g.DrawString(estateThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset);
                g.DrawString(duchyThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset + ySpacing);
                g.DrawString(provinceThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset + ySpacing * 2);
            }
            else
            {
                Image  template = Bitmap.FromFile("data/coreBuyTemplate.png");
                double ratio    = (double)template.Height / (double)template.Width;
                g.DrawImage(template, new Rectangle(x, y, 120, (int)(120.0 * ratio)), new Rectangle(0, 0, template.Width, template.Height), GraphicsUnit.Pixel);
                template.Dispose();

                int yOffset  = 1;
                int ySpacing = 31;
                g.DrawString(estateThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset);
                g.DrawString(duchyThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset + ySpacing);
            }

            x += 145;

            String[] cardParts = parts[2].Split('-')[3].Split('|');
            for (int cardIndex = 0; cardIndex < cardParts.Length; cardIndex++)
            {
                Card c     = database.GetCard(cardParts[cardIndex].Split('@')[0]);
                int  count = Convert.ToInt32(cardParts[cardIndex].Split('@')[1]);
                if (c.fullImage == null)
                {
                    c.LoadBitmaps();
                }
                double croppedCardRatio = 252.0 / 296.0;

                int yOffset = 0;
                if (c.set == "core")
                {
                    yOffset = 116;
                }
                g.DrawImage(c.fullImage, new Rectangle(x + cardIndex * 80, y, (int)75.0, (int)(75.0 * croppedCardRatio)), new Rectangle(0, yOffset, c.fullImage.Width, 252), GraphicsUnit.Pixel);

                //if (count > 1 && count < 99)
                if (count > 1)
                {
                    int xOffset = 25;
                    if (count >= 10)
                    {
                        xOffset = 17;
                    }
                    g.DrawString("x" + count.ToString(), smallFont, blackBrush, x + cardIndex * 80 + xOffset, y + 59);
                }
            }
        }
Пример #4
0
        void LoadCards(CardDatabase database, String s)
        {
            string[] parts = s.Split('@');
            String[] cardList = parts[0].Split(',');
            foreach (String c in cardList)
            {
                Card curCard = database.GetCard(c);
                if (curCard != null) cards.Add(curCard);
            }

            splitType = "";
            if (parts.Contains("34Split")) splitType = "data/34SplitSmall.png";
            if (parts.Contains("25Split")) splitType = "data/25SplitSmall.png";
            prosperity = parts.Contains("Prosperity");
        }
Пример #5
0
        void DrawStrategy(CardDatabase database, String s, string leaderName, bool displayRating, int x, int y)
        {
            //Leader 0:	4.18262	e1-d3-p4-gold@99|laboratory@3|militia@1|silver@99
            String[] parts = s.Split('\t');
            g.DrawString(leaderName, bigFont, blackBrush, x, y);

            x += 55;

            double d = Convert.ToDouble(parts[1]);
            g.DrawString(FormatPercentage(d), drawFont, PercentageBrush(d), x, y + 20);

            x += 90;

            int estateThreshold = Convert.ToInt32(parts[2].Split('-')[0].Replace("e",""));
            int duchyThreshold = Convert.ToInt32(parts[2].Split('-')[1].Replace("d", ""));
            int provinceThreshold = Convert.ToInt32(parts[2].Split('-')[2].Replace("p", ""));

            if (prosperity)
            {
                Image template = Bitmap.FromFile("data/prosperityBuyTemplate.png");
                double ratio = (double)template.Height / (double)template.Width;
                g.DrawImage(template, new Rectangle(x, y, 120, (int)(120.0 * ratio)), new Rectangle(0, 0, template.Width, template.Height), GraphicsUnit.Pixel);
                template.Dispose();

                int yOffset = -3;
                int ySpacing = 21;
                g.DrawString(estateThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset);
                g.DrawString(duchyThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset + ySpacing);
                g.DrawString(provinceThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset + ySpacing * 2);
            }
            else
            {
                Image template = Bitmap.FromFile("data/coreBuyTemplate.png");
                double ratio = (double)template.Height / (double)template.Width;
                g.DrawImage(template, new Rectangle(x, y, 120, (int)(120.0 * ratio)), new Rectangle(0, 0, template.Width, template.Height), GraphicsUnit.Pixel);
                template.Dispose();

                int yOffset = 1;
                int ySpacing = 31;
                g.DrawString(estateThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset);
                g.DrawString(duchyThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset + ySpacing);
            }

            x += 145;

            String[] cardParts = parts[2].Split('-')[3].Split('|');
            for (int cardIndex = 0; cardIndex < cardParts.Length; cardIndex++)
            {
                Card c = database.GetCard(cardParts[cardIndex].Split('@')[0]);
                int count = Convert.ToInt32(cardParts[cardIndex].Split('@')[1]);
                if (c.fullImage == null) c.LoadBitmaps();
                double croppedCardRatio = 252.0 / 296.0;

                int yOffset = 0;
                if (c.set == "core") yOffset = 116;
                g.DrawImage(c.fullImage, new Rectangle(x + cardIndex * 80, y, (int)75.0, (int)(75.0 * croppedCardRatio)), new Rectangle(0, yOffset, c.fullImage.Width, 252), GraphicsUnit.Pixel);

                //if (count > 1 && count < 99)
                if (count > 1)
                {
                    int xOffset = 25;
                    if(count >= 10) xOffset = 17;
                    g.DrawString("x" + count.ToString(), smallFont, blackBrush, x + cardIndex * 80 + xOffset, y + 59);
                }
            }
        }