mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 21:48:58 +03:00
Removed all unused variables i could find, built and tested on a simple upstart and clicking trough most systems. Change Loc references to localization. <!-- This is default collapsed, readers click to expand it and see all your media The PR media section can get very large at times, so this is a good way to keep it clean The title is written using HTML tags The title must be within the <summary> tags or you won't see it --> <details><summary><h1>Media</h1></summary> <p> "using Robust.Shared.Prototypes;" to "" "[dependency] private readonly ISpriteComponent" to "" </p> </details> --- No CL this isn't player facing. --------- Co-authored-by: ilmenwe <no@mail.com>
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using Content.Shared.Pinpointer;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Map;
|
|
|
|
namespace Content.Client.Pinpointer.UI;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class StationMapBeaconControl : Control, IComparable<StationMapBeaconControl>
|
|
{
|
|
|
|
public readonly EntityCoordinates BeaconPosition;
|
|
public Action<EntityCoordinates>? OnPressed;
|
|
public string? Label => BeaconNameLabel.Text;
|
|
private StyleBoxFlat _styleBox;
|
|
public Color Color => _styleBox.BackgroundColor;
|
|
|
|
public StationMapBeaconControl(EntityUid mapUid, SharedNavMapSystem.NavMapBeacon beacon)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
BeaconPosition = new EntityCoordinates(mapUid, beacon.Position);
|
|
|
|
_styleBox = new StyleBoxFlat { BackgroundColor = beacon.Color };
|
|
ColorPanel.PanelOverride = _styleBox;
|
|
BeaconNameLabel.Text = beacon.Text;
|
|
|
|
MainButton.OnPressed += args => OnPressed?.Invoke(BeaconPosition);
|
|
}
|
|
|
|
public int CompareTo(StationMapBeaconControl? other)
|
|
{
|
|
if (other == null)
|
|
return 1;
|
|
|
|
// Group by color
|
|
var colorCompare = Color.ToArgb().CompareTo(other.Color.ToArgb());
|
|
if (colorCompare != 0)
|
|
{
|
|
return colorCompare;
|
|
}
|
|
|
|
// If same color, sort by text
|
|
return string.Compare(Label, other.Label);
|
|
}
|
|
}
|