Files
wwdpublic/Content.Client/_White/UI/Buttons/WhiteCommandButton.cs
Spatison bc6e4d3ef0 [Port] Lobby / Лобби (#47)
* add: animation background

* add:lobby UI

* tweak

* WD EDIT

* fix

* tweak: button color

* fix

* test

* feat: add changelog button to lobby

---------

Co-authored-by: Remuchi <RemuchiOfficial@gmail.com>
2024-09-12 11:31:46 +07:00

35 lines
767 B
C#

using Robust.Client.Console;
namespace Content.Client._White.UI.Buttons;
[Virtual]
public class WhiteCommandButton : WhiteLobbyTextButton
{
public string? Command { get; set; }
public WhiteCommandButton()
{
OnPressed += Execute;
}
private bool CanPress()
{
return string.IsNullOrEmpty(Command) ||
IoCManager.Resolve<IClientConGroupController>().CanCommand(Command.Split(' ')[0]);
}
protected override void EnteredTree()
{
if (!CanPress())
{
Visible = false;
}
}
protected virtual void Execute(ButtonEventArgs obj)
{
if (!string.IsNullOrEmpty(Command))
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(Command);
}
}