[Tweak] Смешное с экономикой. (#451)

* tweak: цены продажи некоторых предметов понижены

* tweak: сервера РнД теперь не работают между гридами

* tweak: подняты цены в раздатчиках в среднем в два раза. А может больше

* tweak: тебя забыли

* add: добавим буквы
This commit is contained in:
Remuchi
2024-07-17 17:57:09 +07:00
committed by GitHub
parent a7d741c9ec
commit eeed240df0
42 changed files with 228 additions and 167 deletions

View File

@@ -1,12 +1,10 @@
using Content.Shared.Research.Components;
using Robust.Client.GameObjects;
namespace Content.Client.Research.UI
{
public sealed class ResearchClientBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private ResearchClientServerSelectionMenu? _menu;
[ViewVariables] private ResearchClientServerSelectionMenu? _menu;
public ResearchClientBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
@@ -36,7 +34,7 @@ namespace Content.Client.Research.UI
{
base.UpdateState(state);
if (state is not ResearchClientBoundInterfaceState rState) return;
_menu?.Populate(rState.ServerCount, rState.ServerNames, rState.ServerIds, rState.SelectedServerId);
_menu?.Populate(rState.ServerNames, rState.ServerIds, rState.SelectedServerId);
}
protected override void Dispose(bool disposing)

View File

@@ -8,9 +8,7 @@ namespace Content.Client.Research.UI
[GenerateTypedNameReferences]
public sealed partial class ResearchClientServerSelectionMenu : DefaultWindow
{
private int _serverCount;
private string[] _serverNames = Array.Empty<string>();
private int[] _serverIds = Array.Empty<int>();
private List<int> _serverIds = [];
private int _selectedServerId = -1;
private ResearchClientBoundUserInterface Owner { get; }
@@ -26,20 +24,18 @@ namespace Content.Client.Research.UI
Servers.OnItemDeselected += OnItemDeselected;
}
public void OnItemSelected(ItemList.ItemListSelectedEventArgs itemListSelectedEventArgs)
private void OnItemSelected(ItemList.ItemListSelectedEventArgs itemListSelectedEventArgs)
{
Owner.SelectServer(_serverIds[itemListSelectedEventArgs.ItemIndex]);
}
public void OnItemDeselected(ItemList.ItemListDeselectedEventArgs itemListDeselectedEventArgs)
private void OnItemDeselected(ItemList.ItemListDeselectedEventArgs itemListDeselectedEventArgs)
{
Owner.DeselectServer();
}
public void Populate(int serverCount, string[] serverNames, int[] serverIds, int selectedServerId)
public void Populate(List<string> serverNames, List<int> serverIds, int selectedServerId)
{
_serverCount = serverCount;
_serverNames = serverNames;
_serverIds = serverIds;
_selectedServerId = selectedServerId;
@@ -48,10 +44,12 @@ namespace Content.Client.Research.UI
Servers.OnItemDeselected -= OnItemDeselected;
Servers.Clear();
for (var i = 0; i < _serverCount; i++)
for (var i = 0; i < serverIds.Count; i++)
{
var id = _serverIds[i];
Servers.AddItem(Loc.GetString("research-client-server-selection-menu-server-entry-text", ("id", id), ("serverName", _serverNames[i])));
var id = serverIds[i];
var name = serverNames[i];
Servers.AddItem(Loc.GetString("research-client-server-selection-menu-server-entry-text", ("id", id),
("serverName", name)));
if (id == _selectedServerId)
{
Servers[i].Selected = true;

View File

@@ -38,6 +38,7 @@ public sealed partial class VendingMenu : DefaultWindow
return;
OnWithdraw?.Invoke(new VendingMachineWithdrawMessage());
};
VendingContents.RemoveAllChildren();
if (inventory.Count == 0)
{
@@ -45,6 +46,7 @@ public sealed partial class VendingMenu : DefaultWindow
SetSizeAfterUpdate(OutOfStockLabel.Text?.Length ?? 0);
return;
}
OutOfStockLabel.Visible = false;
var longestEntry = string.Empty;
@@ -65,14 +67,11 @@ public sealed partial class VendingMenu : DefaultWindow
if (itemName.Length > longestEntry.Length)
longestEntry = itemName;
var price = (int) (entry.Price * priceMultiplier);
var vendingItem = new VendingItem($"{itemName} [{entry.Amount}]", $"{price} ¢", icon);
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);
};
vendingItem.VendingItemBuyButton.OnPressed += _ => { OnItemSelected?.Invoke(j); };
VendingContents.AddChild(vendingItem);
}
@@ -85,4 +84,4 @@ public sealed partial class VendingMenu : DefaultWindow
SetSize = new Vector2(Math.Clamp((longestEntryLength + 10) * 12, 250, 700),
Math.Clamp(VendingContents.ChildCount * 50, 150, 400));
}
}
}