Exemplo n.º 1
0
        private void InitializePurchasePanel()
        {
            purchasePanel = FormUtils.GetTableLayoutPanel(1, 5);
            var i = 0;

            foreach (var hero in Game.CurrentLevel.AvailableHeroes)
            {
                var heroPurchase = FormUtils.GetButtonWithTextAndFontColor(
                    hero.Price.ToString(), Color.Black);
                heroPurchase.BackgroundImage       = ResourceManager.GetVisualObject(hero.Type).PassiveImage;
                heroPurchase.BackgroundImageLayout = ImageLayout.Zoom;
                heroPurchase.TextAlign             = ContentAlignment.BottomCenter;
                heroPurchase.Margin    = Padding.Empty;
                heroPurchase.FlatStyle = FlatStyle.Flat;
                heroPurchase.FlatAppearance.BorderColor = Color.Blue;
                heroPurchase.FlatAppearance.BorderSize  = 3;
                heroPurchase.Click += (sender, e) =>
                {
                    if (currentPurchaseButton != null)
                    {
                        currentPurchaseButton.FlatAppearance.BorderColor = Color.Blue;
                    }
                    currentPurchaseButton = heroPurchase;
                    currentPurchaseButton.FlatAppearance.BorderColor = Color.Green;
                    currentObjectToPurchase = hero;
                };
                purchasePanel.Controls.Add(heroPurchase, i++, 0);
            }
        }
Exemplo n.º 2
0
 private void SelectedHeroChanged(object sender, EventArgs e)
 {
     if (heroesList.SelectedItem != null)
     {
         currentDescribeObject = describeObjects[heroesList.SelectedItem.ToString()];
         var visualObject = gameForm.ResourceManager.GetVisualObject(currentDescribeObject.Type);
         heroLabel.BackgroundImage       = visualObject.PassiveImage;
         heroLabel.BackgroundImageLayout = ImageLayout.Zoom;
     }
     UpdateParametersList();
 }