Visual popup types (#9523)

* Visual popup types

* Pass over `PopupCoordinates` and `PopupCursor`

* `PopupEntity` pass

* Disease and reagent popup pass

* COLOUR
This commit is contained in:
Kara
2022-07-09 02:09:52 -07:00
committed by GitHub
parent 1d3d8efbc9
commit dc28b58468
47 changed files with 272 additions and 117 deletions

View File

@@ -14,7 +14,8 @@ namespace Content.Shared.Popups
/// </summary>
/// <param name="message">The message to display.</param>
/// <param name="filter">Filter for the players that will see the popup.</param>
public abstract void PopupCursor(string message, Filter filter);
/// <param name="type">Used to customize how this popup should appear visually.</param>
public abstract void PopupCursor(string message, Filter filter, PopupType type=PopupType.Small);
/// <summary>
/// Shows a popup at a world location.
@@ -22,7 +23,8 @@ namespace Content.Shared.Popups
/// <param name="message">The message to display.</param>
/// <param name="coordinates">The coordinates where to display the message.</param>
/// <param name="filter">Filter for the players that will see the popup.</param>
public abstract void PopupCoordinates(string message, EntityCoordinates coordinates, Filter filter);
/// <param name="type">Used to customize how this popup should appear visually.</param>
public abstract void PopupCoordinates(string message, EntityCoordinates coordinates, Filter filter, PopupType type=PopupType.Small);
/// <summary>
/// Shows a popup above an entity.
@@ -30,7 +32,8 @@ namespace Content.Shared.Popups
/// <param name="message">The message to display.</param>
/// <param name="uid">The UID of the entity.</param>
/// <param name="filter">Filter for the players that will see the popup.</param>
public abstract void PopupEntity(string message, EntityUid uid, Filter filter);
/// <param name="type">Used to customize how this popup should appear visually.</param>
public abstract void PopupEntity(string message, EntityUid uid, Filter filter, PopupType type=PopupType.Small);
}
/// <summary>
@@ -41,9 +44,12 @@ namespace Content.Shared.Popups
{
public string Message { get; }
protected PopupEvent(string message)
public PopupType Type { get; }
protected PopupEvent(string message, PopupType type)
{
Message = message;
Type = type;
}
}
@@ -53,7 +59,7 @@ namespace Content.Shared.Popups
[Serializable, NetSerializable]
public sealed class PopupCursorEvent : PopupEvent
{
public PopupCursorEvent(string message) : base(message)
public PopupCursorEvent(string message, PopupType type) : base(message, type)
{
}
}
@@ -66,7 +72,7 @@ namespace Content.Shared.Popups
{
public EntityCoordinates Coordinates { get; }
public PopupCoordinatesEvent(string message, EntityCoordinates coordinates) : base(message)
public PopupCoordinatesEvent(string message, PopupType type, EntityCoordinates coordinates) : base(message, type)
{
Coordinates = coordinates;
}
@@ -80,9 +86,41 @@ namespace Content.Shared.Popups
{
public EntityUid Uid { get; }
public PopupEntityEvent(string message, EntityUid uid) : base(message)
public PopupEntityEvent(string message, PopupType type, EntityUid uid) : base(message, type)
{
Uid = uid;
}
}
/// <summary>
/// Used to determine how a popup should appear visually to the client.
/// </summary>
/// <remarks>
/// Actions which can fail or succeed should use a smaller popup for failure and a larger popup for success.
/// Actions which have different popups for the user vs. others should use a larger popup for the user and a smaller popup for others.
/// Actions which result in immediate death for a user should almost always show as critical to all parties, such as suicides or smites.
/// </remarks>
[Serializable, NetSerializable]
public enum PopupType : byte
{
/// <summary>
/// Small popups are the default, and denote actions that may be spammable or are otherwise unimportant.
/// </summary>
Small,
/// <summary>
/// Medium popups should be used for actions which are not spammable but may not be particularly important.
/// </summary>
Medium,
/// <summary>
/// Large popups should be used for actions which may be important or very important to one or more users,
/// but is not life-threatening.
/// </summary>
Large,
/// <summary>
/// Critical popups should be used very sparingly, should not be used on anything that is spammable,
/// and should primarily be used when showing popups to one user. Critical popups denote actions which
/// may be directly life-threatening.
/// </summary>
Critical
}
}