Files
tbd-station-14/Content.Shared/Administration/QuickDialogOpenEvent.cs
Moony f98df73fae Adds even more smites and a bunch of tools. (#9825)
* Adds three new smites, headstand, locker stuff, and reptilian species swap.

* Localize all the smites.

* save work

* More smites...

* Final tweaks.

* oops

* !PLEH

* Adds disarm prone and improved hand removal options.

* fix chances.

* take out the trash.

* Add some admin TRICKS instead of more smites.

* oop

* Implements the admin test arena and associated trick.

* Tricks for granting/revoking access.

* e

* mfw

* Implement quick dialogs, for when you don't want to spend 20 minutes writing a simple dialog prompt.

* Forgot the rejuv icon.

* E

* docs

* augh

* Add rename/redescribe buttons.

* Adds objects menu, implements a couple tricks for stations.

* 1984

* Adds a trick for effectively infinite power.

* fixes some icon uggo.

* a

* HALT!

* Pause/unpause buttons.

* Forgor the textures.

* they broke every bone in their body.

* i added more

* more battery actions, touch up battery icon.

* Address reviews.
2022-07-21 17:30:00 -05:00

130 lines
2.9 KiB
C#

using Robust.Shared.Serialization;
namespace Content.Shared.Administration;
/// <summary>
/// A networked event raised when the server wants to open a quick dialog.
/// </summary>
[Serializable, NetSerializable]
public sealed class QuickDialogOpenEvent : EntityEventArgs
{
/// <summary>
/// The title of the dialog.
/// </summary>
public string Title;
/// <summary>
/// The internal dialog ID.
/// </summary>
public int DialogId;
/// <summary>
/// The prompts to show the user.
/// </summary>
public List<QuickDialogEntry> Prompts;
/// <summary>
/// The buttons presented for the user.
/// </summary>
public QuickDialogButtonFlag Buttons = QuickDialogButtonFlag.OkButton;
public QuickDialogOpenEvent(string title, List<QuickDialogEntry> prompts, int dialogId, QuickDialogButtonFlag buttons)
{
Title = title;
Prompts = prompts;
Buttons = buttons;
DialogId = dialogId;
}
}
/// <summary>
/// A networked event raised when the client replies to a quick dialog.
/// </summary>
[Serializable, NetSerializable]
public sealed class QuickDialogResponseEvent : EntityEventArgs
{
/// <summary>
/// The internal dialog ID.
/// </summary>
public int DialogId;
/// <summary>
/// The responses to the prompts.
/// </summary>
public Dictionary<string, string> Responses;
/// <summary>
/// The button pressed when responding.
/// </summary>
public QuickDialogButtonFlag ButtonPressed;
public QuickDialogResponseEvent(int dialogId, Dictionary<string, string> responses, QuickDialogButtonFlag buttonPressed)
{
DialogId = dialogId;
Responses = responses;
ButtonPressed = buttonPressed;
}
}
/// <summary>
/// An entry in a quick dialog.
/// </summary>
[Serializable, NetSerializable]
public sealed class QuickDialogEntry
{
/// <summary>
/// ID of the dialog field.
/// </summary>
public string FieldId;
/// <summary>
/// Type of the field, for checks.
/// </summary>
public QuickDialogEntryType Type;
/// <summary>
/// The prompt to show the user.
/// </summary>
public string Prompt;
public QuickDialogEntry(string fieldId, QuickDialogEntryType type, string prompt)
{
FieldId = fieldId;
Type = type;
Prompt = prompt;
}
}
/// <summary>
/// The buttons available in a quick dialog.
/// </summary>
[Flags]
public enum QuickDialogButtonFlag
{
OkButton = 1,
CancelButton = 2,
}
/// <summary>
/// The entry types for a quick dialog.
/// </summary>
public enum QuickDialogEntryType
{
/// <summary>
/// Any integer.
/// </summary>
Integer,
/// <summary>
/// Any floating point value.
/// </summary>
Float,
/// <summary>
/// Maximum of 100 characters string.
/// </summary>
ShortText,
/// <summary>
/// Maximum of 2,000 characters string.
/// </summary>
LongText,
}