Add make ghost role verb (#3204)

This commit is contained in:
DrSmugleaf
2021-02-16 09:51:27 +01:00
committed by GitHub
parent 6a3072e4fd
commit 78afc2db0f
19 changed files with 388 additions and 20 deletions

View File

@@ -0,0 +1,49 @@
#nullable enable
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.GameObjects.Components.Observer.GhostRoles
{
[GenerateTypedNameReferences]
public partial class MakeGhostRoleWindow : SS14Window
{
public delegate void MakeRole(EntityUid uid, string name, string description, bool makeSentient);
public MakeGhostRoleWindow()
{
RobustXamlLoader.Load(this);
MakeSentientLabel.CustomMinimumSize = (150, 0);
RoleEntityLabel.CustomMinimumSize = (150, 0);
RoleNameLabel.CustomMinimumSize = (150, 0);
RoleName.CustomMinimumSize = (300, 0);
RoleDescriptionLabel.CustomMinimumSize = (150, 0);
RoleDescription.CustomMinimumSize = (300, 0);
MakeButton.OnPressed += OnPressed;
}
private EntityUid? EntityUid { get; set; }
public event MakeRole? OnMake;
public void SetEntity(EntityUid uid)
{
EntityUid = uid;
RoleEntity.Text = $"{uid}";
}
private void OnPressed(ButtonEventArgs args)
{
if (EntityUid == null)
{
return;
}
OnMake?.Invoke(EntityUid.Value, RoleName.Text, RoleDescription.Text, MakeSentientCheckbox.Pressed);
}
}
}