mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Make every EntitySystem partial * Oobs thats for a diff PR * Also oops on that one * Test systems * git are we fr * Update file templates * cleanup empty classes while we are here * forgor --------- Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using Content.Client.UserInterface.Controls;
|
|
using Content.Shared.Administration;
|
|
|
|
namespace Content.Client.Administration;
|
|
|
|
/// <summary>
|
|
/// This handles the client portion of quick dialogs.
|
|
/// </summary>
|
|
public sealed partial class QuickDialogSystem : EntitySystem
|
|
{
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
SubscribeNetworkEvent<QuickDialogOpenEvent>(OpenDialog);
|
|
}
|
|
|
|
private void OpenDialog(QuickDialogOpenEvent ev)
|
|
{
|
|
var ok = (ev.Buttons & QuickDialogButtonFlag.OkButton) != 0;
|
|
var cancel = (ev.Buttons & QuickDialogButtonFlag.CancelButton) != 0;
|
|
var window = new DialogWindow(ev.Title, ev.Prompts, ok: ok, cancel: cancel);
|
|
|
|
window.OnConfirmed += responses =>
|
|
{
|
|
RaiseNetworkEvent(new QuickDialogResponseEvent(ev.DialogId,
|
|
responses,
|
|
QuickDialogButtonFlag.OkButton));
|
|
};
|
|
|
|
window.OnCancelled += () =>
|
|
{
|
|
RaiseNetworkEvent(new QuickDialogResponseEvent(ev.DialogId,
|
|
new(),
|
|
QuickDialogButtonFlag.CancelButton));
|
|
};
|
|
}
|
|
}
|