Changes for prototype load parallelization (#13066)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
584921b423
commit
a323671984
@@ -75,7 +75,7 @@ namespace Content.Client.Access.UI
|
||||
|
||||
var newButton = new Button
|
||||
{
|
||||
Text = accessLevel.Name,
|
||||
Text = GetAccessLevelName(accessLevel),
|
||||
ToggleMode = true,
|
||||
};
|
||||
AccessLevelGrid.AddChild(newButton);
|
||||
@@ -84,6 +84,14 @@ namespace Content.Client.Access.UI
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetAccessLevelName(AccessLevelPrototype prototype)
|
||||
{
|
||||
if (prototype.Name is { } name)
|
||||
return Loc.GetString(name);
|
||||
|
||||
return prototype.ID;
|
||||
}
|
||||
|
||||
private void ClearAllAccess()
|
||||
{
|
||||
foreach (var button in _accessButtons.Values)
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
|
||||
foreach (var gas in _gasData)
|
||||
{
|
||||
GasOptions.AddItem($"{gas.Name} ({gas.ID})");
|
||||
var gasName = Loc.GetString(gas.Name);
|
||||
GasOptions.AddItem($"{gasName} ({gas.ID})");
|
||||
}
|
||||
|
||||
GasOptions.OnItemSelected += eventArgs => GasOptions.SelectId(eventArgs.Id);
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
|
||||
foreach (var gas in _gasData)
|
||||
{
|
||||
GasOptions.AddItem($"{gas.Name} ({gas.ID})");
|
||||
var gasName = Loc.GetString(gas.Name);
|
||||
GasOptions.AddItem($"{gasName} ({gas.ID})");
|
||||
}
|
||||
|
||||
GasOptions.OnItemSelected += eventArgs => GasOptions.SelectId(eventArgs.Id);
|
||||
|
||||
@@ -85,7 +85,8 @@ namespace Content.Client.Atmos.UI
|
||||
{
|
||||
var atmos = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AtmosphereSystem>();
|
||||
var gas = atmos.GetGas((Gas) cast.FilteredGas);
|
||||
_window.SetGasFiltered(gas.ID, gas.Name);
|
||||
var gasName = Loc.GetString(gas.Name);
|
||||
_window.SetGasFiltered(gas.ID, gasName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -83,7 +83,8 @@ namespace Content.Client.Atmos.UI
|
||||
|
||||
foreach (GasPrototype gas in gases)
|
||||
{
|
||||
GasList.Add(GetGasItem(gas.ID, gas.Name, GasList));
|
||||
var gasName = Loc.GetString(gas.Name);
|
||||
GasList.Add(GetGasItem(gas.ID, gasName, GasList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace Content.Client.Construction.UI
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(category) && category != Loc.GetString("construction-category-all"))
|
||||
if (!string.IsNullOrEmpty(category) && category != "construction-category-all")
|
||||
{
|
||||
if (recipe.Category != category)
|
||||
continue;
|
||||
@@ -178,7 +178,7 @@ namespace Content.Client.Construction.UI
|
||||
var uniqueCategories = new HashSet<string>();
|
||||
|
||||
// hard-coded to show all recipes
|
||||
uniqueCategories.Add(Loc.GetString("construction-category-all"));
|
||||
uniqueCategories.Add("construction-category-all");
|
||||
|
||||
foreach (var prototype in _prototypeManager.EnumeratePrototypes<ConstructionPrototype>())
|
||||
{
|
||||
@@ -190,13 +190,13 @@ namespace Content.Client.Construction.UI
|
||||
|
||||
_constructionView.Category.Clear();
|
||||
|
||||
var array = uniqueCategories.ToArray();
|
||||
var array = uniqueCategories.OrderBy(Loc.GetString).ToArray();
|
||||
Array.Sort(array);
|
||||
|
||||
for (var i = 0; i < array.Length; i++)
|
||||
{
|
||||
var category = array[i];
|
||||
_constructionView.Category.AddItem(category, i);
|
||||
_constructionView.Category.AddItem(Loc.GetString(category), i);
|
||||
}
|
||||
|
||||
_constructionView.Categories = array;
|
||||
|
||||
@@ -72,13 +72,10 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(id, out MaterialPrototype? material))
|
||||
continue;
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
var mat = Loc.GetString("lathe-menu-material-display",
|
||||
("material", material.Name), ("amount", amount));
|
||||
Materials.AddItem(mat, _spriteSystem.Frame0(material.Icon), false);
|
||||
}
|
||||
var name = Loc.GetString(material.Name);
|
||||
var mat = Loc.GetString("lathe-menu-material-display",
|
||||
("material", name), ("amount", amount));
|
||||
Materials.AddItem(mat, _spriteSystem.Frame0(material.Icon), false);
|
||||
}
|
||||
|
||||
if (Materials.Count == 0)
|
||||
@@ -140,7 +137,7 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
|
||||
sb.Append(adjustedAmount);
|
||||
sb.Append(' ');
|
||||
sb.Append(proto.Name);
|
||||
sb.Append(Loc.GetString(proto.Name));
|
||||
}
|
||||
|
||||
var icon = _spriteSystem.Frame0(prototype.Icon);
|
||||
|
||||
@@ -86,7 +86,7 @@ public sealed partial class MappingSystem : EntitySystem
|
||||
{
|
||||
CheckCanInteract = false,
|
||||
Event = actionEvent,
|
||||
DisplayName = tileDef.Name,
|
||||
DisplayName = Loc.GetString(tileDef.Name),
|
||||
Icon = tileIcon
|
||||
};
|
||||
|
||||
|
||||
@@ -470,7 +470,7 @@ namespace Content.Client.Preferences.UI
|
||||
|
||||
_antagPreferences = new List<AntagPreferenceSelector>();
|
||||
|
||||
foreach (var antag in prototypeManager.EnumeratePrototypes<AntagPrototype>().OrderBy(a => a.Name))
|
||||
foreach (var antag in prototypeManager.EnumeratePrototypes<AntagPrototype>().OrderBy(a => Loc.GetString(a.Name)))
|
||||
{
|
||||
if (!antag.SetPreference)
|
||||
{
|
||||
@@ -492,7 +492,7 @@ namespace Content.Client.Preferences.UI
|
||||
|
||||
#region Traits
|
||||
|
||||
var traits = prototypeManager.EnumeratePrototypes<TraitPrototype>().OrderBy(t => t.Name).ToList();
|
||||
var traits = prototypeManager.EnumeratePrototypes<TraitPrototype>().OrderBy(t => Loc.GetString(t.Name)).ToList();
|
||||
_traitPreferences = new List<TraitPreferenceSelector>();
|
||||
_tabContainer.SetTabTitle(3, Loc.GetString("humanoid-profile-editor-traits-tab"));
|
||||
|
||||
@@ -1238,12 +1238,12 @@ namespace Content.Client.Preferences.UI
|
||||
{
|
||||
Antag = antag;
|
||||
|
||||
_checkBox = new CheckBox {Text = $"{antag.Name}"};
|
||||
_checkBox = new CheckBox {Text = Loc.GetString(antag.Name)};
|
||||
_checkBox.OnToggled += OnCheckBoxToggled;
|
||||
|
||||
if (antag.Description != null)
|
||||
{
|
||||
_checkBox.ToolTip = antag.Description;
|
||||
_checkBox.ToolTip = Loc.GetString(antag.Description);
|
||||
_checkBox.TooltipDelay = 0.2f;
|
||||
}
|
||||
|
||||
@@ -1280,12 +1280,12 @@ namespace Content.Client.Preferences.UI
|
||||
{
|
||||
Trait = trait;
|
||||
|
||||
_checkBox = new CheckBox {Text = $"{trait.Name}"};
|
||||
_checkBox = new CheckBox {Text = Loc.GetString(trait.Name)};
|
||||
_checkBox.OnToggled += OnCheckBoxToggled;
|
||||
|
||||
if (trait.Description != null)
|
||||
if (trait.Description is { } desc)
|
||||
{
|
||||
_checkBox.ToolTip = trait.Description;
|
||||
_checkBox.ToolTip = Loc.GetString(desc);
|
||||
_checkBox.TooltipDelay = 0.2f;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,24 +113,33 @@ namespace Content.Client.Research.UI
|
||||
// For now, we retrieve all technologies. In the future, this should be changed.
|
||||
foreach (var tech in prototypeMan.EnumeratePrototypes<TechnologyPrototype>())
|
||||
{
|
||||
var techName = GetTechName(tech);
|
||||
if (Owner.IsTechnologyUnlocked(tech))
|
||||
{
|
||||
UnlockedTechnologies.AddItem(tech.Name, tech.Icon.Frame0());
|
||||
UnlockedTechnologies.AddItem(techName, tech.Icon.Frame0());
|
||||
_unlockedTechnologyPrototypes.Add(tech);
|
||||
}
|
||||
else if (Owner.CanUnlockTechnology(tech))
|
||||
{
|
||||
UnlockableTechnologies.AddItem(tech.Name, tech.Icon.Frame0());
|
||||
UnlockableTechnologies.AddItem(techName, tech.Icon.Frame0());
|
||||
_unlockableTechnologyPrototypes.Add(tech);
|
||||
}
|
||||
else
|
||||
{
|
||||
FutureTechnologies.AddItem(tech.Name, tech.Icon.Frame0());
|
||||
FutureTechnologies.AddItem(techName, tech.Icon.Frame0());
|
||||
_futureTechnologyPrototypes.Add(tech);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetTechName(TechnologyPrototype prototype)
|
||||
{
|
||||
if (prototype.Name is { } name)
|
||||
return Loc.GetString(name);
|
||||
|
||||
return prototype.ID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills the selected technology controls with details.
|
||||
/// </summary>
|
||||
@@ -145,8 +154,9 @@ namespace Content.Client.Research.UI
|
||||
}
|
||||
|
||||
TechnologyIcon.Texture = TechnologySelected.Icon.Frame0();
|
||||
TechnologyName.Text = TechnologySelected.Name;
|
||||
TechnologyDescription.Text = TechnologySelected.Description + $"\n{TechnologySelected.RequiredPoints} " + Loc.GetString("research-console-menu-research-points-text" ,("points", Owner.Points)).ToLowerInvariant();
|
||||
TechnologyName.Text = GetTechName(TechnologySelected);
|
||||
var desc = Loc.GetString(TechnologySelected.Description);
|
||||
TechnologyDescription.Text = desc + $"\n{TechnologySelected.RequiredPoints} " + Loc.GetString("research-console-menu-research-points-text" ,("points", Owner.Points)).ToLowerInvariant();
|
||||
TechnologyRequirements.Text = Loc.GetString("research-console-tech-requirements-none");
|
||||
|
||||
var prototypeMan = IoCManager.Resolve<IPrototypeManager>();
|
||||
@@ -155,10 +165,11 @@ namespace Content.Client.Research.UI
|
||||
{
|
||||
var requiredId = TechnologySelected.RequiredTechnologies[i];
|
||||
if (!prototypeMan.TryIndex(requiredId, out TechnologyPrototype? prototype)) continue;
|
||||
var protoName = GetTechName(prototype);
|
||||
if (i == 0)
|
||||
TechnologyRequirements.Text = Loc.GetString("research-console-tech-requirements-prototype-name", ("prototypeName", prototype.Name));
|
||||
TechnologyRequirements.Text = Loc.GetString("research-console-tech-requirements-prototype-name", ("prototypeName", protoName));
|
||||
else
|
||||
TechnologyRequirements.Text += $", {prototype.Name}";
|
||||
TechnologyRequirements.Text += $", {protoName}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Alert;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.UserInterface.Systems.Alerts.Controls
|
||||
{
|
||||
@@ -65,7 +66,9 @@ namespace Content.Client.UserInterface.Systems.Alerts.Controls
|
||||
|
||||
private Control SupplyTooltip(Control? sender)
|
||||
{
|
||||
return new ActionAlertTooltip(Alert.Name, Alert.Description) {Cooldown = Cooldown};
|
||||
var msg = FormattedMessage.FromMarkup(Loc.GetString(Alert.Name));
|
||||
var desc = FormattedMessage.FromMarkup(Loc.GetString(Alert.Description));
|
||||
return new ActionAlertTooltip(msg, desc) {Cooldown = Cooldown};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user