6
StarHorizon_Public/Content.Client/_NF/PlantAnalyzer/UI/PlantAnalyzerBoundUserInterface.cs
2025-11-12 10:55:00 +03:00

43 lines
1.1 KiB
C#

using Content.Shared._NF.PlantAnalyzer;
using JetBrains.Annotations;
using Robust.Client.UserInterface;
namespace Content.Client._NF.PlantAnalyzer.UI;
[UsedImplicitly]
public sealed class PlantAnalyzerBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private PlantAnalyzerWindow? _window;
public PlantAnalyzerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
if (_window == null)
{
_window = this.CreateWindowCenteredLeft<PlantAnalyzerWindow>();
_window.Title = Loc.GetString("plant-analyzer-interface-title");
_window.OnAdvancedModeChanged += AdvPressed;
}
}
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
{
if (_window == null)
return;
if (message is not PlantAnalyzerScannedSeedPlantInformation cast)
return;
_window.Populate(cast);
}
public void AdvPressed(bool scanMode)
{
SendMessage(new PlantAnalyzerSetMode(scanMode));
}
}