* nasrano

* Add station budget & salary

* Initial balance

* Vending machine UI

* Pricing for vending machines

* Finish economy

* Eftpos

* Finish eftpos

* Put eftpos into lockers

* Vending machine prices

* Small fixes

* Fix atm UI

* Add atms to maps

* fix

* reset

* Add PDA program

* Maps again

---------

Co-authored-by: Mona Hmiza <>
Co-authored-by: rhailrake <49613070+rhailrake@users.noreply.github.com>
This commit is contained in:
Aviu00
2023-10-02 16:50:02 +09:00
committed by Aviu00
parent 707cdf3afa
commit 16c8b95da4
109 changed files with 2043 additions and 30 deletions

View File

@@ -2,13 +2,14 @@ using Content.Client.VendingMachines.UI;
using Content.Shared.VendingMachines;
using Robust.Client.UserInterface.Controls;
using System.Linq;
using Content.Client.White.Economy.Ui;
namespace Content.Client.VendingMachines
{
public sealed class VendingMachineBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private VendingMachineMenu? _menu;
private VendingMenu? _menu; // WD EDIT
[ViewVariables]
private List<VendingMachineInventoryEntry> _cachedInventory = new();
@@ -26,15 +27,18 @@ namespace Content.Client.VendingMachines
var vendingMachineSys = EntMan.System<VendingMachineSystem>();
_cachedInventory = vendingMachineSys.GetAllInventory(Owner);
// WD EDIT START
var component = EntMan.GetComponent<VendingMachineComponent>(Owner);
_cachedInventory = vendingMachineSys.GetAllInventory(Owner, component);
_menu = new VendingMachineMenu { Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName };
_menu = new VendingMenu { Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName };
_menu.OnClose += Close;
_menu.OnItemSelected += OnItemSelected;
_menu.OnSearchChanged += OnSearchChanged;
_menu.OnWithdraw += SendMessage;
// WD EDIT END
_menu.Populate(_cachedInventory, out _cachedFilteredIndex);
_menu.Populate(_cachedInventory, component.PriceMultiplier, component.Credits);
_menu.OpenCentered();
}
@@ -48,21 +52,23 @@ namespace Content.Client.VendingMachines
_cachedInventory = newState.Inventory;
_menu?.Populate(_cachedInventory, out _cachedFilteredIndex, _menu.SearchBar.Text);
_menu?.Populate(_cachedInventory, newState.PriceMultiplier, newState.Credits);
}
private void OnItemSelected(ItemList.ItemListSelectedEventArgs args)
// WD EDIT START
private void OnItemSelected(int index)
{
if (_cachedInventory.Count == 0)
return;
var selectedItem = _cachedInventory.ElementAtOrDefault(_cachedFilteredIndex.ElementAtOrDefault(args.ItemIndex));
var selectedItem = _cachedInventory.ElementAtOrDefault(index);
if (selectedItem == null)
return;
SendMessage(new VendingMachineEjectMessage(selectedItem.Type, selectedItem.ID));
}
// WD EDIT END
protected override void Dispose(bool disposing)
{
@@ -80,7 +86,7 @@ namespace Content.Client.VendingMachines
private void OnSearchChanged(string? filter)
{
_menu?.Populate(_cachedInventory, out _cachedFilteredIndex, filter);
//_menu?.Populate(_cachedInventory, out _cachedFilteredIndex, filter);
}
}
}