GhostRolesEui.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Content.Server.EUI;
  2. using Content.Shared.Eui;
  3. using Content.Shared.Ghost.Roles;
  4. namespace Content.Server.Ghost.Roles.UI
  5. {
  6. public sealed class GhostRolesEui : BaseEui
  7. {
  8. private readonly GhostRoleSystem _ghostRoleSystem;
  9. public GhostRolesEui()
  10. {
  11. _ghostRoleSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<GhostRoleSystem>();
  12. }
  13. public override GhostRolesEuiState GetNewState()
  14. {
  15. return new(_ghostRoleSystem.GetGhostRolesInfo(Player));
  16. }
  17. public override void HandleMessage(EuiMessageBase msg)
  18. {
  19. base.HandleMessage(msg);
  20. switch (msg)
  21. {
  22. case RequestGhostRoleMessage req:
  23. _ghostRoleSystem.Request(Player, req.Identifier);
  24. break;
  25. case FollowGhostRoleMessage req:
  26. _ghostRoleSystem.Follow(Player, req.Identifier);
  27. break;
  28. case LeaveGhostRoleRaffleMessage req:
  29. _ghostRoleSystem.LeaveRaffle(Player, req.Identifier);
  30. break;
  31. }
  32. }
  33. public override void Closed()
  34. {
  35. base.Closed();
  36. _ghostRoleSystem.CloseEui(Player);
  37. }
  38. }
  39. }