2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Ghost.Roles;
|
2021-02-12 04:35:56 +01:00
|
|
|
using Robust.Client.AutoGenerated;
|
|
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
|
|
2022-09-11 20:42:12 -07:00
|
|
|
namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
2021-02-12 04:35:56 +01:00
|
|
|
{
|
|
|
|
|
[GenerateTypedNameReferences]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed partial class GhostRolesEntry : BoxContainer
|
2021-02-12 04:35:56 +01:00
|
|
|
{
|
2022-04-03 01:06:29 +03:00
|
|
|
public event Action<GhostRoleInfo>? OnRoleSelected;
|
|
|
|
|
public event Action<GhostRoleInfo>? OnRoleFollow;
|
|
|
|
|
|
|
|
|
|
public GhostRolesEntry(string name, string description, IEnumerable<GhostRoleInfo> roles)
|
2021-02-12 04:35:56 +01:00
|
|
|
{
|
|
|
|
|
RobustXamlLoader.Load(this);
|
|
|
|
|
|
2022-04-03 01:06:29 +03:00
|
|
|
Title.Text = name;
|
|
|
|
|
Description.SetMessage(description);
|
|
|
|
|
|
|
|
|
|
foreach (var role in roles)
|
|
|
|
|
{
|
|
|
|
|
var button = new GhostRoleEntryButtons();
|
|
|
|
|
button.RequestButton.OnPressed += _ => OnRoleSelected?.Invoke(role);
|
|
|
|
|
button.FollowButton.OnPressed += _ => OnRoleFollow?.Invoke(role);
|
|
|
|
|
|
|
|
|
|
Buttons.AddChild(button);
|
|
|
|
|
}
|
2021-02-12 04:35:56 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|