Esempio n. 1
0
        public void DrawDeck(Player player, TableLayoutPanel window, Color playerColor)
        {
            for (var i = 1; i < 7; i++)
            {
                var card = new TableLayoutPanel()
                {
                    Name      = "card" + i,
                    Dock      = DockStyle.Fill,
                    BackColor = player.Cursor == i - 1 ? playerColor : Color.Transparent,
                    Margin    = new Padding(0),
                    Padding   = new Padding(0)
                };
                card.RowStyles.Add(new RowStyle(SizeType.Percent, 50));
                card.RowStyles.Add(new RowStyle(SizeType.Percent, 50));
                card.Controls.Add(new Label
                {
                    Name        = "name",
                    Text        = player.Deck[i - 1].Description,
                    Dock        = DockStyle.Fill,
                    BackColor   = _game.CurrentPlayer.Deck[i - 1].Color,
                    Font        = new Font("Arial", 8, FontStyle.Bold),
                    MaximumSize = new Size(ClientSize.Width / 8 - 10, 0),
                    AutoSize    = true,
                    TextAlign   = ContentAlignment.MiddleCenter,
                    Margin      = new Padding(5, 5, 5, 0)
                }, 0, 0);

                var costsFormat = player.Deck[i - 1].Cost
                                  .Select(e => Tuple.Create(e.Key, $"{e.Key}: {e.Value}"))
                                  .ToList();
                var costs = LabelBuilder.CreateLabelList("costs", costsFormat, ContentAlignment.MiddleLeft,
                                                         new Font("Arial", 8, FontStyle.Bold), _game.CurrentPlayer.Deck[i - 1].Color);
                costs.Padding     = new Padding(0);
                costs.Margin      = new Padding(5, 0, 5, 5);
                costs.MaximumSize = new Size(ClientSize.Width / 8 - 10, 0);
                card.Controls.Add(costs, 0, 1);

                window.Controls.Add(card, i, 3);
            }
        }
Esempio n. 2
0
 public TableLayoutPanel DrawResources(string name, Dictionary <string, Resource> res, ContentAlignment align, Color bg)
 {
     return(LabelBuilder.CreateLabelList(name, res
                                         .Select(e => Tuple.Create(e.Key, $"{e.Key}:\n{e.Value.Count} (+{e.Value.Source})"))
                                         .ToList(), align, new Font("Arial", 12, FontStyle.Bold), bg));
 }