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