GeneralRecordsUi.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using Robust.Shared.Serialization;
  2. namespace Content.Shared.StationRecords;
  3. [Serializable, NetSerializable]
  4. public enum GeneralStationRecordConsoleKey : byte
  5. {
  6. Key
  7. }
  8. /// <summary>
  9. /// General station records console state. There are a few states:
  10. /// - SelectedKey null, Record null, RecordListing null
  11. /// - The station record database could not be accessed.
  12. /// - SelectedKey null, Record null, RecordListing non-null
  13. /// - Records are populated in the database, or at least the station has
  14. /// the correct component.
  15. /// - SelectedKey non-null, Record null, RecordListing non-null
  16. /// - The selected key does not have a record tied to it.
  17. /// - SelectedKey non-null, Record non-null, RecordListing non-null
  18. /// - The selected key has a record tied to it, and the record has been sent.
  19. ///
  20. /// - there is added new filters and so added new states
  21. /// -SelectedKey null, Record null, RecordListing null, filters non-null
  22. /// the station may have data, but they all did not pass through the filters
  23. ///
  24. /// Other states are erroneous.
  25. /// </summary>
  26. [Serializable, NetSerializable]
  27. public sealed class GeneralStationRecordConsoleState : BoundUserInterfaceState
  28. {
  29. /// <summary>
  30. /// Current selected key.
  31. /// Station is always the station that owns the console.
  32. /// </summary>
  33. public readonly uint? SelectedKey;
  34. public readonly GeneralStationRecord? Record;
  35. public readonly Dictionary<uint, string>? RecordListing;
  36. public readonly StationRecordsFilter? Filter;
  37. public readonly bool CanDeleteEntries;
  38. public GeneralStationRecordConsoleState(uint? key,
  39. GeneralStationRecord? record,
  40. Dictionary<uint, string>? recordListing,
  41. StationRecordsFilter? newFilter,
  42. bool canDeleteEntries)
  43. {
  44. SelectedKey = key;
  45. Record = record;
  46. RecordListing = recordListing;
  47. Filter = newFilter;
  48. CanDeleteEntries = canDeleteEntries;
  49. }
  50. public GeneralStationRecordConsoleState() : this(null, null, null, null, false)
  51. {
  52. }
  53. public bool IsEmpty() => SelectedKey == null
  54. && Record == null && RecordListing == null;
  55. }
  56. /// <summary>
  57. /// Select a specific crewmember's record, or deselect.
  58. /// Used by any kind of records console including general and criminal.
  59. /// </summary>
  60. [Serializable, NetSerializable]
  61. public sealed class SelectStationRecord : BoundUserInterfaceMessage
  62. {
  63. public readonly uint? SelectedKey;
  64. public SelectStationRecord(uint? selectedKey)
  65. {
  66. SelectedKey = selectedKey;
  67. }
  68. }
  69. [Serializable, NetSerializable]
  70. public sealed class DeleteStationRecord : BoundUserInterfaceMessage
  71. {
  72. public DeleteStationRecord(uint id)
  73. {
  74. Id = id;
  75. }
  76. public readonly uint Id;
  77. }