diff --git a/Content.Client/VendingMachines/VendingMachineBoundUserInterface.cs b/Content.Client/VendingMachines/VendingMachineBoundUserInterface.cs index c3105c33a3..a4162593f9 100644 --- a/Content.Client/VendingMachines/VendingMachineBoundUserInterface.cs +++ b/Content.Client/VendingMachines/VendingMachineBoundUserInterface.cs @@ -15,10 +15,11 @@ namespace Content.Client.VendingMachines [ViewVariables] private List _cachedFilteredIndex = new(); + private VendingMachineComponent component = new();//WD edit public VendingMachineBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { } - + protected override void Open() { base.Open(); @@ -26,7 +27,7 @@ namespace Content.Client.VendingMachines var vendingMachineSys = EntMan.System(); // WD EDIT START - var component = EntMan.GetComponent(Owner); + component = EntMan.GetComponent(Owner); _cachedInventory = vendingMachineSys.GetAllInventory(Owner, component); _menu = new VendingMenu { Title = EntMan.GetComponent(Owner).EntityName }; @@ -34,6 +35,7 @@ namespace Content.Client.VendingMachines _menu.OnClose += Close; _menu.OnItemSelected += OnItemSelected; _menu.OnWithdraw += SendMessage; + _menu.SearchBar.OnTextChanged += UpdateFilter; // WD EDIT END _menu.Populate(_cachedInventory, component.PriceMultiplier, component.Credits); @@ -41,6 +43,24 @@ namespace Content.Client.VendingMachines _menu.OpenCenteredLeft(); } + // WD EDIT START + private void UpdateFilter(Robust.Client.UserInterface.Controls.LineEdit.LineEditEventArgs obj) + { + if (_menu != null) + { + _menu.filter = obj.Text; + _menu.Populate(_cachedInventory, component.PriceMultiplier, component.Credits); + } + } + // WD EDIT END + + + + + + + + protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); @@ -84,7 +104,7 @@ namespace Content.Client.VendingMachines private void OnSearchChanged(string? filter) { - //_menu?.Populate(_cachedInventory, out _cachedFilteredIndex, filter); + //_menu?.filter = (filter ?? ""); } } } diff --git a/Content.Client/_White/Economy/Ui/VendingMenu.xaml b/Content.Client/_White/Economy/Ui/VendingMenu.xaml index ed32cf30aa..bd6991b3b6 100644 --- a/Content.Client/_White/Economy/Ui/VendingMenu.xaml +++ b/Content.Client/_White/Economy/Ui/VendingMenu.xaml @@ -1,4 +1,7 @@ - + + + +