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

@@ -38,25 +38,25 @@ namespace Content.Client.Popups
#region Actual Implementation
public void PopupCursor(string message)
public void PopupCursor(string message, PopupType type=PopupType.Small)
{
var label = new CursorPopupLabel(_inputManager.MouseScreenPosition)
{
Text = message,
StyleClasses = { StyleNano.StyleClassPopupMessage },
StyleClasses = { GetStyleClass(type) },
};
_userInterfaceManager.PopupRoot.AddChild(label);
_aliveCursorLabels.Add(label);
}
public void PopupCoordinates(string message, EntityCoordinates coordinates)
public void PopupCoordinates(string message, EntityCoordinates coordinates, PopupType type=PopupType.Small)
{
if (_eyeManager.CurrentMap != Transform(coordinates.EntityId).MapID)
return;
PopupMessage(message, coordinates, null);
PopupMessage(message, type, coordinates, null);
}
public void PopupEntity(string message, EntityUid uid)
public void PopupEntity(string message, EntityUid uid, PopupType type=PopupType.Small)
{
if (!EntityManager.EntityExists(uid))
return;
@@ -65,16 +65,16 @@ namespace Content.Client.Popups
if (_eyeManager.CurrentMap != transform.MapID)
return; // TODO: entity may be outside of PVS, but enter PVS at a later time. So the pop-up should still get tracked?
PopupMessage(message, transform.Coordinates, uid);
PopupMessage(message, type, transform.Coordinates, uid);
}
private void PopupMessage(string message, EntityCoordinates coordinates, EntityUid? entity = null)
private void PopupMessage(string message, PopupType type, EntityCoordinates coordinates, EntityUid? entity = null)
{
var label = new WorldPopupLabel(_eyeManager, EntityManager)
{
Entity = entity,
Text = message,
StyleClasses = { StyleNano.StyleClassPopupMessage },
StyleClasses = { GetStyleClass(type) },
};
_userInterfaceManager.PopupRoot.AddChild(label);
@@ -88,28 +88,28 @@ namespace Content.Client.Popups
#region Abstract Method Implementations
public override void PopupCursor(string message, Filter filter)
public override void PopupCursor(string message, Filter filter, PopupType type=PopupType.Small)
{
if (!filter.CheckPrediction)
return;
PopupCursor(message);
PopupCursor(message, type);
}
public override void PopupCoordinates(string message, EntityCoordinates coordinates, Filter filter)
public override void PopupCoordinates(string message, EntityCoordinates coordinates, Filter filter, PopupType type=PopupType.Small)
{
if (!filter.CheckPrediction)
return;
PopupCoordinates(message, coordinates);
PopupCoordinates(message, coordinates, type);
}
public override void PopupEntity(string message, EntityUid uid, Filter filter)
public override void PopupEntity(string message, EntityUid uid, Filter filter, PopupType type=PopupType.Small)
{
if (!filter.CheckPrediction)
return;
PopupEntity(message, uid);
PopupEntity(message, uid, type);
}
#endregion
@@ -118,17 +118,17 @@ namespace Content.Client.Popups
private void OnPopupCursorEvent(PopupCursorEvent ev)
{
PopupCursor(ev.Message);
PopupCursor(ev.Message, ev.Type);
}
private void OnPopupCoordinatesEvent(PopupCoordinatesEvent ev)
{
PopupCoordinates(ev.Message, ev.Coordinates);
PopupCoordinates(ev.Message, ev.Coordinates, ev.Type);
}
private void OnPopupEntityEvent(PopupEntityEvent ev)
{
PopupEntity(ev.Message, ev.Uid);
PopupEntity(ev.Message, ev.Uid, ev.Type);
}
private void OnRoundRestart(RoundRestartCleanupEvent ev)
@@ -143,6 +143,16 @@ namespace Content.Client.Popups
#endregion
private static string GetStyleClass(PopupType type) =>
type switch
{
PopupType.Small => StyleNano.StyleClassPopupMessageSmall,
PopupType.Medium => StyleNano.StyleClassPopupMessageMedium,
PopupType.Large => StyleNano.StyleClassPopupMessageLarge,
PopupType.Critical => StyleNano.StyleClassPopupMessageCritical,
_ => StyleNano.StyleClassPopupMessageSmall
};
public override void FrameUpdate(float frameTime)
{
if (_aliveWorldLabels.Count == 0) return;

View File

@@ -74,7 +74,11 @@ namespace Content.Client.Stylesheets
public const string StyleClassLabelSecondaryColor = "LabelSecondaryColor";
public const string StyleClassLabelBig = "LabelBig";
public const string StyleClassButtonBig = "ButtonBig";
public const string StyleClassPopupMessage = "PopupMessage";
public const string StyleClassPopupMessageSmall = "PopupMessageSmall";
public const string StyleClassPopupMessageMedium = "PopupMessageMedium";
public const string StyleClassPopupMessageLarge = "PopupMessageLarge";
public const string StyleClassPopupMessageCritical = "PopupMessageCritical";
public static readonly Color NanoGold = Color.FromHex("#A88B5E");
public static readonly Color GoodGreenFore = Color.FromHex("#31843E");
@@ -134,6 +138,8 @@ namespace Content.Client.Stylesheets
var notoSansItalic12 = resCache.NotoStack(variation: "Italic", size: 12);
var notoSansBold12 = resCache.NotoStack(variation: "Bold", size: 12);
var notoSansBoldItalic12 = resCache.NotoStack(variation: "BoldItalic", size: 12);
var notoSansBoldItalic14 = resCache.NotoStack(variation: "BoldItalic", size: 14);
var notoSansBoldItalic16 = resCache.NotoStack(variation: "BoldItalic", size: 16);
var notoSansDisplayBold14 = resCache.NotoStack(variation: "Bold", display: true, size: 14);
var notoSansDisplayBold16 = resCache.NotoStack(variation: "Bold", display: true, size: 16);
var notoSans15 = resCache.NotoStack(variation: "Regular", size: 15);
@@ -1033,13 +1039,34 @@ namespace Content.Client.Stylesheets
}),
// Popup messages
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessage}, null, null),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageSmall}, null, null),
new[]
{
new StyleProperty("font", notoSansItalic10),
new StyleProperty("font-color", Color.White),
}),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageMedium}, null, null),
new[]
{
new StyleProperty("font", notoSansItalic12),
new StyleProperty("font-color", Color.LightGray),
}),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageLarge}, null, null),
new[]
{
new StyleProperty("font", notoSansBoldItalic14),
new StyleProperty("font-color", Color.LightGray),
}),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessageCritical}, null, null),
new[]
{
new StyleProperty("font", notoSansBoldItalic16),
new StyleProperty("font-color", Color.Red),
}),
//APC and SMES power state label colors
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPowerStateNone}, null, null), new[]
{