1
0

GatewayUi.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using Robust.Shared.Serialization;
  2. using Robust.Shared.Utility;
  3. namespace Content.Shared.Gateway;
  4. [Serializable, NetSerializable]
  5. public enum GatewayVisuals : byte
  6. {
  7. Active
  8. }
  9. [Serializable, NetSerializable]
  10. public enum GatewayVisualLayers : byte
  11. {
  12. Portal
  13. }
  14. [Serializable, NetSerializable]
  15. public enum GatewayUiKey : byte
  16. {
  17. Key
  18. }
  19. [Serializable, NetSerializable]
  20. public sealed class GatewayBoundUserInterfaceState : BoundUserInterfaceState
  21. {
  22. /// <summary>
  23. /// List of enabled destinations and information about them.
  24. /// </summary>
  25. public readonly List<GatewayDestinationData> Destinations;
  26. /// <summary>
  27. /// Which destination it is currently linked to, if any.
  28. /// </summary>
  29. public readonly NetEntity? Current;
  30. /// <summary>
  31. /// Next time the portal is ready to be used.
  32. /// </summary>
  33. public readonly TimeSpan NextReady;
  34. public readonly TimeSpan Cooldown;
  35. /// <summary>
  36. /// Next time the destination generator unlocks another destination.
  37. /// </summary>
  38. public readonly TimeSpan NextUnlock;
  39. /// <summary>
  40. /// How long an unlock takes.
  41. /// </summary>
  42. public readonly TimeSpan UnlockTime;
  43. public GatewayBoundUserInterfaceState(List<GatewayDestinationData> destinations,
  44. NetEntity? current, TimeSpan nextReady, TimeSpan cooldown, TimeSpan nextUnlock, TimeSpan unlockTime)
  45. {
  46. Destinations = destinations;
  47. Current = current;
  48. NextReady = nextReady;
  49. Cooldown = cooldown;
  50. NextUnlock = nextUnlock;
  51. UnlockTime = unlockTime;
  52. }
  53. }
  54. [Serializable, NetSerializable]
  55. public record struct GatewayDestinationData
  56. {
  57. public NetEntity Entity;
  58. public FormattedMessage Name;
  59. /// <summary>
  60. /// Is the portal currently open.
  61. /// </summary>
  62. public bool Portal;
  63. /// <summary>
  64. /// Is the map the gateway on locked or unlocked.
  65. /// </summary>
  66. public bool Locked;
  67. }
  68. [Serializable, NetSerializable]
  69. public sealed class GatewayOpenPortalMessage : BoundUserInterfaceMessage
  70. {
  71. public NetEntity Destination;
  72. public GatewayOpenPortalMessage(NetEntity destination)
  73. {
  74. Destination = destination;
  75. }
  76. }