Localize difficulty settings.
This commit is contained in:
committed by
Gustas
parent
af6330b1bd
commit
4f7a01a291
@@ -23,9 +23,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string ID = null;
|
||||
|
||||
[FieldLoader.Require]
|
||||
[TranslationReference]
|
||||
[Desc("Descriptive label for this option.")]
|
||||
public readonly string Label = null;
|
||||
|
||||
[TranslationReference]
|
||||
[Desc("Tooltip description for this option.")]
|
||||
public readonly string Description = null;
|
||||
|
||||
@@ -34,6 +36,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string Default = null;
|
||||
|
||||
[FieldLoader.Require]
|
||||
[TranslationReference(dictionaryReference: LintDictionaryReference.Values)]
|
||||
[Desc("Difficulty levels supported by the map.")]
|
||||
public readonly Dictionary<string, string> Values = null;
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
[TranslationReference]
|
||||
const string CantPlayCancel = "dialog-cant-play-video.cancel";
|
||||
|
||||
[TranslationReference]
|
||||
const string DifficultyNormal = "options-difficulty.normal";
|
||||
|
||||
readonly ModData modData;
|
||||
readonly Action onStart;
|
||||
readonly ScrollPanelWidget descriptionPanel;
|
||||
@@ -286,14 +289,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
if (difficultyButton != null)
|
||||
{
|
||||
var difficultyName = new CachedTransform<string, string>(id => id == null || !difficulties.ContainsKey(id) ? "Normal" : difficulties[id]);
|
||||
var difficultyName = new CachedTransform<string, string>(id => preview.GetLocalisedString(
|
||||
id == null || !difficulties.ContainsKey(id) ? DifficultyNormal : difficulties[id]));
|
||||
|
||||
difficultyButton.IsDisabled = () => difficultyDisabled;
|
||||
difficultyButton.GetText = () => difficultyName.Update(difficulty);
|
||||
difficultyButton.OnMouseDown = _ =>
|
||||
{
|
||||
var options = difficulties.Select(kv => new DropDownOption
|
||||
{
|
||||
Title = kv.Value,
|
||||
Title = preview.GetLocalisedString(kv.Value),
|
||||
IsSelected = () => difficulty == kv.Key,
|
||||
OnClick = () => difficulty = kv.Key
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user