Skip to content

Commit

Permalink
localisation !!!
Browse files Browse the repository at this point in the history
ui is still broken and i have no idea how to fix tho...
  • Loading branch information
Callmore committed Oct 23, 2024
1 parent 53ca996 commit 6a45c1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Content.Client/_SSS/UserInterface/SSSStatusUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Robust.Client.Player;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Robust.Shared.Timing;
Expand Down Expand Up @@ -75,7 +74,7 @@ public void UpdateHealth(Entity<DamageableComponent> ent)

if (mobState.CurrentState == MobState.Dead)
{
SetHealthBarUI("DEAD", 0, 100);
SetHealthBarUI(Loc.GetString("suspicion-status-ui-health-dead"), 0, 100);
return;
}

Expand Down Expand Up @@ -149,7 +148,7 @@ public void UpdateTimerEnd(SuspicionRuleTimerUpdate ev, EntitySessionEventArgs a
public void PreroundStarted(SuspicionRulePreroundStarted ev, EntitySessionEventArgs args)
{
_lastEndTime = ev.PreroundEndTime;
SetRoleUI("Preround", Color.DarkGray);
SetRoleToPreround();
}

private void SetRoleUI(string role, Color color)
Expand Down Expand Up @@ -183,17 +182,24 @@ private bool SetRoleFromQueued()

private void SetRoleToPreround()
{
SetRoleUI("Preround", Color.Gray);
SetRoleUI(Loc.GetString("suspicion-status-ui-role-preround"), Color.Gray);
}

private void SetRoleToObserbing()
{
SetRoleUI("Obserbing", Color.Gray);
SetRoleUI(Loc.GetString("suspicion-status-ui-role-obserbing"), Color.Gray);
}

public void UpdateRoleDisplay(SuspicionRuleUpdateRole ev, EntitySessionEventArgs args)
{
SetRoleUI(ev.NewRole.ToString(), Color.FromName(ev.NewRole.GetRoleColor()));
var roleName = Loc.GetString(ev.NewRole switch
{
SuspicionRole.Traitor => "roles-antag-suspicion-traitor-name",
SuspicionRole.Detective => "roles-antag-suspicion-detective-name",
SuspicionRole.Innocent => "roles-antag-suspicion-innocent-name",
_ => "roles-antag-suspicion-unknown",
});
SetRoleUI(roleName, Color.FromName(ev.NewRole.GetRoleColor()));
}

public void UpdatePlayerSpawn(SuspicionRulePlayerSpawn ev, EntitySessionEventArgs args)
Expand Down Expand Up @@ -226,8 +232,6 @@ public void OnSystemUnloaded(SSSStatusUISystem system)

public void OnStateEntered(GameplayState state)
{
_log.Debug($"Entered: {nameof(GameplayState)}");

if (EntityManager.TryGetComponent<DamageableComponent>(_playerManager.LocalEntity!.Value, out var damagable))
UpdateHealth((_playerManager.LocalEntity!.Value, damagable));
else
Expand All @@ -240,8 +244,6 @@ public void OnStateEntered(GameplayState state)

public void OnStateExited(GameplayState state)
{
_log.Debug($"Entered: {nameof(GameplayState)}");

SetHealthBarUI("-", 0, 100);

UpdateTimer(TimeSpan.Zero);
Expand Down
6 changes: 6 additions & 0 deletions Resources/Locale/en-US/_SSS/suspicion.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ roles-antag-suspicion-pending-name = Pending
roles-antag-suspicion-pending-objective = The game is still starting, wait for your role to be assigned.
roles-antag-suspicion-detective-name = Detective
roles-antag-suspicion-detective-objective = Discover and eliminate all traitors with your special tools.
roles-antag-suspicion-unknown = Unknown
suspicion-status-ui-health-dead = DEAD
suspicion-status-ui-role-obserbing = Obserbing
suspicion-status-ui-role-preround = Preround

0 comments on commit 6a45c1a

Please sign in to comment.