Files
tbd-station-14/Content.Client/Lathe/UI/LatheBoundUserInterface.cs
Nemanja 2e7dcb1ed8 Lathe Refactor and ECS (#11201)
* lathe and material storage refactor

* materialStorage ECS

it kinda sus tho

* beginning the lathe shitcode dive

* couple lathe visuals and lathe system

* lathe changes and such

* dynamic lathe databases

* rewrote internal logic

on to ui

* da newI

* material display clientside

* misc ui changes

* component state handling and various other things

* moar

* Update Content.Shared/Lathe/LatheComponent.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* first volley of sloth review

* more fixes

* losin' my mind

* all da changes

* test fix and other review

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2022-09-16 18:49:05 -05:00

76 lines
2.1 KiB
C#

using Content.Shared.Lathe;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
namespace Content.Client.Lathe.UI
{
[UsedImplicitly]
public sealed class LatheBoundUserInterface : BoundUserInterface
{
[ViewVariables] private LatheMenu? _menu;
[ViewVariables] private LatheQueueMenu? _queueMenu;
public EntityUid Lathe;
public LatheBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
{
Lathe = owner.Owner;
}
protected override void Open()
{
base.Open();
_menu = new LatheMenu(this);
_queueMenu = new LatheQueueMenu(this);
_menu.OnClose += Close;
_menu.OnQueueButtonPressed += _ =>
{
_queueMenu.OpenCenteredLeft();
};
_menu.OnServerListButtonPressed += _ =>
{
SendMessage(new LatheServerSelectionMessage());
};
_menu.OnServerSyncButtonPressed += _ =>
{
SendMessage(new LatheServerSyncMessage());
};
_menu.RecipeQueueAction += (recipe, amount) =>
{
SendMessage(new LatheQueueRecipeMessage(recipe, amount));
};
_menu.OpenCentered();
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
switch (state)
{
case LatheUpdateState msg:
if (_menu != null)
_menu.Recipes = msg.Recipes;
_menu?.PopulateRecipes(Owner.Owner);
_menu?.PopulateMaterials(Lathe);
_queueMenu?.PopulateList(msg.Queue);
_queueMenu?.SetInfo(msg.CurrentlyProducing);
break;
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_menu?.Dispose();
_queueMenu?.Dispose();
}
}
}