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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user