2022-06-28 22:54:08 +10:00
|
|
|
using Content.Shared.Research.Components;
|
2021-03-10 14:48:29 +01:00
|
|
|
using JetBrains.Annotations;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Client.GameObjects;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
namespace Content.Client.Research.UI;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
[UsedImplicitly]
|
|
|
|
|
public sealed class ResearchConsoleBoundUserInterface : BoundUserInterface
|
|
|
|
|
{
|
2023-07-08 09:02:17 -07:00
|
|
|
[ViewVariables]
|
2023-05-15 16:17:30 -04:00
|
|
|
private ResearchConsoleMenu? _consoleMenu;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-07-08 09:02:17 -07:00
|
|
|
public ResearchConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
2023-05-15 16:17:30 -04:00
|
|
|
{
|
|
|
|
|
}
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
protected override void Open()
|
|
|
|
|
{
|
|
|
|
|
base.Open();
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-07-08 09:02:17 -07:00
|
|
|
var owner = Owner;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
_consoleMenu = new ResearchConsoleMenu(owner);
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
_consoleMenu.OnTechnologyCardPressed += id =>
|
2019-09-03 22:51:19 +02:00
|
|
|
{
|
2023-05-15 16:17:30 -04:00
|
|
|
SendMessage(new ConsoleUnlockTechnologyMessage(id));
|
|
|
|
|
};
|
2022-12-20 17:39:57 -05:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
_consoleMenu.OnServerButtonPressed += () =>
|
|
|
|
|
{
|
|
|
|
|
SendMessage(new ConsoleServerSelectionMessage());
|
|
|
|
|
};
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
_consoleMenu.OnClose += Close;
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
_consoleMenu.OpenCentered();
|
|
|
|
|
}
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
|
|
|
{
|
|
|
|
|
base.UpdateState(state);
|
2019-09-03 22:51:19 +02:00
|
|
|
|
2023-05-15 16:17:30 -04:00
|
|
|
if (state is not ResearchConsoleBoundInterfaceState castState)
|
|
|
|
|
return;
|
|
|
|
|
_consoleMenu?.UpdatePanels(castState);
|
|
|
|
|
_consoleMenu?.UpdateInformationPanel(castState);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
{
|
|
|
|
|
base.Dispose(disposing);
|
|
|
|
|
if (!disposing)
|
|
|
|
|
return;
|
|
|
|
|
_consoleMenu?.Dispose();
|
2019-09-03 22:51:19 +02:00
|
|
|
}
|
|
|
|
|
}
|