Сообщения в ПДА 2 (#583)
* add: AdminLog * tweak: clean up * fix: Changeling -> Network * add: сортировка сообщений * fix: ТексТ
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._White.CartridgeLoader.Cartridges;
|
||||
|
||||
|
||||
///<summary>
|
||||
/// Data of a single message in the system, containing the ids of the sender and recipient, the text content and the time it was sent.
|
||||
///</summary>
|
||||
[Serializable, NetSerializable]
|
||||
public struct MessagesMessageData
|
||||
{
|
||||
public int SenderId;
|
||||
public int ReceiverId;
|
||||
public string Content;
|
||||
public TimeSpan Time;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class MessagesUserData
|
||||
{
|
||||
public string Name = Loc.GetString("messages-pda-unknown-name");
|
||||
|
||||
public string Job = Loc.GetString("messages-pda-unknown-job");
|
||||
|
||||
public string Department = "Specific";
|
||||
|
||||
public List<MessagesMessageData> Messages = [];
|
||||
|
||||
public void SetMessagesUser(string? name, string? job, string? department)
|
||||
{
|
||||
Name = name ?? Loc.GetString("messages-pda-unknown-name");
|
||||
Job = job ?? Loc.GetString("messages-pda-unknown-job");
|
||||
Department = department ?? "Specific";
|
||||
}
|
||||
}
|
||||
@@ -4,18 +4,13 @@ using Robust.Shared.Serialization;
|
||||
namespace Content.Shared._White.CartridgeLoader.Cartridges;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class MessagesUiMessageEvent : CartridgeMessageEvent
|
||||
public sealed class MessagesUiMessageEvent(MessagesUiAction action, string? stringInput, int? targetChatUid) : CartridgeMessageEvent
|
||||
{
|
||||
public readonly MessagesUiAction Action;
|
||||
public readonly int? TargetChatUid;
|
||||
public readonly string? StringInput;
|
||||
public readonly MessagesUiAction Action = action;
|
||||
|
||||
public MessagesUiMessageEvent(MessagesUiAction action, string? stringInput, int? targetChatUid)
|
||||
{
|
||||
Action = action;
|
||||
TargetChatUid = targetChatUid;
|
||||
StringInput = stringInput;
|
||||
}
|
||||
public readonly int? TargetChatUid = targetChatUid;
|
||||
|
||||
public readonly string? StringInput = stringInput;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -8,9 +8,10 @@ namespace Content.Shared._White.CartridgeLoader.Cartridges;
|
||||
/// Contents contains either the names of users and their ids in the messages system or simply a list of message strings.
|
||||
///</summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class MessagesUiState(MessagesUiStateMode mode, List<(MessagesUser, int?)> contents, string? name = null) : BoundUserInterfaceState
|
||||
public sealed class MessagesUiState(MessagesUiStateMode mode, List<(MessagesUserData, int?)>? users = null, List<(string, int?)>? messages = null, string? name = null) : BoundUserInterfaceState
|
||||
{
|
||||
public List<(MessagesUser, int?)>? Contents = contents;
|
||||
public List<(MessagesUserData, int?)>? Users = users;
|
||||
public List<(string, int?)>? Messages = messages;
|
||||
public MessagesUiStateMode Mode = mode;
|
||||
public string? Name = name;
|
||||
}
|
||||
@@ -25,23 +26,3 @@ public enum MessagesUiStateMode : byte
|
||||
Chat,
|
||||
Error
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Data of a single message in the system, containing the ids of the sender and recipient, the text content and the time it was sent.
|
||||
///</summary>
|
||||
[Serializable, NetSerializable]
|
||||
public struct MessagesMessageData
|
||||
{
|
||||
public int SenderId;
|
||||
public int ReceiverId;
|
||||
public string Content;
|
||||
public TimeSpan Time;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class MessagesUser(string name, string job, string department)
|
||||
{
|
||||
public string Name = name;
|
||||
public string Job = job;
|
||||
public string Department = department;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user