mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-06-09 10:06:43 +02:00
5168b5f3d4
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using System.Linq;
|
|
using Content.Shared.BarSign;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.BarSign.Ui;
|
|
|
|
[UsedImplicitly]
|
|
public sealed partial class BarSignBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey)
|
|
{
|
|
[Dependency] private IPrototypeManager _prototype = default!;
|
|
|
|
private BarSignMenu? _menu;
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
|
|
var allSigns = BarSignSystem.GetAllBarSigns(_prototype)
|
|
.OrderBy(p => Loc.GetString(p.Name))
|
|
.ToList();
|
|
|
|
_menu = this.CreateWindow<BarSignMenu>();
|
|
_menu.LoadSigns(allSigns);
|
|
|
|
_menu.OnSignSelected += id =>
|
|
{
|
|
SendPredictedMessage(new SetBarSignMessage(id));
|
|
};
|
|
|
|
_menu.OnClose += Close;
|
|
_menu.OpenToLeft();
|
|
}
|
|
|
|
public override void Update()
|
|
{
|
|
if (!EntMan.TryGetComponent<BarSignComponent>(Owner, out var signComp)
|
|
|| !_prototype.Resolve(signComp.Current, out var signPrototype))
|
|
return;
|
|
|
|
_menu?.UpdateState(signPrototype);
|
|
}
|
|
|
|
}
|
|
|