Expose game speeds to localisation.
This commit is contained in:
committed by
abcdefg30
parent
425c678cd9
commit
efe65701e4
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
techLevels, TechLevel, TechLevelDropdownLocked);
|
||||
|
||||
var gameSpeeds = Game.ModData.Manifest.Get<GameSpeeds>();
|
||||
var speeds = gameSpeeds.Speeds.ToDictionary(s => s.Key, s => s.Value.Name);
|
||||
var speeds = gameSpeeds.Speeds.ToDictionary(s => s.Key, s => Game.ModData.Translation.GetString(s.Value.Name));
|
||||
|
||||
// NOTE: This is just exposing the UI, the backend logic for this option is hardcoded in World
|
||||
yield return new LobbyOption("gamespeed", GameSpeedDropdownLabel, GameSpeedDropdownDescription, GameSpeedDropdownVisible, GameSpeedDropdownDisplayOrder,
|
||||
|
||||
@@ -314,12 +314,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var speeds = modData.Manifest.Get<GameSpeeds>().Speeds;
|
||||
gameSpeed = "default";
|
||||
|
||||
gameSpeedButton.GetText = () => speeds[gameSpeed].Name;
|
||||
var speedText = new CachedTransform<string, string>(s => modData.Translation.GetString(speeds[s].Name));
|
||||
gameSpeedButton.GetText = () => speedText.Update(gameSpeed);
|
||||
gameSpeedButton.OnMouseDown = _ =>
|
||||
{
|
||||
var options = speeds.Select(s => new DropDownOption
|
||||
{
|
||||
Title = s.Value.Name,
|
||||
Title = modData.Translation.GetString(s.Value.Name),
|
||||
IsSelected = () => gameSpeed == s.Key,
|
||||
OnClick = () => gameSpeed = s.Key
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user