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