Extract translation strings.
This commit is contained in:
committed by
teinarss
parent
8201a57b10
commit
cc58fe1a0f
@@ -25,6 +25,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
enum ActorIDStatus { Normal = 0, Duplicate = 1, Empty = 3 }
|
||||
|
||||
readonly WorldRenderer worldRenderer;
|
||||
readonly ModData modData;
|
||||
readonly EditorActorLayer editorActorLayer;
|
||||
readonly EditorActionManager editorActionManager;
|
||||
readonly EditorViewportControllerWidget editor;
|
||||
@@ -42,6 +43,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
readonly int editPanelPadding; // Padding between right edge of actor and the edit panel.
|
||||
readonly long scrollVisibleTimeout = 100; // Delay after scrolling map before edit widget becomes visible again.
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string DuplicateActorId = "duplicate-actor-id";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string EnterActorId = "enter-actor-id";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string Owner = "owner";
|
||||
|
||||
long lastScrollTime = 0;
|
||||
int2 lastScrollPosition = int2.Zero;
|
||||
|
||||
@@ -74,9 +85,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public ActorEditLogic(Widget widget, World world, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs)
|
||||
public ActorEditLogic(Widget widget, ModData modData, World world, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs)
|
||||
{
|
||||
this.modData = modData;
|
||||
this.worldRenderer = worldRenderer;
|
||||
|
||||
editorActorLayer = world.WorldActor.Trait<EditorActorLayer>();
|
||||
editorActionManager = world.WorldActor.Trait<EditorActionManager>();
|
||||
|
||||
@@ -101,7 +114,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
actorIDErrorLabel = actorEditPanel.Get<LabelWidget>("ACTOR_ID_ERROR_LABEL");
|
||||
actorIDErrorLabel.IsVisible = () => actorIDStatus != ActorIDStatus.Normal;
|
||||
actorIDErrorLabel.GetText = () => actorIDStatus == ActorIDStatus.Duplicate ?
|
||||
"Duplicate Actor ID" : "Enter an Actor ID";
|
||||
modData.Translation.GetString(DuplicateActorId)
|
||||
: modData.Translation.GetString(EnterActorId);
|
||||
|
||||
if (logicArgs.TryGetValue("EditPanelPadding", out var yaml))
|
||||
editPanelPadding = FieldLoader.GetValue<int>("EditPanelPadding", yaml.Value);
|
||||
@@ -131,7 +145,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (editorActorLayer[actorId] != null)
|
||||
{
|
||||
nextActorIDStatus = ActorIDStatus.Duplicate;
|
||||
actorIDErrorLabel.Text = "Duplicate ActorID";
|
||||
actorIDErrorLabel.Text = modData.Translation.GetString(DuplicateActorId);
|
||||
actorIDErrorLabel.Visible = true;
|
||||
return;
|
||||
}
|
||||
@@ -215,7 +229,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
// Add owner dropdown
|
||||
var ownerContainer = dropdownOptionTemplate.Clone();
|
||||
ownerContainer.Get<LabelWidget>("LABEL").GetText = () => "Owner";
|
||||
var owner = modData.Translation.GetString(Owner);
|
||||
ownerContainer.Get<LabelWidget>("LABEL").GetText = () => owner;
|
||||
var ownerDropdown = ownerContainer.Get<DropDownButtonWidget>("OPTION");
|
||||
var selectedOwner = actor.Owner;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user