public override IEntity EntityFromMouseData(IDataRogueControl control, ISystemContainer systemContainer, MouseData mouse) { var x = control.Position.X; var y = control.Position.Y; var display = control as IDataRogueInfoControl; var toolsOnBar = MapEditorActivity.GetToolbarControls().ToList(); var relativeX = mouse.X - x; var relativeY = mouse.Y - y; if (relativeY <= 1 || relativeY >= 10) { return(null); } var xFromLeftOfFirstFrame = relativeX - 2; var xIndex = xFromLeftOfFirstFrame / 12; var xFromLeftOfCurrentFrame = xFromLeftOfFirstFrame - xIndex * 12; if (IsInsideFrame(xFromLeftOfCurrentFrame)) { return(null); } if (xIndex >= 0 && xIndex < toolsOnBar.Count()) { return(toolsOnBar[xIndex].Entity); } return(null); }
protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as MenuActionsControl; if (display.AvailableActions.Count > 1) { var x = control.Position.X; var y = control.Position.Y; console.Print(x++, y, "[", control.Color.ToRLColor(), control.BackColor.ToRLColor()); foreach (var action in display.AvailableActions) { var foreColor = action == display.SelectedAction ? display.SelectedColor : control.Color; console.Print(x, y, action.ToString(), foreColor.ToRLColor(), control.BackColor.ToRLColor()); x += action.ToString().Length; console.Print(x, y, "|", control.Color.ToRLColor(), control.BackColor.ToRLColor()); x++; } x--; console.Print(x, y, "]", control.Color.ToRLColor(), control.BackColor.ToRLColor()); } }
protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var statsFormData = control as StatsFormData; var stats = statsFormData.Stats; var x = control.Position.X; var y = control.Position.Y; var foreColor = control.Color.ToRLColor(); console.Print(x + 5, y, "[ / ]", foreColor); console.Print(x + 7, y, statsFormData.CurrentTotalStat.ToString().PadLeft(4), foreColor); console.Print(x + 12, y, statsFormData.MaxTotalStat.ToString().PadRight(4), foreColor); y += 1; var longestStat = stats.Max(s => s.statName.Length); foreach (var stat in stats) { var statSelected = statsFormData.SubSelection == stat.statName; var statForeColor = statSelected ? RLColor.Cyan : RLColor.White; console.Print(2, y, (stat.statName + ": ").PadRight(longestStat + 2), statForeColor); console.Print(2 + longestStat + 2, y, "-", statSelected ? RLColor.Red : RLColor.White); console.Print(2 + longestStat + 4, y, stat.statValue.ToString().PadBoth(4), statForeColor); console.Print(2 + longestStat + 10, y, "+", statSelected ? RLColor.Green : RLColor.White); y += 1; } }
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 override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var mapConsole = new RLConsole(control.Position.Width, control.Position.Height); mapConsole.Clear(); var cameraPosition = systemContainer.RendererSystem.CameraPosition; var currentMap = systemContainer.MapSystem.MapCollection[cameraPosition.Key]; var cameraX = cameraPosition.X; var cameraY = cameraPosition.Y; var consoleWidth = mapConsole.Width; var consoleHeight = mapConsole.Height; int offsetX = consoleWidth / 2; int offsetY = consoleHeight / 2; for (int y = 0; y < consoleHeight; y++) { for (int x = 0; x < consoleWidth; x++) { var lookupX = cameraX - offsetX + x; var lookupY = cameraY - offsetY + y; MapRendererHelper.DrawCell(mapConsole, x, y, systemContainer.PositionSystem, currentMap, lookupX, lookupY, playerFov); } } RLConsole.Blit(mapConsole, 0, 0, mapConsole.Width, mapConsole.Height, console, control.Position.Left, control.Position.Top); }
protected override Size GetSizeInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as IDataRogueInfoControl; var enemiesInFov = GetEnemiesInFov(systemContainer, playerFov); return(new Size(display.Position.Width, enemiesInFov.Count * 2)); }
protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as IDataRogueInfoControl; var entity = display.Entity; console.Print(display.Position.X, display.Position.Y, entity.Get <Description>().Name, display.Color.ToRLColor(), display.BackColor.ToRLColor()); }
public override IEntity EntityFromMouseData(IDataRogueControl control, ISystemContainer systemContainer, MouseData mouse) { var x = control.Position.X; var y = control.Position.Y; var display = control as IDataRogueInfoControl; var skillsOnBar = GetSkillsOnBar(systemContainer); var relativeX = mouse.X - x; var relativeY = mouse.Y - y; if (relativeY <= 1 || relativeY >= 10) { return(null); } var xFromLeftOfFirstFrame = relativeX - 2; var xIndex = xFromLeftOfFirstFrame / 12; var xFromLeftOfCurrentFrame = xFromLeftOfFirstFrame - xIndex * 12; if (IsInsideFrame(xFromLeftOfCurrentFrame)) { return(null); } if (xIndex >= 0 && xIndex < skillsOnBar.Count()) { return(skillsOnBar[xIndex]); } return(null); }
protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as ButtonControl; var selected = display.IsFocused; var x = display.Position.X; var y = display.Position.Y; var text = display.Text; var foreColor = selected ? RLColor.Cyan : RLColor.White; console.Set(x, y, foreColor, RLColor.Black, 201); console.Set(x, y + 1, foreColor, RLColor.Black, 186); console.Set(x, y + 2, foreColor, RLColor.Black, 200); console.Set(x + text.Length + 1, y, foreColor, RLColor.Black, 187); console.Set(x + text.Length + 1, y + 1, foreColor, RLColor.Black, 186); console.Set(x + text.Length + 1, y + 2, foreColor, RLColor.Black, 188); for (int i = 0; i < text.Length; i++) { console.Set(x + i + 1, y, foreColor, RLColor.Black, 205); console.Set(x + i + 1, y + 2, foreColor, RLColor.Black, 205); } console.Print(x + 1, y + 1, text, foreColor, RLColor.Black); x += text.Length + 3; }
private static void RenderHighlightedCells(IDataRogueControl control, ISpriteSheet topSprite, ISpriteSheet bottomSprite, IMap currentMap, int cameraX, int cameraY, int renderWidth, int renderHeight, int offsetX, int offsetY, List <MapCoordinate> highlightedCells) { var checks = new bool[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); checks[x + 1, y + 1] = highlightedCells.Contains(currentCell); } } BLT.Color(Color.FromArgb(128, 255, 255, 255)); if (bottomSprite != null) { RenderLayer(BLTLayers.MapShade, control, bottomSprite, renderWidth, renderHeight, checks); } if (topSprite != null) { RenderLayer(BLTLayers.MapShade + 1, control, topSprite, renderWidth, renderHeight, checks); } }
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(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { IDataRogueInfoControl display = control as IDataRogueInfoControl; var x = control.Position.X; string interpolated = DataRogueInfoControl(control, systemContainer, out int y); console.Print(x, y, interpolated, display.Color.ToRLColor(), display.BackColor.ToRLColor()); }
protected override Size GetSizeInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as IDataRogueInfoControl; var lines = display.Parameters.Count(c => c == '\n') + 1; var longestLine = display.Parameters.Split('\n').Max(l => l.Length); return(new Size(longestLine, lines)); }
protected override Size GetSizeInternal(RLConsole console, IDataRogueControl display, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var entity = (display as IDataRogueInfoControl).Entity; var text = entity.Get <Description>().Detail; var lines = text.Count(c => c == '\n') + 1; var longestLine = text.Split('\n').Max(l => l.Length); return(new Size(longestLine, lines)); }
protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as IDataRogueInfoControl; var entity = display.Entity; var wealthType = display.Parameters; console.Print(display.Position.X, display.Position.Y, $"{wealthType}: {systemContainer.ItemSystem.CheckWealth(entity, wealthType)}", display.Color.ToRLColor(), display.BackColor.ToRLColor()); }
public bool Layout(object handle, IDataRogueControl display, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) { var console = handle as RLConsole; var size = GetSizeInternal(console, display, systemContainer, playerFov); display.Position = new Rectangle(boundingBox.Location, size); return(false); }
protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as LineControl; for (int i = 0; i < control.Position.Width; i++) { console.Set(control.Position.Left + i, control.Position.Top, control.Color.ToRLColor(), control.BackColor.ToRLColor(), 196); } }
protected override string GetText(IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as IDataRogueInfoControl; var entity = display.Entity; var wealthType = display.Parameters; return($"{wealthType}: {systemContainer.ItemSystem.CheckWealth(entity, wealthType)}"); }
protected override string GetText(IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as IDataRogueInfoControl; var entity = display.Entity; var stat = (int)systemContainer.EventSystem.GetStat(entity, display.Parameters); return($"{display.Parameters}: {stat}"); }
protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) { var display = control as MenuActionsControl; var text = $"[[{string.Join("|", display.AvailableActions.Select(a => a.ToString()))}]]"; BLT.Font("text"); var size = BLT.Measure(text); return(size); }
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); } } }
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)); }
protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as IDataRogueInfoControl; var experience = display.Entity.Get <Experience>(); var text1 = $"Level: {experience.Level}"; var text2 = $" XP: {experience.Amount}"; console.Print(control.Position.X, control.Position.Y, text1, display.Color.ToRLColor(), display.BackColor.ToRLColor()); console.Print(control.Position.X, control.Position.Y + 1, text2, display.Color.ToRLColor(), display.BackColor.ToRLColor()); }
protected override string GetText(IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as IDataRogueInfoControl; var entity = display.Entity; var interpolationSplits = display.Parameters.Split(','); var format = interpolationSplits[0]; var statValues = interpolationSplits.Skip(1).Select(s => systemContainer.EventSystem.GetStat(entity, s).ToString()).ToArray(); return(string.Format(format, statValues)); }
protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var display = control as IDataRogueInfoControl; var x = display.Position.X; var y = display.Position.Y; var entity = display.Entity; var statName = display.Parameters; console.Print(x, y, $"{statName}: {systemContainer.EventSystem.GetStat(entity, statName)}", display.Color.ToRLColor(), display.BackColor.ToRLColor()); }
protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) { var display = control as MultipleChoiceFormData; var text = display.Value.ToString(); BLT.Font("text"); var textSize = BLT.Measure(text); return(new Size(textSize.Width + 6, textSize.Height)); }
protected override void DisplayInternal(RLConsole console, IDataRogueControl display, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var y = display.Position.Y; var entity = (display as IDataRogueInfoControl).Entity; var appearance = entity.Has <Appearance>() ? entity.Get <Appearance>() : new Appearance { Color = Color.White, Glyph = '?' }; console.Print(1, y, appearance.Glyph.ToString(), appearance.Color.ToRLColor(), display.BackColor.ToRLColor()); console.Print(3, y, entity.Get <Description>().Name, display.Color.ToRLColor(), display.BackColor.ToRLColor()); }
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 ShopItemControl; var entity = display.Item; RenderBackgroundBox(x + BLTTilesIOSystem.TILE_SPACING * 2, y, control.ActivityIndex, new Size(BLTTilesIOSystem.TILE_SPACING * 2, BLTTilesIOSystem.TILE_SPACING * 2), spriteManager, display.Selected ? "textbox_blue_selected" : "textbox_blue"); RenderEntityDetails(x, y, display, entity, systemContainer, spriteManager); }
protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl display, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) { var statsControl = (display as IDataRogueInfoControl); var entity = statsControl.Entity; BLT.Font("textLarge"); var textSize = BLT.Measure(entity.GetBLTName()); BLT.Font(""); return(new Size(Math.Max(60, textSize.Width + 22), Height)); }
protected override string GetText(IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov) { var entity = (control as IDataRogueInfoControl)?.Entity; var mapName = systemContainer.PositionSystem.CoordinateOf(entity).Key.Key; if (mapName.StartsWith("Branch:")) { mapName = mapName.Substring(7); } return($"Location: {mapName}"); }