Files
space-station-14/Content.Shared/FeedbackSystem/FeedbackPopupMessage.cs
Julian Giebel bcd3612730 Add feedback popups (#41352)
* Commit

* add the form post

* dv

* fixes

* Change wording

* Address review

* wording change

* Added some stuff

* New format

* bruh

* thanks perry!

* yes

* More fixes!

* typo

* Add a command to show the list, improve the UI slightly, split up command names

* Fix UI controller

* Add better comment

* Get rid of weird recursive thing

* Cleanup

* Work on moving feedback popups out of simulation

* Move round end screen subscription to feedback ui controller

* Finish moving feedback popups out of simulation

* Fix _ as parameter

* Clean up FeedbackPopupUIController

* Clean up commands

* Fix prototype yaml

* Fix openfeedbackpopup command description

* Update Resources/Locale/en-US/feedbackpopup/feedbackpopup.ftl

Co-authored-by: Simon <63975668+Simyon264@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Simon <63975668+Simyon264@users.noreply.github.com>

* Address reviews

* Address reviews

* Fix FeedbackPopupPrototype.cs using empty string instead of string.empty

* Address some more of the reviews, style nano is still trolling sadly

* Fix feedback popup styling

* Fix PopupPrototype ID field not having a setter

* Address reviews

* Add label when no feedback entries are present

Change link button to not show when no link is set

---------

Co-authored-by: beck-thompson <beck314159@hotmail.com>
Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
Co-authored-by: Simon <63975668+Simyon264@users.noreply.github.com>
2026-01-22 22:19:54 +00:00

62 lines
2.0 KiB
C#

using Lidgren.Network;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.FeedbackSystem;
/// <summary>
/// When clients receive this message a popup will appear with the contents from the given prototypes.
/// </summary>
public sealed class FeedbackPopupMessage : NetMessage
{
public override MsgGroups MsgGroup => MsgGroups.Command;
/// <summary>
/// When true, the popup prototypes specified in this message will be removed from the client's list of feedback popups.
/// If no prototypes are specified, all popups will be removed.
/// </summary>
/// <remarks>If this is false and the list of prototypes is empty, the message will be ignored</remarks>
public bool Remove { get; set; }
public List<ProtoId<FeedbackPopupPrototype>>? FeedbackPrototypes;
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
{
Remove = buffer.ReadBoolean();
buffer.ReadPadBits();
var count = buffer.ReadVariableInt32();
FeedbackPrototypes = [];
for (var i = 0; i < count; i++)
{
FeedbackPrototypes.Add(new ProtoId<FeedbackPopupPrototype>(buffer.ReadString()));
}
}
public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer serializer)
{
buffer.Write(Remove);
buffer.WritePadBits();
buffer.WriteVariableInt32(FeedbackPrototypes?.Count ?? 0);
if (FeedbackPrototypes == null)
return;
foreach (var proto in FeedbackPrototypes)
{
buffer.Write(proto);
}
}
}
/// <summary>
/// Sent from the server to open the feedback popup.
/// </summary>
public sealed class OpenFeedbackPopupMessage : NetMessage
{
public override MsgGroups MsgGroup => MsgGroups.Command;
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer) { }
public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer serializer) { }
}