]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Character menu issuer localization (#29840)
authorEd <96445749+TheShuEd@users.noreply.github.com>
Wed, 17 Jul 2024 05:47:50 +0000 (08:47 +0300)
committerGitHub <noreply@github.com>
Wed, 17 Jul 2024 05:47:50 +0000 (08:47 +0300)
* Update CharacterUIController.cs

* TODO Burn this shit

* huh?

* huh!

---------

Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>
Content.Client/UserInterface/Systems/Character/CharacterUIController.cs
Content.Server/CharacterInfo/CharacterInfoSystem.cs
Content.Server/Objectives/ObjectivesSystem.cs
Content.Shared/Objectives/Components/ObjectiveComponent.cs
Resources/Prototypes/Objectives/dragon.yml
Resources/Prototypes/Objectives/ninja.yml
Resources/Prototypes/Objectives/thief.yml
Resources/Prototypes/Objectives/traitor.yml

index 88edb6a4f12e2a23bd67552bdf79d1a9a5cb8cac..1e4d2f2765797aae14c56d6967a3eb03bc5a5833 100644 (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)
             {
index cb2216b5e3b49927251c26770b2d8f41c58ee4ba..3099b2f90fc9622838f2b0b96c88522c69420080 100644 (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);
index c9cdf244e660b206bcbeccffb517fc8ba8f4eefe..382cb1ab4419b0ebc1c88c13416ebc60a0e7d84b 100644 (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)
                 {
index 36d3fa0bded7e4ed1f7d2ce2402473b58b636263..fb2e6ca0a6861486b08786ce00bd4b7c982071f9 100644 (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.
index 10ca942cb39a7be84e724ac1e5b9c827e9081acd..bbdac8faa1a9a0386e41d728aac33b9e9fef44bf 100644 (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:
index 77628a68cf12c28942a6d77263e3f9b9b2a62026..4d0cf6c17c83b0f0695e3d02754ed41511a42bdd 100644 (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:
index 8b5307e9a0930edae8e9688d2b544d70be7b2152..cc94ab02b34f3bc9d30d1a7aa644e28756a5bc13 100644 (file)
@@ -4,7 +4,7 @@
   id: BaseThiefObjective
   components:
   - type: Objective
-    issuer: thief
+    issuer: objective-issuer-thief
   - type: RoleRequirement
     roles:
       components:
index ad5f56a443eae0e661ffddcfcc4a5cb4fdf5f3a3..edf191b420dd16455deb913937b07dfb68b4e89f 100644 (file)
@@ -4,7 +4,7 @@
   id: BaseTraitorObjective
   components:
   - type: Objective
-    issuer: syndicate
+    issuer: objective-issuer-syndicate
   - type: RoleRequirement
     roles:
       components: