Files
OldThink/Content.Client/SurveillanceCamera/UI/SurveillanceCameraNavMapControl.cs
RedBurningPhoenix 3ed0f2c4bb SUPER CAMERA(OCHKO) (#501)
* SUPER CAMERA(OCHKO)

* Удобный монитор камер и портативный мониторинг для детектива. (#25)

* Улучшение мониторинга камер

* Портативный монитор камер для дека

* чейнжлог

* Revert "Удобный монитор камер и портативный мониторинг для детектива. (#25)"

This reverts commit adf35bb8f6ddd6256b18841a81b330224ebff103.

* Revert "Revert "Удобный монитор камер и портативный мониторинг для детектива. (#25)""

This reverts commit bd30fe45046b7b8508e8277f8c186d03338354cd.

* cleanups

* its so over

---------

Co-authored-by: Vigers Ray <60344369+VigersRay@users.noreply.github.com>
Co-authored-by: drdth <drdtheuser@gmail.com>
2024-07-27 18:47:27 +03:00

81 lines
2.3 KiB
C#

using Content.Client.Pinpointer.UI;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.SurveillanceCamera.UI;
public sealed partial class SurveillanceCameraNavMapControl : NavMapControl
{
public NetEntity? Focus;
public Dictionary<NetEntity, string> LocalizedNames = new();
private Label _trackedEntityLabel;
private PanelContainer _trackedEntityPanel;
public SurveillanceCameraNavMapControl()
{
WallColor = new Color(192, 122, 196);
TileColor = new(71, 42, 72);
BackgroundColor = Color.FromSrgb(TileColor.WithAlpha(BackgroundOpacity));
_trackedEntityLabel = new Label
{
Margin = new Thickness(10f, 8f),
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
Modulate = Color.White,
};
_trackedEntityPanel = new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = BackgroundColor,
},
Margin = new Thickness(5f, 45f),
HorizontalAlignment = HAlignment.Left,
VerticalAlignment = VAlignment.Bottom,
Visible = false,
};
_trackedEntityPanel.AddChild(_trackedEntityLabel);
AddChild(_trackedEntityPanel);
VerticalExpand = true;
VerticalAlignment = VAlignment.Stretch;
}
protected override void Draw(DrawingHandleScreen handle)
{
base.Draw(handle);
if (Focus == null)
{
_trackedEntityLabel.Text = string.Empty;
_trackedEntityPanel.Visible = false;
return;
}
foreach ((var netEntity, var blip) in TrackedEntities)
{
if (netEntity != Focus)
continue;
if (!LocalizedNames.TryGetValue(netEntity, out var name))
name = "Unknown";
var message = name + "\nLocation: [x = " + MathF.Round(blip.Coordinates.X) + ", y = " + MathF.Round(blip.Coordinates.Y) + "]";
_trackedEntityLabel.Text = message;
_trackedEntityPanel.Visible = true;
return;
}
_trackedEntityLabel.Text = string.Empty;
_trackedEntityPanel.Visible = false;
}
}