SharedDisposalTaggerComponent.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Text.RegularExpressions;
  2. using Robust.Shared.Serialization;
  3. namespace Content.Shared.Disposal.Components
  4. {
  5. public sealed partial class SharedDisposalTaggerComponent : Component
  6. {
  7. public static readonly Regex TagRegex = new("^[a-zA-Z0-9 ]*$", RegexOptions.Compiled);
  8. [Serializable, NetSerializable]
  9. public sealed class DisposalTaggerUserInterfaceState : BoundUserInterfaceState
  10. {
  11. public readonly string Tag;
  12. public DisposalTaggerUserInterfaceState(string tag)
  13. {
  14. Tag = tag;
  15. }
  16. }
  17. [Serializable, NetSerializable]
  18. public sealed class UiActionMessage : BoundUserInterfaceMessage
  19. {
  20. public readonly UiAction Action;
  21. public readonly string Tag = "";
  22. public UiActionMessage(UiAction action, string tag)
  23. {
  24. Action = action;
  25. if (Action == UiAction.Ok)
  26. {
  27. Tag = tag.Substring(0, Math.Min(tag.Length, 30));
  28. }
  29. }
  30. }
  31. [Serializable, NetSerializable]
  32. public enum UiAction
  33. {
  34. Ok
  35. }
  36. [Serializable, NetSerializable]
  37. public enum DisposalTaggerUiKey
  38. {
  39. Key
  40. }
  41. }
  42. }