Exemplo n.º 1
0
        private void RenderMapShade(ISpriteManager spriteManager, bool[,] renderTracker, bool[,] fovTracker, int renderWidth, int renderHeight, BLTMapRendererOffset[,,] offsetTracker, IDataRogueControl mapConfiguration)
        {
            var shadeSprite = spriteManager.Get("shade");

            BLTLayers.Set(BLTLayers.MapShade, mapConfiguration.ActivityIndex);
            BLT.Font("");
            BLT.Color(Color.White);

            for (int x = 0; x < renderWidth; x++)
            {
                for (int y = 0; y < renderHeight; y++)
                {
                    if (renderTracker[x + 1, y + 1])
                    {
                        var offsetX = (int)Math.Floor(offsetTracker[x + 1, y + 1, 0].OffsetX * BLTTilesIOSystem.TILE_SPACING);
                        var offsetY = (int)Math.Floor(offsetTracker[x + 1, y + 1, 0].OffsetY * BLTTilesIOSystem.TILE_SPACING);

                        if (!fovTracker[x + 1, y + 1])
                        {
                            var sprite = shadeSprite.Tile(TileDirections.None);
                            BLT.Put(mapConfiguration.Position.Left + x * BLTTilesIOSystem.TILE_SPACING + offsetX, mapConfiguration.Position.Top + y * BLTTilesIOSystem.TILE_SPACING + offsetY, sprite);
                        }
                        else
                        {
                            var aboveConnect = (fovTracker[x + 1, y]);
                            var belowConnect = (fovTracker[x + 1, y + 2]);
                            var leftConnect  = (fovTracker[x, y + 1]);
                            var rightConnect = (fovTracker[x + 2, y + 1]);

                            var directions = TileDirections.None;
                            if (aboveConnect)
                            {
                                directions |= TileDirections.Up;
                            }
                            if (belowConnect)
                            {
                                directions |= TileDirections.Down;
                            }
                            if (leftConnect)
                            {
                                directions |= TileDirections.Left;
                            }
                            if (rightConnect)
                            {
                                directions |= TileDirections.Right;
                            }

                            var sprite = shadeSprite.Tile(directions);



                            BLT.Put(
                                mapConfiguration.Position.Left + x * BLTTilesIOSystem.TILE_SPACING + offsetX,
                                mapConfiguration.Position.Top + y * BLTTilesIOSystem.TILE_SPACING + offsetY,
                                sprite);
                        }
                    }
                }
            }
        }
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var messageLog = control as MessageLogControl;

            var numberOfMessages = messageLog.NumberOfMessages;

            BLTLayers.Set(BLTLayers.Text, control.ActivityIndex);
            BLT.Font("text");

            var messagesToRender = systemContainer.MessageSystem.RecentMessages(numberOfMessages);

            messagesToRender.Reverse();

            var x = control.Position.Left;
            var y = control.Position.Bottom;

            foreach (var message in messagesToRender)
            {
                var size = BLT.Measure(message.Text);
                y -= size.Height + 1;

                BLT.Color(message.Color);
                BLT.Print(x, y, message.Text);
            }

            BLT.Color("");
            BLT.Font("");
        }
        protected static void RenderEntityDetails(int x, int y, ShopItemControl display, IEntity shopItem, ISystemContainer systemContainer, ISpriteManager spriteManager)
        {
            BLT.Font("");
            SpriteAppearance appearance = shopItem.Has <SpriteAppearance>() ? shopItem.Get <SpriteAppearance>() : new SpriteAppearance {
                Bottom = "unknown"
            };
            AnimationFrame frame = shopItem.Has <Animated>() ? systemContainer.AnimationSystem.GetFrame(shopItem) : AnimationFrame.Idle0;
            Price          price = shopItem.Get <Price>();

            var playerWealth = systemContainer.ItemSystem.CheckWealth(systemContainer.PlayerSystem.Player, price.Currency);

            var canAfford = playerWealth >= price.Amount;

            BLTLayers.Set(BLTLayers.UIElementPieces, display.ActivityIndex);
            string appearanceBottom = appearance.Bottom;

            RenderSpriteIfSpecified(x + 4 + BLTTilesIOSystem.TILE_SPACING * 2, y + 4, spriteManager, appearanceBottom, frame);

            BLTLayers.Set(BLTLayers.UIElementPieces + 1, display.ActivityIndex);
            string appearanceTop = appearance.Top;

            RenderSpriteIfSpecified(x + 4 + BLTTilesIOSystem.TILE_SPACING * 2, y + 4, spriteManager, appearanceTop, frame);

            BLTLayers.Set(BLTLayers.Text, display.ActivityIndex);
            BLT.Font("text");
            BLT.Print(new Rectangle(x + 2, y + BLTTilesIOSystem.TILE_SPACING * 2 + 2, 6 * BLTTilesIOSystem.TILE_SPACING, 10), ContentAlignment.TopCenter, shopItem.GetBLTName());
            BLT.Color(canAfford ? Color.Gold : Color.Gray);
            BLT.Print(new Rectangle(x + 2, y + BLTTilesIOSystem.TILE_SPACING * 2 + 12, 6 * BLTTilesIOSystem.TILE_SPACING, 10), ContentAlignment.TopCenter, $"{price.Amount} {price.Currency}");
            BLT.Color(Color.White);
        }
Exemplo n.º 4
0
        private void RenderMapParticles(ISystemContainer systemContainer, bool[,] renderTracker, bool[,] fovTracker, List <IEntity>[,] particlesTracker, int renderWidth, int renderHeight, IDataRogueControl mapConfiguration)
        {
            BLTLayers.Set(BLTLayers.MapParticles, mapConfiguration.ActivityIndex);
            BLT.Font("text");

            for (int x = 0; x < renderWidth; x++)
            {
                for (int y = 0; y < renderHeight; y++)
                {
                    if (renderTracker[x + 1, y + 1] && fovTracker[x + 1, y + 1] && particlesTracker[x + 1, y + 1].Any())
                    {
                        foreach (var particle in particlesTracker[x + 1, y + 1])
                        {
                            var textParticle = particle.Get <TextParticle>();
                            BLT.Color(textParticle.Color);

                            var moving  = particle.TryGet <Moving>();
                            var offsetX = (int)Math.Floor((moving?.OffsetX ?? 0) * BLTTilesIOSystem.TILE_SPACING);
                            var offsetY = (int)Math.Floor((moving?.OffsetY ?? 0) * BLTTilesIOSystem.TILE_SPACING);

                            BLT.Print(
                                (int)(mapConfiguration.Position.Left + x * BLTTilesIOSystem.TILE_SPACING + offsetX),
                                (int)(mapConfiguration.Position.Top + y * BLTTilesIOSystem.TILE_SPACING + offsetY),
                                textParticle.Text);
                        }
                    }
                }
            }
        }
        private static void RenderBarFillMask(int x, int y, ISpriteManager spriteManager, int totalLength, decimal percentage, Color color, IDataRogueControl display)
        {
            BLTLayers.Set(BLTLayers.UIMasks, display.ActivityIndex);
            BLT.Color(color);
            var mask_main = spriteManager.Tile("bar_fill_mask");

            RenderBarContent(x, y, totalLength, percentage, mask_main, mask_main, mask_main, mask_main);
            BLT.Color("");
        }
        private static void RenderBarFill(int x, int y, ISpriteManager spriteManager, int totalLength, decimal percentage, IDataRogueControl display)
        {
            BLTLayers.Set(BLTLayers.UIElementPieces, display.ActivityIndex);
            var bar_left       = spriteManager.Tile("bar_left");
            var bar_fill       = spriteManager.Tile("bar_fill");
            var bar_full_right = spriteManager.Tile("bar_full_right");
            var bar_right      = spriteManager.Tile("bar_right");

            RenderBarContent(x, y, totalLength, percentage, bar_left, bar_fill, bar_full_right, bar_right);
        }
Exemplo n.º 7
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as MenuSelectorControl;
            var baseX   = control.Position.Left;
            var y       = control.Position.Top;
            var sprite  = spriteManager.Get(display.Direction == TileDirections.Left ? "selector_left" : "selector_right");

            BLTLayers.Set(BLTLayers.UIElementPieces, display.ActivityIndex);
            BLT.Font("");
            BLT.PutExt(baseX, y, 0, -1, sprite.Tile(display.Direction));
        }
Exemplo n.º 8
0
        protected static void RenderText(int x, int y, int activityIndex, out Size textSize, string text, Color color, bool updateY = true, string font = "text")
        {
            BLTLayers.Set(BLTLayers.Text, activityIndex);
            BLT.Font(font);
            BLT.Color(color);
            BLT.Print(x, y, text);
            textSize         = BLT.Measure(text);
            textSize.Height += 1;

            BLT.Color("");
        }
        private static void RenderBarContainer(int x, int y, ISpriteManager spriteManager, int totalLength, IDataRogueControl display)
        {
            BLTLayers.Set(BLTLayers.UIElements, display.ActivityIndex);
            BLT.Put(x, y, spriteManager.Tile("bar_container_left"));

            for (int i = 4; i < totalLength - 6; i += 2)
            {
                BLT.Put(x + i, y, spriteManager.Tile("bar_container_mid"));
            }

            BLT.Put(x + totalLength - 4 - 4, y, spriteManager.Tile("bar_container_right"));
        }
Exemplo n.º 10
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as IDataRogueInfoControl;
            var text    = display.Parameters;

            BLT.Font("textLarge");

            BLTLayers.Set(BLTLayers.Text, display.ActivityIndex);
            BLT.Color(display.Color);
            BLT.Print(display.Position.X, display.Position.Y, text);

            BLT.Color("");
        }
Exemplo n.º 11
0
        protected static void RenderBackgroundBox(int x, int y, int activityIndex, Size size, ISpriteManager spriteManager, string spriteName = "textbox_blue")
        {
            BLTLayers.Set(BLTLayers.UIElements, activityIndex);
            BLT.Font("");
            var width  = size.Width / BLTTilesIOSystem.TILE_SPACING;
            var height = size.Height / BLTTilesIOSystem.TILE_SPACING;

            var spriteSheet = spriteManager.Get(spriteName);

            for (int xCoord = 0; xCoord < width; xCoord++)
            {
                for (int yCoord = 0; yCoord < height; yCoord++)
                {
                    BLT.Put(x + xCoord * BLTTilesIOSystem.TILE_SPACING, y + yCoord * BLTTilesIOSystem.TILE_SPACING, spriteSheet.Tile(BLTTileDirectionHelper.GetDirections(xCoord, width, yCoord, height)));
                }
            }
        }
Exemplo n.º 12
0
 protected static void RenderEntitySprite(int x, int y, IDataRogueControl display, ISystemContainer systemContainer, ISpriteManager spriteManager, IEntity entity)
 {
     if (entity != null)
     {
         BLT.Font("");
         SpriteAppearance appearance = entity.Has <SpriteAppearance>() ? entity.Get <SpriteAppearance>() : new SpriteAppearance {
             Bottom = "unknown"
         };
         AnimationFrame frame = entity.Has <Animated>() ? systemContainer.AnimationSystem.GetFrame(entity) : AnimationFrame.Idle0;
         BLTLayers.Set(BLTLayers.UIElementPieces, display.ActivityIndex);
         string appearanceBottom = appearance.Bottom;
         RenderSpriteIfSpecified(x, y, spriteManager, appearanceBottom, frame);
         BLTLayers.Set(BLTLayers.UIElementPieces + 1, display.ActivityIndex);
         string appearanceTop = appearance.Top;
         RenderSpriteIfSpecified(x, y, spriteManager, appearanceTop, frame);
     }
 }
Exemplo n.º 13
0
        private void RenderMapSprites(
            ISpriteManager spriteManager, IDataRogueControl mapConfiguration,
            bool[,] renderTracker, int renderWidth, int renderHeight,
            SpriteAppearance[,,] tilesTracker, AnimationFrame[,,] frameTracker, BLTMapRendererOffset[,,] offsetTracker,
            int z, bool top)
        {
            if (z == 0)
            {
                BLTLayers.Set(top ? BLTLayers.MapTileTop : BLTLayers.MapTileBottom, mapConfiguration.ActivityIndex);
            }
            else
            {
                BLTLayers.Set(top ? BLTLayers.MapEntityTop : BLTLayers.MapEntityBottom, mapConfiguration.ActivityIndex);
            }

            BLT.Font("");
            BLT.Color(Color.White);

            for (int x = 0; x < renderWidth; x++)
            {
                for (int y = 0; y < renderHeight; y++)
                {
                    if (renderTracker[x + 1, y + 1])
                    {
                        var appearance = tilesTracker[x + 1, y + 1, z];
                        var frame      = frameTracker[x + 1, y + 1, z];
                        if (appearance != null)
                        {
                            var spriteName = top ? appearance.Top : appearance.Bottom;
                            if (spriteName != null)
                            {
                                TileDirections directions = BLTTileDirectionHelper.GetDirections(tilesTracker, x + 1, y + 1, z, top);
                                var            sprite     = spriteManager.Tile(spriteName, directions, frame);
                                var            offsetX    = (int)Math.Floor(offsetTracker[x + 1, y + 1, z].OffsetX * BLTTilesIOSystem.TILE_SPACING);
                                var            offsetY    = (int)Math.Floor(offsetTracker[x + 1, y + 1, z].OffsetY * BLTTilesIOSystem.TILE_SPACING);
                                BLT.Put(
                                    mapConfiguration.Position.Left + x * BLTTilesIOSystem.TILE_SPACING + offsetX,
                                    mapConfiguration.Position.Top + y * BLTTilesIOSystem.TILE_SPACING + offsetY,
                                    sprite);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 14
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
            BLT.Font("");
            var sprite = spriteManager.Tile("minimap_tile");

            var cameraPosition = systemContainer.RendererSystem.CameraPosition;
            var currentMap     = systemContainer.MapSystem.MapCollection[cameraPosition.Key];
            var cameraX        = cameraPosition.X;
            var cameraY        = cameraPosition.Y;

            var maxX = control.Position.Width;
            var maxY = control.Position.Height;

            int offsetX = maxX / 2;
            int offsetY = maxY / 2;

            for (int x = 0; x < maxX; x++)
            {
                for (int y = 0; y < maxY; y++)
                {
                    var lookupX = cameraX - offsetX + x;
                    var lookupY = cameraY - offsetY + y;

                    Color color;
                    if (x == 0 || y == 0 || x == maxX - 1 || y == maxY - 1)
                    {
                        color = Color.SaddleBrown;
                    }
                    else
                    {
                        MapCoordinate coordinate = new MapCoordinate(currentMap.MapKey, lookupX, lookupY);
                        var           isInFov    = playerFov.Contains(coordinate);
                        color = DetermineMapColor(systemContainer, coordinate, currentMap, isInFov);
                    }

                    if (color != Color.Transparent)
                    {
                        BLT.Color(color);
                        BLT.Put(control.Position.Left + x * BLTTilesIOSystem.TILE_SPACING / 8, control.Position.Top + y * BLTTilesIOSystem.TILE_SPACING / 8, sprite);
                    }
                }
            }
        }
Exemplo n.º 15
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var x       = control.Position.X;
            var y       = control.Position.Y;
            var display = control as IDataRogueInfoControl;

            List <IEntity> interactables = systemContainer.InteractableSystem.GetInteractablesNear(systemContainer.PlayerSystem.Player);

            if (interactables.Any())
            {
                var possibleInteractions = interactables
                                           .SelectMany(e => e.Components.OfType <Interaction>()
                                                       .Select(i => new { Entity = e, Interactable = i }));

                (IEntity, Interaction)currentInteraction = systemContainer.InteractableSystem.GetCurrentInteractionFor(systemContainer.PlayerSystem.Player);

                var interactEntity = currentInteraction.Item1;
                var interactable   = currentInteraction.Item2;

                BLT.Font("");
                SpriteAppearance appearance = interactEntity.Has <SpriteAppearance>() ? interactEntity.Get <SpriteAppearance>() : new SpriteAppearance {
                    Bottom = "unknown"
                };
                AnimationFrame frame = interactEntity.Has <Animated>() ? systemContainer.AnimationSystem.GetFrame(interactEntity) : AnimationFrame.Idle0;

                BLTLayers.Set(BLTLayers.UIElementPieces, display.ActivityIndex);
                string appearanceBottom = appearance.Bottom;
                RenderSpriteIfSpecified(x + 4, y + 4, spriteManager, appearanceBottom, frame);

                BLTLayers.Set(BLTLayers.UIElementPieces + 1, display.ActivityIndex);
                string appearanceTop = appearance.Top;
                RenderSpriteIfSpecified(x + 4, y + 4, spriteManager, appearanceTop, frame);

                BLTLayers.Set(BLTLayers.Text, display.ActivityIndex);
                BLT.Font("text");
                BLT.Color(Color.LightBlue);
                BLT.Print(x + BLTTilesIOSystem.TILE_SPACING + 6, y + BLTTilesIOSystem.TILE_SPACING / 2, interactable.Verb);
                BLT.Color(Color.White);
                BLT.Print(x + BLTTilesIOSystem.TILE_SPACING + 6, y + 4 + BLTTilesIOSystem.TILE_SPACING / 2, interactEntity.DescriptionName);

                RenderBackgroundBox(x, y, display.ActivityIndex, control.Position.Size, spriteManager);
            }
        }
Exemplo n.º 16
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display     = control as ButtonControl;
            var x           = control.Position.X;
            var y           = control.Position.Y;
            var pressed     = control.IsPressed;
            var focused     = control.IsFocused;
            var spriteSheet = focused ? spriteManager.Get("button_pressed") : spriteManager.Get("button_unpressed");

            BLT.Font("text");

            var textSize   = BLT.Measure(display.Text).Width;
            var buttonSize = textSize + 4;

            if (buttonSize % 8 != 0)
            {
                buttonSize = (buttonSize / 8 + 1) * 8;
            }

            var numberOfTiles = buttonSize / 8;

            BLT.Font("");
            BLTLayers.Set((int)BLTLayers.UIElements, control.ActivityIndex);
            for (int i = 0; i < numberOfTiles; i++)
            {
                TileDirections direction = TileDirections.None;
                if (i != 0)
                {
                    direction |= TileDirections.Left;
                }

                if (i != numberOfTiles - 1)
                {
                    direction |= TileDirections.Right;
                }

                BLT.Put(x + 8 * i, y, spriteSheet.Tile(direction));
            }

            BLT.Font("text");
            BLTLayers.Set((int)BLTLayers.Text, control.ActivityIndex);
            BLT.Print(x + buttonSize / 2 - textSize / 2, y + (focused ? 3 : 2), display.Text);
        }
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var x    = control.Position.X;
            var y    = control.Position.Y;
            var text = (control as TextFormData).Value.ToString();

            var spriteSheet = spriteManager.Get(control.IsFocused ? "textbox_white_small" : "textbox_grey_small");

            BLTLayers.Set(BLTLayers.Text, control.ActivityIndex);
            BLT.Font("text");

            BLT.Print(x + 4, y, text);

            var textSize = BLT.Measure(new String('@', 30));

            var textBoxSize = textSize.Width + 4;

            if (textBoxSize % TILE_SIZE != 0)
            {
                textBoxSize = (textBoxSize / TILE_SIZE + 1) * TILE_SIZE;
            }

            var numberOfTiles = textBoxSize / TILE_SIZE;

            BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
            BLT.Font("");

            for (int i = 0; i < numberOfTiles; i++)
            {
                TileDirections direction = TileDirections.None;
                if (i != 0)
                {
                    direction |= TileDirections.Left;
                }

                if (i != numberOfTiles - 1)
                {
                    direction |= TileDirections.Right;
                }

                BLT.PutExt(x + TILE_SIZE * i, y - 2, 0, -2, spriteSheet.Tile(direction));
            }
        }
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as MultipleChoiceFormData;
            var x       = control.Position.X;
            var y       = control.Position.Y;

            BLT.Font("text");
            var text     = display.Value.ToString();
            var textSize = BLT.Measure(text);

            BLT.Print(x + 10, y, text);

            if (control.IsFocused)
            {
                BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
                BLT.Font("");
                BLT.Put(x, y - 2, spriteManager.Tile("ui_arrow", TileDirections.Left));
                BLT.Put(x + textSize.Width + 12, y - 2, spriteManager.Tile("ui_arrow", TileDirections.Right));
            }
        }
        private static void RenderLayer(int layer, IDataRogueControl control, ISpriteSheet sprite, int renderWidth, int renderHeight, bool[,] checks)
        {
            BLTLayers.Set(layer, control.ActivityIndex);

            for (int y = 0; y < renderHeight; y++)
            {
                for (int x = 0; x < renderWidth; x++)
                {
                    if (checks[x + 1, y + 1])
                    {
                        var renderX = control.Position.Left + x * BLTTilesIOSystem.TILE_SPACING;
                        var renderY = control.Position.Top + y * BLTTilesIOSystem.TILE_SPACING;

                        var aboveConnect = checks[x + 1, y + 1] == checks[x + 1, y];
                        var belowConnect = checks[x + 1, y + 1] == checks[x + 1, y + 2];
                        var leftConnect  = checks[x + 1, y + 1] == checks[x, y + 1];
                        var rightConnect = checks[x + 1, y + 1] == checks[x + 2, y + 1];

                        var directions = TileDirections.None;
                        if (aboveConnect)
                        {
                            directions |= TileDirections.Up;
                        }
                        if (belowConnect)
                        {
                            directions |= TileDirections.Down;
                        }
                        if (leftConnect)
                        {
                            directions |= TileDirections.Left;
                        }
                        if (rightConnect)
                        {
                            directions |= TileDirections.Right;
                        }

                        BLT.Put(renderX, renderY, sprite.Tile(directions));
                    }
                }
            }
        }
Exemplo n.º 20
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl display, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var x            = display.Position.Left;
            var y            = display.Position.Top;
            var statsControl = (display as IDataRogueInfoControl);
            var entity       = statsControl.Entity;

            BLT.Font("");

            BLTLayers.Set(BLTLayers.MapTileBottom, statsControl.ActivityIndex);
            var boxSprite = spriteManager.Get("textbox_grey");

            BLT.Put(x, y, boxSprite.Tile(TileDirections.Down | TileDirections.Right));
            BLT.Put(x + BLTTilesIOSystem.TILE_SPACING, y, boxSprite.Tile(TileDirections.Down | TileDirections.Left));
            BLT.Put(x, y + BLTTilesIOSystem.TILE_SPACING, boxSprite.Tile(TileDirections.Up | TileDirections.Right));
            BLT.Put(x + BLTTilesIOSystem.TILE_SPACING, y + BLTTilesIOSystem.TILE_SPACING, boxSprite.Tile(TileDirections.Up | TileDirections.Left));

            var appearance = entity.Has <SpriteAppearance>() ? entity.Get <SpriteAppearance>() : new SpriteAppearance {
                Top = "unknown"
            };

            if (!string.IsNullOrEmpty(appearance.Bottom))
            {
                BLTLayers.Set(BLTLayers.MapEntityBottom, statsControl.ActivityIndex);
                BLT.Put(x + 4, y + 4, spriteManager.Tile(appearance.Bottom));
            }
            if (!string.IsNullOrEmpty(appearance.Top))
            {
                BLTLayers.Set(BLTLayers.MapEntityTop, statsControl.ActivityIndex);
                BLT.Put(x + 4, y + 4, spriteManager.Tile(appearance.Top));
            }

            BLTLayers.Set(BLTLayers.Text, statsControl.ActivityIndex);

            var text = $"{entity.GetBLTName()}";

            y += 5;
            RenderText(x + 18, y, statsControl.ActivityIndex, out _, text, statsControl.Color, false, font: "textLarge");
            y += 13;
        }
Exemplo n.º 21
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var backgroundSpriteSheet = spriteManager.Get("textbox_blue");

            BLTLayers.Set(BLTLayers.Background, control.ActivityIndex);
            BLT.Font("");

            var width  = (int)Math.Ceiling(control.Position.Width / (double)BLTTilesIOSystem.TILE_SPACING);
            var height = (int)Math.Ceiling(control.Position.Height / (double)BLTTilesIOSystem.TILE_SPACING);

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    TileDirections directions = BLTTileDirectionHelper.GetDirections(x, width, y, height);

                    var sprite = backgroundSpriteSheet.Tile(directions);

                    BLT.Put(control.Position.Left + x * BLTTilesIOSystem.TILE_SPACING, control.Position.Top + y * BLTTilesIOSystem.TILE_SPACING, sprite);
                }
            }
        }
Exemplo n.º 22
0
        protected static void RenderEntityDetails(int x, int y, IDataRogueInfoControl display, IEntity hoveredEntity, ISystemContainer systemContainer, ISpriteManager spriteManager)
        {
            BLT.Font("");
            SpriteAppearance appearance = hoveredEntity.Has <SpriteAppearance>() ? hoveredEntity.Get <SpriteAppearance>() : new SpriteAppearance {
                Bottom = "unknown"
            };
            AnimationFrame frame = hoveredEntity.Has <Animated>() ? systemContainer.AnimationSystem.GetFrame(hoveredEntity) : AnimationFrame.Idle0;

            BLTLayers.Set(BLTLayers.UIElementPieces, display.ActivityIndex);
            string appearanceBottom = appearance.Bottom;

            RenderSpriteIfSpecified(x + 2, y + 3, spriteManager, appearanceBottom, frame);

            BLTLayers.Set(BLTLayers.UIElementPieces + 1, display.ActivityIndex);
            string appearanceTop = appearance.Top;

            RenderSpriteIfSpecified(x + 2, y + 3, spriteManager, appearanceTop, frame);

            BLTLayers.Set(BLTLayers.Text, display.ActivityIndex);
            BLT.Font("text");
            BLT.Print(x + BLTTilesIOSystem.TILE_SPACING + 4, y - 1 + BLTTilesIOSystem.TILE_SPACING / 2, hoveredEntity.GetBLTName());

            y += 12;

            foreach (var split in display.Parameters.Split(';'))
            {
                var counter = GetCounter(split, hoveredEntity, out string counterText);
                if (counter != null)
                {
                    var text = $"{counterText}: {counter}";
                    RenderText(x + 4, y, display.ActivityIndex, out var textSize, text, display.Color);
                    y += 3;
                }
            }

            BLT.Font("text");
            BLT.Print(x + 4, y, hoveredEntity.Get <Description>().Detail);
        }
Exemplo n.º 23
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as StatsFormData;
            var x       = display.Position.X;
            var y       = display.Position.Y;

            var stats = display.Stats;

            var statTotal = $"[[{display.CurrentTotalStat.ToString().PadLeft(4)}/{display.MaxTotalStat.ToString().PadRight(4)}]]";

            BLT.Print(16 + x, y, statTotal);

            var longestStat = stats.Max(s => BLT.Measure(s.statName).Width);

            y += 4;

            foreach (var stat in stats)
            {
                var statSelected = display.SubSelection == stat.statName;

                BLT.Print(12, y, (stat.statName + ": ").PadRight(longestStat + 2));
                BLT.Print(12 + longestStat + 4, y, (statSelected ? "[color=red]" : "") + "-");
                BLT.Print(12 + longestStat + 8, y, stat.statValue.ToString().PadBoth(4));
                BLT.Print(12 + longestStat + 16, y, (statSelected ? "[color=green]" : "") + "+");

                if (statSelected)
                {
                    BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
                    BLT.Font("");
                    BLT.Put(6, y, spriteManager.Tile("selector_left", TileDirections.Left));
                    BLTLayers.Set(BLTLayers.Text, control.ActivityIndex);
                    BLT.Font("text");
                }

                y += 4;
            }
        }
Exemplo n.º 24
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as TargetingOverlayControl;
            var targetingActivityData = display.TargetingActivity;
            var targetingSprites      = new Dictionary <TargetingStatus, ISpriteSheet>
            {
                { TargetingStatus.Targetable, spriteManager.Get("targetable") },
                { TargetingStatus.Targeted, spriteManager.Get("current_target") }
            };

            BLTLayers.Set(BLTLayers.MapShade, control.ActivityIndex);
            BLT.Font("");

            var cameraPosition = systemContainer.RendererSystem.CameraPosition;

            var currentMap = systemContainer.MapSystem.MapCollection[cameraPosition.Key];
            var cameraX    = cameraPosition.X;
            var cameraY    = cameraPosition.Y;

            MapCoordinate playerPosition = systemContainer.PositionSystem.CoordinateOf(systemContainer.PlayerSystem.Player);

            var targetableCells = systemContainer.TargetingSystem.TargetableCellsFrom(targetingActivityData.TargetingData, playerPosition);

            var renderWidth  = control.Position.Width / BLTTilesIOSystem.TILE_SPACING;
            var renderHeight = control.Position.Height / BLTTilesIOSystem.TILE_SPACING;

            int offsetX = renderWidth / 2;
            int offsetY = renderHeight / 2;

            var sprites = new TargetingStatus[renderWidth + 2, renderHeight + 2];

            for (int y = 0; y < renderHeight; y++)
            {
                for (int x = 0; x < renderWidth; x++)
                {
                    var lookupX = cameraX - offsetX + x;
                    var lookupY = cameraY - offsetY + y;

                    var currentCell     = new MapCoordinate(currentMap.MapKey, lookupX, lookupY);
                    var targetingStatus = targetingActivityData.GetTargetingStatus(currentCell);

                    if (targetingStatus != TargetingStatus.NotTargeted)
                    {
                        sprites[x + 1, y + 1] = targetingStatus;
                    }
                }
            }

            for (int y = 0; y < renderHeight; y++)
            {
                for (int x = 0; x < renderWidth; x++)
                {
                    var targetingStatus = sprites[x + 1, y + 1];

                    if (targetingStatus != TargetingStatus.NotTargeted)
                    {
                        var renderX = control.Position.Left + x * BLTTilesIOSystem.TILE_SPACING;
                        var renderY = control.Position.Top + y * BLTTilesIOSystem.TILE_SPACING;

                        var aboveConnect = sprites[x + 1, y + 1] == sprites[x + 1, y];
                        var belowConnect = sprites[x + 1, y + 1] == sprites[x + 1, y + 2];
                        var leftConnect  = sprites[x + 1, y + 1] == sprites[x, y + 1];
                        var rightConnect = sprites[x + 1, y + 1] == sprites[x + 2, y + 1];

                        var directions = TileDirections.None;
                        if (aboveConnect)
                        {
                            directions |= TileDirections.Up;
                        }
                        if (belowConnect)
                        {
                            directions |= TileDirections.Down;
                        }
                        if (leftConnect)
                        {
                            directions |= TileDirections.Left;
                        }
                        if (rightConnect)
                        {
                            directions |= TileDirections.Right;
                        }

                        BLT.Put(renderX, renderY, targetingSprites[targetingStatus].Tile(directions));
                    }
                }
            }
        }