using Content.Client.UserInterface.Controls; using Content.Shared.BarSign; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.XAML; namespace Content.Client.BarSign.Ui; [GenerateTypedNameReferences] public sealed partial class BarSignMenu : FancyWindow { private List _cachedPrototypes = new(); public event Action? OnSignSelected; public BarSignMenu() { RobustXamlLoader.Load(this); SignOptions.OnItemSelected += idx => { OnSignSelected?.Invoke(_cachedPrototypes[idx.Id].ID); SignOptions.SelectId(idx.Id); }; } public void LoadSigns(List signs) { _cachedPrototypes.Clear(); _cachedPrototypes = signs; foreach (var proto in _cachedPrototypes) { SignOptions.AddItem(Loc.GetString(proto.Name)); } } public void UpdateState(BarSignPrototype newSign) { var idx = _cachedPrototypes.IndexOf(newSign); SignOptions.TrySelectId(idx); } }