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);
        }
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as MenuActionsControl;

            if (display.AvailableActions.Count > 1)
            {
                BLT.Font("text");
                BLTLayers.Set(BLTLayers.Text, display.ActivityIndex);

                BLT.Color(display.Color);

                var x = control.Position.X;
                var y = control.Position.Y;

                BLT.Print(x, y, "[[");
                x += BLT.Measure("[[").Width;

                foreach (var action in display.AvailableActions)
                {
                    if (action == display.SelectedAction)
                    {
                        BLT.Color(display.SelectedColor);
                    }
                    BLT.Print(x, y, action.ToString());
                    BLT.Color("");

                    x += BLT.Measure(action.ToString()).Width;
                    BLT.Print(x, y, "|");
                    x += BLT.Measure("|").Width;
                }

                x -= BLT.Measure("|").Width;
                BLT.Print(x, y, "]]");
            }
        }
        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("");
        }
예제 #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);
                        }
                    }
                }
            }
        }
예제 #5
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;

            var player = systemContainer.PlayerSystem.Player;

            var ac           = Math.Floor(systemContainer.EventSystem.GetStat(player, "AC"));
            var ev           = Math.Floor(systemContainer.EventSystem.GetStat(player, "EV"));
            var sh           = Math.Floor(systemContainer.EventSystem.GetStat(player, "SH"));
            var currentAegis = Math.Floor(systemContainer.EventSystem.GetStat(player, "CurrentAegisLevel"));
            var aegis        = Math.Floor(systemContainer.EventSystem.GetStat(player, "Aegis"));
            var aegisText    = $"{currentAegis}/{aegis}";
            var renderAegis  = aegis > 0;
            var tiltFighter  = player.Get <TiltFighter>();
            var brokenTicks  = tiltFighter.BrokenTicks;
            var broken       = brokenTicks > 0;

            if (broken)
            {
                BLT.Font("");
                BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
                RenderSpriteIfSpecified(x, y, spriteManager, "defence_broken", AnimationFrame.Idle0);

                BLTLayers.Set(BLTLayers.Text, control.ActivityIndex);
                BLT.Font("text");
                BLT.Print(x + 10, y + 2, $"DEFENCE BROKEN (Recovery: {100 - brokenTicks / 200}%)");
            }
            else
            {
                BLT.Font("");
                BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
                RenderSpriteIfSpecified(x, y, spriteManager, "AC", AnimationFrame.Idle0);
                RenderSpriteIfSpecified(x + 10, y, spriteManager, "SH", AnimationFrame.Idle0);
                RenderSpriteIfSpecified(x + 20, y, spriteManager, "EV", AnimationFrame.Idle0);
                if (renderAegis)
                {
                    var aegisSprite = currentAegis > 0 ? "aegis" : "aegis_none";
                    RenderSpriteIfSpecified(x + 30, y, spriteManager, aegisSprite, AnimationFrame.Idle0);
                }

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

                PrintTextCentered(ac.ToString(), x + 4, y + 2);
                PrintTextCentered(sh.ToString(), x + 4 + 10, y + 2);
                PrintTextCentered(ev.ToString(), x + 4 + 20, y + 2);
                if (renderAegis)
                {
                    PrintTextCentered(aegisText, x + 4 + 30, y + 2);
                }
            }
        }
예제 #6
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("");
        }
        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("");
        }
예제 #8
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);
            }
        }
예제 #9
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));
            }
        }
예제 #12
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);
        }
예제 #13
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;
            }
        }
예제 #14
0
        private void PrintTextCentered(string text, int x, int y)
        {
            var textWidth = BLT.Measure(text).Width;

            BLT.Print(x - textWidth / 2, y, text);
        }