Files
space-station-14/Content.Server/FeedbackSystem/ServerFeedbackManager.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

79 lines
2.1 KiB
C#

using Content.Shared.FeedbackSystem;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Server.FeedbackSystem;
/// <inheritdoc />
public sealed class ServerFeedbackManager : SharedFeedbackManager
{
[Dependency] private readonly ISharedPlayerManager _player = null!;
public override void Initialize()
{
base.Initialize();
NetManager.RegisterNetMessage<FeedbackPopupMessage>();
NetManager.RegisterNetMessage<OpenFeedbackPopupMessage>();
}
/// <inheritdoc />
public override bool Send(EntityUid uid, List<ProtoId<FeedbackPopupPrototype>> popupPrototypes)
{
if (!_player.TryGetSessionByEntity(uid, out var session))
return false;
SendToSession(session, popupPrototypes);
return true;
}
/// <inheritdoc />
public override void SendToSession(ICommonSession session, List<ProtoId<FeedbackPopupPrototype>> popupPrototypes, bool remove = false)
{
if (!NetManager.IsServer)
return;
var msg = new FeedbackPopupMessage
{
FeedbackPrototypes = popupPrototypes,
Remove = remove,
};
NetManager.ServerSendMessage(msg, session.Channel);
}
/// <inheritdoc />
public override void SendToAllSessions(List<ProtoId<FeedbackPopupPrototype>> popupPrototypes, bool remove = false)
{
if (!NetManager.IsServer)
return;
var msg = new FeedbackPopupMessage
{
FeedbackPrototypes = popupPrototypes,
Remove = remove,
};
NetManager.ServerSendToAll(msg);
}
/// <inheritdoc />
public override void OpenForSession(ICommonSession session)
{
if (!NetManager.IsServer)
return;
var msg = new OpenFeedbackPopupMessage();
NetManager.ServerSendMessage(msg, session.Channel);
}
/// <inheritdoc />
public override void OpenForAllSessions()
{
if (!NetManager.IsServer)
return;
var msg = new OpenFeedbackPopupMessage();
NetManager.ServerSendToAll(msg);
}
}