Add description tooltips to traits, jobs and antagonists (#11661)
Co-authored-by: CommieFlowers <rasmus.cedergren@hotmail.com>
This commit is contained in:
@@ -1099,6 +1099,7 @@ namespace Content.Client.Preferences.UI
|
||||
|
||||
private StripeBack _lockStripe;
|
||||
private Label _requirementsLabel;
|
||||
private Label _jobTitle;
|
||||
|
||||
public JobPrioritySelector(JobPrototype job)
|
||||
{
|
||||
@@ -1156,13 +1157,25 @@ namespace Content.Client.Preferences.UI
|
||||
}
|
||||
};
|
||||
|
||||
_jobTitle = new Label()
|
||||
{
|
||||
Text = job.LocalizedName,
|
||||
MinSize = (175, 0)
|
||||
};
|
||||
|
||||
if (job.LocalizedDescription != null)
|
||||
{
|
||||
_jobTitle.ToolTip = job.LocalizedDescription;
|
||||
_jobTitle.TooltipDelay = 0.2f;
|
||||
}
|
||||
|
||||
AddChild(new BoxContainer
|
||||
{
|
||||
Orientation = LayoutOrientation.Horizontal,
|
||||
Children =
|
||||
{
|
||||
icon,
|
||||
new Label {Text = job.LocalizedName, MinSize = (175, 0)},
|
||||
_jobTitle,
|
||||
_optionButton,
|
||||
_lockStripe,
|
||||
}
|
||||
@@ -1227,6 +1240,12 @@ namespace Content.Client.Preferences.UI
|
||||
_checkBox = new CheckBox {Text = $"{antag.Name}"};
|
||||
_checkBox.OnToggled += OnCheckBoxToggled;
|
||||
|
||||
if (antag.Description != null)
|
||||
{
|
||||
_checkBox.ToolTip = antag.Description;
|
||||
_checkBox.TooltipDelay = 0.2f;
|
||||
}
|
||||
|
||||
AddChild(new BoxContainer
|
||||
{
|
||||
Orientation = LayoutOrientation.Horizontal,
|
||||
@@ -1263,6 +1282,12 @@ namespace Content.Client.Preferences.UI
|
||||
_checkBox = new CheckBox {Text = $"{trait.Name}"};
|
||||
_checkBox.OnToggled += OnCheckBoxToggled;
|
||||
|
||||
if (trait.Description != null)
|
||||
{
|
||||
_checkBox.ToolTip = trait.Description;
|
||||
_checkBox.TooltipDelay = 0.2f;
|
||||
}
|
||||
|
||||
AddChild(new BoxContainer
|
||||
{
|
||||
Orientation = LayoutOrientation.Horizontal,
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Content.Shared.Roles
|
||||
{
|
||||
private string _name = string.Empty;
|
||||
private string _objective = string.Empty;
|
||||
private string? _description = string.Empty;
|
||||
|
||||
[ViewVariables]
|
||||
[IdDataFieldAttribute]
|
||||
@@ -25,6 +26,16 @@ namespace Content.Shared.Roles
|
||||
private set => _name = Loc.GetString(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The description of this antag shown in a tooltip.
|
||||
/// </summary>
|
||||
[DataField("description")]
|
||||
public string? Description
|
||||
{
|
||||
get => _description;
|
||||
private set => _description = value is null ? null : Loc.GetString(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The antag's objective, displayed at round-start to the player.
|
||||
/// </summary>
|
||||
|
||||
@@ -31,6 +31,15 @@ namespace Content.Shared.Roles
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public string LocalizedName => Loc.GetString(Name);
|
||||
|
||||
/// <summary>
|
||||
/// The name of this job as displayed to players.
|
||||
/// </summary>
|
||||
[DataField("description")]
|
||||
public string? Description { get; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public string? LocalizedDescription => Description is null ? null : Loc.GetString(Description);
|
||||
|
||||
[DataField("requirements")]
|
||||
public HashSet<JobRequirement>? Requirements;
|
||||
|
||||
|
||||
@@ -19,6 +19,12 @@ namespace Content.Shared.Traits
|
||||
[DataField("name")]
|
||||
public string Name { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The description of this trait.
|
||||
/// </summary>
|
||||
[DataField("description")]
|
||||
public string? Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The components that get added to the player, when they pick this trait.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
- type: trait
|
||||
id: Blindness
|
||||
name: Blindness
|
||||
description: You lack vision
|
||||
components:
|
||||
- type: PermanentBlindness
|
||||
|
||||
- type: trait
|
||||
id: Narcolepsy
|
||||
name: Narcolepsy
|
||||
description: You fall asleep randomly
|
||||
components:
|
||||
- type: Narcolepsy
|
||||
timeBetweenIncidents: 300, 600
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
- type: trait
|
||||
id: UncontrollableSneezing
|
||||
name: Runny nose
|
||||
description: You sneeze and cough uncontrollably
|
||||
components:
|
||||
- type: UncontrollableSnough
|
||||
snoughSound:
|
||||
|
||||
Reference in New Issue
Block a user