Правочки
This commit is contained in:
@@ -15,11 +15,11 @@ namespace Content.Client.VendingMachines
|
||||
[ViewVariables]
|
||||
private List<int> _cachedFilteredIndex = new();
|
||||
|
||||
private VendingMachineComponent component = new();//WD edit
|
||||
private VendingMachineComponent component = new(); // WD edit
|
||||
public VendingMachineBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
@@ -54,13 +54,6 @@ namespace Content.Client.VendingMachines
|
||||
}
|
||||
// WD EDIT END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Client._White.Economy.Ui;
|
||||
public sealed partial class VendingMenu : DefaultWindow
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
|
||||
public event Action<int>? OnItemSelected;
|
||||
public Action<VendingMachineWithdrawMessage>? OnWithdraw;
|
||||
public string filter = "";
|
||||
@@ -22,11 +22,9 @@ public sealed partial class VendingMenu : DefaultWindow
|
||||
MinSize = SetSize = new Vector2(250, 150);
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
// SearchBar.OnTextChanged += UpdateFilter;
|
||||
// SearchBar.OnTextChanged += UpdateFilter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Populates the list of available items on the vending machine interface
|
||||
/// and sets icons based on their prototypes
|
||||
@@ -41,7 +39,7 @@ public sealed partial class VendingMenu : DefaultWindow
|
||||
return;
|
||||
OnWithdraw?.Invoke(new VendingMachineWithdrawMessage());
|
||||
};
|
||||
|
||||
|
||||
VendingContents.RemoveAllChildren();
|
||||
if (inventory.Count == 0)
|
||||
{
|
||||
@@ -58,7 +56,7 @@ public sealed partial class VendingMenu : DefaultWindow
|
||||
for (var i = 0; i < inventory.Count; i++)
|
||||
{
|
||||
var entry = inventory[i];
|
||||
|
||||
|
||||
var itemName = entry.ID;
|
||||
Texture? icon = null;
|
||||
if (_prototypeManager.TryIndex<EntityPrototype>(entry.ID, out var prototype))
|
||||
@@ -70,15 +68,15 @@ public sealed partial class VendingMenu : DefaultWindow
|
||||
if (itemName.Length > longestEntry.Length)
|
||||
longestEntry = itemName;
|
||||
|
||||
var price = (int)(entry.Price * priceMultiplier);
|
||||
var price = (int) (entry.Price * priceMultiplier);
|
||||
var vendingItem = new VendingItem($"{itemName} [{entry.Amount}]", price > 0 ? $"{price} \u00a2" : "выдать", icon);
|
||||
|
||||
var j = i;
|
||||
vendingItem.VendingItemBuyButton.OnPressed += _ => { OnItemSelected?.Invoke(j); };
|
||||
|
||||
|
||||
if(filter == "" || (prototype?.Name?.Contains(filter) == true)) //WD
|
||||
VendingContents.AddChild(vendingItem);
|
||||
if (filter == "" || (prototype?.Name?.Contains(filter) == true))
|
||||
VendingContents.AddChild(vendingItem);
|
||||
}
|
||||
|
||||
SetSizeAfterUpdate(longestEntry.Length);
|
||||
|
||||
Reference in New Issue
Block a user