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