2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-06-09 22:19:39 +02:00
|
|
|
using static Content.Shared.Research.Components.SharedResearchClientComponent;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Research.UI
|
2019-09-03 22:51:19 +02:00
|
|
|
{
|
|
|
|
|
public class ResearchClientBoundUserInterface : BoundUserInterface
|
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
private ResearchClientServerSelectionMenu? _menu;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
|
|
|
|
public ResearchClientBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
SendMessage(new ResearchClientSyncMessage());
|
2019-09-03 22:51:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
{
|
|
|
|
|
base.Open();
|
|
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
_menu = new ResearchClientServerSelectionMenu(this);
|
2019-09-03 22:51:19 +02:00
|
|
|
_menu.OnClose += Close;
|
|
|
|
|
_menu.OpenCentered();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SelectServer(int serverId)
|
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
SendMessage(new ResearchClientServerSelectedMessage(serverId));
|
2019-09-03 22:51:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DeselectServer()
|
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
SendMessage(new ResearchClientServerDeselectedMessage());
|
2019-09-03 22:51:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
|
|
|
{
|
|
|
|
|
base.UpdateState(state);
|
2021-03-10 14:48:29 +01:00
|
|
|
if (state is not ResearchClientBoundInterfaceState rState) return;
|
|
|
|
|
_menu?.Populate(rState.ServerCount, rState.ServerNames, rState.ServerIds, rState.SelectedServerId);
|
2019-09-03 22:51:19 +02:00
|
|
|
}
|
2021-11-26 16:37:18 +13:00
|
|
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
{
|
|
|
|
|
base.Dispose(disposing);
|
|
|
|
|
if (!disposing) return;
|
|
|
|
|
_menu?.Dispose();
|
|
|
|
|
}
|
2019-09-03 22:51:19 +02:00
|
|
|
}
|
|
|
|
|
}
|