News UI overhaul and PDA notifications (#19610)
This commit is contained in:
@@ -10,6 +10,9 @@ namespace Content.Shared.CartridgeLoader;
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class CartridgeComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public EntityUid? LoaderUid;
|
||||
|
||||
[DataField(required: true)]
|
||||
public LocId ProgramName = "default-program-name";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public sealed partial class CartridgeLoaderComponent : Component
|
||||
{
|
||||
public const string CartridgeSlotId = "Cartridge-Slot";
|
||||
|
||||
[DataField("cartridgeSlot")]
|
||||
[DataField]
|
||||
public ItemSlot CartridgeSlot = new();
|
||||
|
||||
/// <summary>
|
||||
@@ -32,9 +32,16 @@ public sealed partial class CartridgeLoaderComponent : Component
|
||||
/// <summary>
|
||||
/// The maximum amount of programs that can be installed on the cartridge loader entity
|
||||
/// </summary>
|
||||
[DataField("diskSpace")]
|
||||
[DataField]
|
||||
public int DiskSpace = 5;
|
||||
|
||||
[DataField("uiKey", required: true)]
|
||||
/// <summary>
|
||||
/// Controls whether the cartridge loader will play notifications if it supports it at all
|
||||
/// TODO: Add an option for this to the PDA
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool NotificationsEnabled = true;
|
||||
|
||||
[DataField(required: true)]
|
||||
public Enum UiKey = default!;
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.CartridgeLoader.Cartridges;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsReadUiMessageEvent : CartridgeMessageEvent
|
||||
{
|
||||
public readonly NewsReadUiAction Action;
|
||||
|
||||
public NewsReadUiMessageEvent(NewsReadUiAction action)
|
||||
{
|
||||
Action = action;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum NewsReadUiAction
|
||||
{
|
||||
Next,
|
||||
Prev,
|
||||
NotificationSwith
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.CartridgeLoader.Cartridges;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsReaderUiMessageEvent : CartridgeMessageEvent
|
||||
{
|
||||
public readonly NewsReaderUiAction Action;
|
||||
|
||||
public NewsReaderUiMessageEvent(NewsReaderUiAction action)
|
||||
{
|
||||
Action = action;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum NewsReaderUiAction
|
||||
{
|
||||
Next,
|
||||
Prev,
|
||||
NotificationSwitch
|
||||
}
|
||||
@@ -4,14 +4,14 @@ using Content.Shared.MassMedia.Systems;
|
||||
namespace Content.Shared.CartridgeLoader.Cartridges;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsReadBoundUserInterfaceState : BoundUserInterfaceState
|
||||
public sealed class NewsReaderBoundUserInterfaceState : BoundUserInterfaceState
|
||||
{
|
||||
public NewsArticle Article;
|
||||
public int TargetNum;
|
||||
public int TotalNum;
|
||||
public bool NotificationOn;
|
||||
|
||||
public NewsReadBoundUserInterfaceState(NewsArticle article, int targetNum, int totalNum, bool notificationOn)
|
||||
public NewsReaderBoundUserInterfaceState(NewsArticle article, int targetNum, int totalNum, bool notificationOn)
|
||||
{
|
||||
Article = article;
|
||||
TargetNum = targetNum;
|
||||
@@ -21,11 +21,11 @@ public sealed class NewsReadBoundUserInterfaceState : BoundUserInterfaceState
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsReadEmptyBoundUserInterfaceState : BoundUserInterfaceState
|
||||
public sealed class NewsReaderEmptyBoundUserInterfaceState : BoundUserInterfaceState
|
||||
{
|
||||
public bool NotificationOn;
|
||||
|
||||
public NewsReadEmptyBoundUserInterfaceState(bool notificationOn)
|
||||
public NewsReaderEmptyBoundUserInterfaceState(bool notificationOn)
|
||||
{
|
||||
NotificationOn = notificationOn;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Shared.CartridgeLoader;
|
||||
|
||||
@@ -124,3 +123,11 @@ public sealed class CartridgeUiReadyEvent : EntityEventArgs
|
||||
Loader = loader;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets sent by the cartridge loader system to the cartridge loader entity so another system
|
||||
/// can handle displaying the notification
|
||||
/// </summary>
|
||||
/// <param name="Message">The message to be displayed</param>
|
||||
[ByRefEvent]
|
||||
public record struct CartridgeLoaderNotificationSentEvent(string Header, string Message);
|
||||
|
||||
@@ -49,40 +49,46 @@ namespace Content.Shared.Chat
|
||||
/// </summary>
|
||||
Visual = 1 << 7,
|
||||
|
||||
/// <summary>
|
||||
/// Notifications from things like the PDA.
|
||||
/// Receiving a PDA message will send a notification to this channel for example
|
||||
/// </summary>
|
||||
Notifications = 1 << 8,
|
||||
|
||||
/// <summary>
|
||||
/// Emotes
|
||||
/// </summary>
|
||||
Emotes = 1 << 8,
|
||||
Emotes = 1 << 9,
|
||||
|
||||
/// <summary>
|
||||
/// Deadchat
|
||||
/// </summary>
|
||||
Dead = 1 << 9,
|
||||
Dead = 1 << 10,
|
||||
|
||||
/// <summary>
|
||||
/// Misc admin messages
|
||||
/// </summary>
|
||||
Admin = 1 << 10,
|
||||
Admin = 1 << 11,
|
||||
|
||||
/// <summary>
|
||||
/// Admin alerts, messages likely of elevated importance to admins
|
||||
/// </summary>
|
||||
AdminAlert = 1 << 11,
|
||||
AdminAlert = 1 << 12,
|
||||
|
||||
/// <summary>
|
||||
/// Admin chat
|
||||
/// </summary>
|
||||
AdminChat = 1 << 12,
|
||||
AdminChat = 1 << 13,
|
||||
|
||||
/// <summary>
|
||||
/// Unspecified.
|
||||
/// </summary>
|
||||
Unspecified = 1 << 13,
|
||||
Unspecified = 1 << 14,
|
||||
|
||||
/// <summary>
|
||||
/// Channels considered to be IC.
|
||||
/// </summary>
|
||||
IC = Local | Whisper | Radio | Dead | Emotes | Damage | Visual,
|
||||
IC = Local | Whisper | Radio | Dead | Emotes | Damage | Visual | Notifications,
|
||||
|
||||
AdminRelated = Admin | AdminAlert | AdminChat,
|
||||
}
|
||||
|
||||
55
Content.Shared/MassMedia/Components/NewsWriterBuiMessages.cs
Normal file
55
Content.Shared/MassMedia/Components/NewsWriterBuiMessages.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Content.Shared.MassMedia.Systems;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.MassMedia.Components;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum NewsWriterUiKey : byte
|
||||
{
|
||||
Key
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsWriterBoundUserInterfaceState : BoundUserInterfaceState
|
||||
{
|
||||
public readonly NewsArticle[] Articles;
|
||||
public readonly bool PublishEnabled;
|
||||
public readonly TimeSpan NextPublish;
|
||||
|
||||
public NewsWriterBoundUserInterfaceState(NewsArticle[] articles, bool publishEnabled, TimeSpan nextPublish)
|
||||
{
|
||||
Articles = articles;
|
||||
PublishEnabled = publishEnabled;
|
||||
NextPublish = nextPublish;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsWriterPublishMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public readonly string Title;
|
||||
public readonly string Content;
|
||||
|
||||
|
||||
public NewsWriterPublishMessage(string title, string content)
|
||||
{
|
||||
Title = title;
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsWriterDeleteMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public readonly int ArticleNum;
|
||||
|
||||
public NewsWriterDeleteMessage(int num)
|
||||
{
|
||||
ArticleNum = num;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsWriterArticlesRequestMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using Content.Shared.MassMedia.Systems;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.MassMedia.Components;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum NewsWriteUiKey : byte
|
||||
{
|
||||
Key
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsWriteBoundUserInterfaceState : BoundUserInterfaceState
|
||||
{
|
||||
public NewsArticle[] Articles;
|
||||
public bool ShareAvalible;
|
||||
|
||||
public NewsWriteBoundUserInterfaceState(NewsArticle[] articles, bool shareAvalible)
|
||||
{
|
||||
Articles = articles;
|
||||
ShareAvalible = shareAvalible;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsWriteShareMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public readonly string Name;
|
||||
public readonly string Content;
|
||||
public NewsWriteShareMessage(string name, string content)
|
||||
{
|
||||
Name = name;
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsWriteDeleteMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public int ArticleNum;
|
||||
|
||||
public NewsWriteDeleteMessage(int num)
|
||||
{
|
||||
ArticleNum = num;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class NewsWriteArticlesRequestMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public NewsWriteArticlesRequestMessage()
|
||||
{
|
||||
}
|
||||
}
|
||||
10
Content.Shared/MassMedia/Components/StationNewsComponent.cs
Normal file
10
Content.Shared/MassMedia/Components/StationNewsComponent.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Content.Shared.MassMedia.Systems;
|
||||
|
||||
namespace Content.Shared.MassMedia.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class StationNewsComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public List<NewsArticle> Articles = new();
|
||||
}
|
||||
@@ -4,16 +4,31 @@ namespace Content.Shared.MassMedia.Systems;
|
||||
|
||||
public abstract class SharedNewsSystem : EntitySystem
|
||||
{
|
||||
public const int MaxNameLength = 25;
|
||||
public const int MaxArticleLength = 2048;
|
||||
public const int MaxTitleLength = 25;
|
||||
public const int MaxContentLength = 2048;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public struct NewsArticle
|
||||
{
|
||||
public string Name;
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Title;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Content;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string? Author;
|
||||
|
||||
[ViewVariables]
|
||||
public ICollection<(NetEntity, uint)>? AuthorStationRecordKeyIds;
|
||||
|
||||
[ViewVariables]
|
||||
public TimeSpan ShareTime;
|
||||
}
|
||||
|
||||
[ByRefEvent]
|
||||
public record struct NewsArticlePublishedEvent(NewsArticle Article);
|
||||
|
||||
[ByRefEvent]
|
||||
public record struct NewsArticleDeletedEvent;
|
||||
|
||||
Reference in New Issue
Block a user