diff --git a/Content.Client/_DV/Shipyard/UI/ShipyardBoundUserInterface.cs b/Content.Client/_DV/Shipyard/UI/ShipyardBoundUserInterface.cs index 702009cbb19..1b25b17e39b 100644 --- a/Content.Client/_DV/Shipyard/UI/ShipyardBoundUserInterface.cs +++ b/Content.Client/_DV/Shipyard/UI/ShipyardBoundUserInterface.cs @@ -1,7 +1,6 @@ using Content.Shared.Access.Systems; using Content.Shared.Shipyard; using Content.Shared.Whitelist; -using Robust.Client.GameObjects; using Robust.Client.Player; using Robust.Shared.Prototypes; @@ -28,10 +27,14 @@ protected override void Open() { base.Open(); - _menu = new ShipyardConsoleMenu(Owner, _proto, EntMan, _player, _access, _whitelist); + if (_menu == null) + { + _menu = new ShipyardConsoleMenu(Owner, _proto, EntMan, _player, _access, _whitelist); + _menu.OnClose += Close; + _menu.OnPurchased += Purchase; + } + _menu.OpenCentered(); - _menu.OnClose += Close; - _menu.OnPurchased += Purchase; } protected override void UpdateState(BoundUserInterfaceState state) @@ -48,8 +51,16 @@ protected override void Dispose(bool disposing) { base.Dispose(disposing); - if (disposing) - _menu?.Dispose(); + if (!disposing) + return; + + if (_menu == null) + return; + + _menu.OnClose -= Close; + _menu.OnPurchased -= Purchase; + _menu.Close(); + _menu = null; } private void Purchase(string id) diff --git a/Content.Client/_DV/Shipyard/UI/ShipyardConsoleMenu.xaml b/Content.Client/_DV/Shipyard/UI/ShipyardConsoleMenu.xaml index 9eccd45b698..d5c7223f820 100644 --- a/Content.Client/_DV/Shipyard/UI/ShipyardConsoleMenu.xaml +++ b/Content.Client/_DV/Shipyard/UI/ShipyardConsoleMenu.xaml @@ -1,5 +1,4 @@ ? OnPurchased; - private readonly List _vessels = new(); - private readonly List _categories = new(); + private readonly List _vessels = []; + private readonly List _categories = []; public Entity Console; private string? _category; @@ -80,7 +78,7 @@ private void PopulateProducts() var search = SearchBar.Text.Trim().ToLowerInvariant(); foreach (var vessel in _vessels) { - if (search.Length != 0 && !vessel.Name.ToLowerInvariant().Contains(search)) + if (search.Length != 0 && !vessel.Name.Contains(search, StringComparison.InvariantCultureIgnoreCase)) continue; if (_category != null && !vessel.Categories.Contains(_category)) continue; diff --git a/Content.Client/_DV/Shipyard/UI/VesselRow.xaml b/Content.Client/_DV/Shipyard/UI/VesselRow.xaml index eac2d3a1bde..e01f33e2939 100644 --- a/Content.Client/_DV/Shipyard/UI/VesselRow.xaml +++ b/Content.Client/_DV/Shipyard/UI/VesselRow.xaml @@ -3,7 +3,7 @@ HorizontalExpand="True"> -