Grouped ghost roles and jump button (#7300)

This commit is contained in:
Alex Evgrashin
2022-04-03 01:06:29 +03:00
committed by GitHub
parent 31a9cc0acb
commit bf89483e09
10 changed files with 91 additions and 21 deletions

View File

@@ -9,13 +9,24 @@ namespace Content.Client.Ghost.Roles.UI
[GenerateTypedNameReferences]
public sealed partial class GhostRolesEntry : BoxContainer
{
public GhostRolesEntry(GhostRoleInfo info, Action<BaseButton.ButtonEventArgs> requestAction)
public event Action<GhostRoleInfo>? OnRoleSelected;
public event Action<GhostRoleInfo>? OnRoleFollow;
public GhostRolesEntry(string name, string description, IEnumerable<GhostRoleInfo> roles)
{
RobustXamlLoader.Load(this);
Title.Text = info.Name;
Description.SetMessage(info.Description);
RequestButton.OnPressed += requestAction;
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);
}
}
}
}