2021-06-21 02:13:54 +02:00
|
|
|
using Robust.Client.UserInterface.Controls;
|
2019-11-21 16:37:15 -08:00
|
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Localization;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Cargo.UI
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class GalacticBankSelectionMenu : DefaultWindow
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
2020-11-21 14:02:00 +01:00
|
|
|
private readonly ItemList _accounts;
|
2021-03-10 14:48:29 +01:00
|
|
|
private int _accountCount;
|
2021-10-22 11:53:18 +02:00
|
|
|
private string[] _accountNames = System.Array.Empty<string>();
|
|
|
|
|
private int[] _accountIds = System.Array.Empty<int>();
|
2019-11-21 16:37:15 -08:00
|
|
|
private int _selectedAccountId = -1;
|
|
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
public GalacticBankSelectionMenu(CargoConsoleBoundUserInterface owner)
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
2021-02-21 12:38:56 +01:00
|
|
|
MinSize = SetSize = (300, 300);
|
2019-11-21 16:37:15 -08:00
|
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
Title = Loc.GetString("galactic-bank-selection-menu-title");
|
2019-11-21 16:37:15 -08:00
|
|
|
|
2021-10-22 11:53:18 +02:00
|
|
|
_accounts = new ItemList { SelectMode = ItemList.ItemListSelectMode.Single };
|
2019-11-21 16:37:15 -08:00
|
|
|
|
2021-02-21 12:38:56 +01:00
|
|
|
Contents.AddChild(_accounts);
|
2019-11-21 16:37:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Populate(int accountCount, string[] accountNames, int[] accountIds, int selectedAccountId)
|
|
|
|
|
{
|
|
|
|
|
_accountCount = accountCount;
|
|
|
|
|
_accountNames = accountNames;
|
|
|
|
|
_accountIds = accountIds;
|
|
|
|
|
_selectedAccountId = selectedAccountId;
|
|
|
|
|
|
|
|
|
|
_accounts.Clear();
|
|
|
|
|
for (var i = 0; i < _accountCount; i++)
|
|
|
|
|
{
|
|
|
|
|
var id = _accountIds[i];
|
|
|
|
|
_accounts.AddItem($"ID: {id} || {_accountNames[i]}");
|
|
|
|
|
if (id == _selectedAccountId)
|
|
|
|
|
_accounts[id].Selected = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|