Пример #1
0
        private void CreateBuyButton(Vector2 position, string texture, ArmyPrice armyPrice)
        {
            IGameEntityFactory factory    = (IGameEntityFactory)Parent.Scene.EntityFactory;
            IMapService        mapService = Parent.Scene.ServiceProvider.GetService <IMapService>();

            var buyButton = factory.CreateBuyButton(position, new Vector2(mapService.Width * 0.085f), texture, () => BuyArmy(armyPrice));

            buyButton.AddChild(factory.CreateIngot(buyButton.Position - new Vector2(mapService.Width * 0.02f, mapService.Height * -0.1f), new Vector2(mapService.Width * 0.035f)));
            buyButton.AddChild(factory.CreateTextDisplay(buyButton.Position - new Vector2(mapService.Width * -0.01f, mapService.Height * -0.1f), new Vector2(mapService.Width * 0.035f), (int)armyPrice + string.Empty, Color.Black));
            buyButtons.Add(buyButton);
        }