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

View File

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

View File

@@ -129,12 +129,12 @@ public sealed class ObjectivesSystem : SharedObjectivesSystem
var agentSummary = new StringBuilder(); var agentSummary = new StringBuilder();
agentSummary.AppendLine(Loc.GetString("objectives-with-objectives", ("custody", custody), ("title", title), ("agent", agent))); 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: //TO DO:
//check for the right group here. Getting the target issuer is easy: objectiveGroup.Key //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. //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) foreach (var objective in objectiveGroup)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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