fish-station/Content.Client/_Sunrise/GhostTheme/GhostThemeBoundUserInterface.cs
Vigers Ray b56448c3b6
Обновление спонсорской системы (#905)
* Апдейт спонсорки

* Доработка апдейта

* упс
2024-12-23 20:45:39 +03:00

51 lines
1.3 KiB
C#

// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt
using Content.Shared._Sunrise.GhostTheme;
using JetBrains.Annotations;
namespace Content.Client._Sunrise.GhostTheme;
[UsedImplicitly]
public sealed class GhostThemeBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private GhostThemeMenu? _menu;
public GhostThemeBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_menu = new GhostThemeMenu();
_menu.OnClose += Close;
_menu.OnIdSelected += OnIdSelected;
_menu.OpenCentered();
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not GhostThemeBoundUserInterfaceState st)
return;
_menu?.UpdateState(st.GhostThemes);
}
private void OnIdSelected(string selectedId)
{
SendMessage(new GhostThemePrototypeSelectedMessage(selectedId));
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
_menu?.Close();
_menu = null;
}
}
}