Files
tbd-station-14/Content.Client/GameObjects/Components/Research/ResearchClientBoundUserInterface.cs
DrSmugleaf 902aa128c2 Enable nullability in Content.Client (#3257)
* Enable nullability in Content.Client

* Remove #nullable enable

* Merge fixes

* Remove Debug.Assert

* Merge fixes

* Fix build

* Fix build
2021-03-10 14:48:29 +01:00

43 lines
1.3 KiB
C#

using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using static Content.Shared.GameObjects.Components.Research.SharedResearchClientComponent;
namespace Content.Client.GameObjects.Components.Research
{
public class ResearchClientBoundUserInterface : BoundUserInterface
{
private ResearchClientServerSelectionMenu? _menu;
public ResearchClientBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
{
SendMessage(new ResearchClientSyncMessage());
}
protected override void Open()
{
base.Open();
_menu = new ResearchClientServerSelectionMenu(this);
_menu.OnClose += Close;
_menu.OpenCentered();
}
public void SelectServer(int serverId)
{
SendMessage(new ResearchClientServerSelectedMessage(serverId));
}
public void DeselectServer()
{
SendMessage(new ResearchClientServerDeselectedMessage());
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not ResearchClientBoundInterfaceState rState) return;
_menu?.Populate(rState.ServerCount, rState.ServerNames, rState.ServerIds, rState.SelectedServerId);
}
}
}