Character menu issuer localization (#29840)

* Update CharacterUIController.cs

* TODO Burn this shit

* huh?

* huh!

---------

Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>
This commit is contained in:
Ed
2024-07-17 08:47:50 +03:00
committed by GitHub
parent 11320f4d2c
commit d8ab4982ad
8 changed files with 24 additions and 13 deletions

View File

@@ -1,11 +1,13 @@
using System.Linq;
using Content.Client.CharacterInfo;
using Content.Client.Gameplay;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.Character.Controls;
using Content.Client.UserInterface.Systems.Character.Windows;
using Content.Client.UserInterface.Systems.Objectives.Controls;
using Content.Shared.Input;
using Content.Shared.Objectives.Systems;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
@@ -121,11 +123,17 @@ public sealed class CharacterUIController : UIController, IOnStateEntered<Gamepl
Modulate = Color.Gray
};
objectiveControl.AddChild(new Label
var objectiveText = new FormattedMessage();
objectiveText.TryAddMarkup(groupId, out _);
var objectiveLabel = new RichTextLabel
{
Text = groupId,
Modulate = Color.LightSkyBlue
});
StyleClasses = {StyleNano.StyleClassTooltipActionTitle}
};
objectiveLabel.SetMessage(objectiveText);
objectiveControl.AddChild(objectiveLabel);
foreach (var condition in conditions)
{

View File

@@ -43,7 +43,7 @@ public sealed class CharacterInfoSystem : EntitySystem
continue;
// group objectives by their issuer
var issuer = Comp<ObjectiveComponent>(objective).Issuer;
var issuer = Comp<ObjectiveComponent>(objective).LocIssuer;
if (!objectives.ContainsKey(issuer))
objectives[issuer] = new List<ObjectiveInfo>();
objectives[issuer].Add(info.Value);

View File

@@ -129,12 +129,12 @@ public sealed class ObjectivesSystem : SharedObjectivesSystem
var agentSummary = new StringBuilder();
agentSummary.AppendLine(Loc.GetString("objectives-with-objectives", ("custody", custody), ("title", title), ("agent", agent)));
foreach (var objectiveGroup in objectives.GroupBy(o => Comp<ObjectiveComponent>(o).Issuer))
foreach (var objectiveGroup in objectives.GroupBy(o => Comp<ObjectiveComponent>(o).LocIssuer))
{
//TO DO:
//check for the right group here. Getting the target issuer is easy: objectiveGroup.Key
//It should be compared to the type of the group's issuer.
agentSummary.AppendLine(Loc.GetString($"objective-issuer-{objectiveGroup.Key}"));
agentSummary.AppendLine(objectiveGroup.Key);
foreach (var objective in objectiveGroup)
{

View File

@@ -22,8 +22,11 @@ public sealed partial class ObjectiveComponent : Component
/// <summary>
/// Organisation that issued this objective, used for grouping and as a header above common objectives.
/// </summary>
[DataField(required: true)]
public string Issuer = string.Empty;
[DataField("issuer", required: true)]
private LocId Issuer { get; set; }
[ViewVariables(VVAccess.ReadOnly)]
public string LocIssuer => Loc.GetString(Issuer);
/// <summary>
/// Unique objectives can only have 1 per prototype id.

View File

@@ -6,7 +6,7 @@
- type: Objective
# difficulty isn't used at all since objective are fixed
difficulty: 1.5
issuer: dragon
issuer: objective-issuer-dragon
- type: RoleRequirement
roles:
components:

View File

@@ -6,7 +6,7 @@
- type: Objective
# difficulty isn't used since all objectives are picked
difficulty: 1.5
issuer: spiderclan
issuer: objective-issuer-spiderclan
- type: RoleRequirement
roles:
components:

View File

@@ -4,7 +4,7 @@
id: BaseThiefObjective
components:
- type: Objective
issuer: thief
issuer: objective-issuer-thief
- type: RoleRequirement
roles:
components:

View File

@@ -4,7 +4,7 @@
id: BaseTraitorObjective
components:
- type: Objective
issuer: syndicate
issuer: objective-issuer-syndicate
- type: RoleRequirement
roles:
components: