Extract translation strings.
This commit is contained in:
committed by
teinarss
parent
8201a57b10
commit
cc58fe1a0f
@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
static readonly string ChangedMap = "changed-map";
|
static readonly string ChangedMap = "changed-map";
|
||||||
|
|
||||||
[TranslationReference]
|
[TranslationReference]
|
||||||
static readonly string BotsDisabled = "bots-disabled";
|
static readonly string MapBotsDisabled = "map-bots-disabled";
|
||||||
|
|
||||||
[TranslationReference("player", "name", "value")]
|
[TranslationReference("player", "name", "value")]
|
||||||
static readonly string ValueChanged = "value-changed";
|
static readonly string ValueChanged = "value-changed";
|
||||||
@@ -624,7 +624,7 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
if (!server.LobbyInfo.GlobalSettings.EnableSingleplayer)
|
if (!server.LobbyInfo.GlobalSettings.EnableSingleplayer)
|
||||||
server.SendLocalizedMessage(TwoHumansRequired);
|
server.SendLocalizedMessage(TwoHumansRequired);
|
||||||
else if (server.Map.Players.Players.Where(p => p.Value.Playable).All(p => !p.Value.AllowBots))
|
else if (server.Map.Players.Players.Where(p => p.Value.Playable).All(p => !p.Value.AllowBots))
|
||||||
server.SendLocalizedMessage(BotsDisabled);
|
server.SendLocalizedMessage(MapBotsDisabled);
|
||||||
|
|
||||||
var briefing = MissionBriefingOrDefault(server);
|
var briefing = MissionBriefingOrDefault(server);
|
||||||
if (briefing != null)
|
if (briefing != null)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
enum ActorIDStatus { Normal = 0, Duplicate = 1, Empty = 3 }
|
enum ActorIDStatus { Normal = 0, Duplicate = 1, Empty = 3 }
|
||||||
|
|
||||||
readonly WorldRenderer worldRenderer;
|
readonly WorldRenderer worldRenderer;
|
||||||
|
readonly ModData modData;
|
||||||
readonly EditorActorLayer editorActorLayer;
|
readonly EditorActorLayer editorActorLayer;
|
||||||
readonly EditorActionManager editorActionManager;
|
readonly EditorActionManager editorActionManager;
|
||||||
readonly EditorViewportControllerWidget editor;
|
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 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.
|
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;
|
long lastScrollTime = 0;
|
||||||
int2 lastScrollPosition = int2.Zero;
|
int2 lastScrollPosition = int2.Zero;
|
||||||
|
|
||||||
@@ -74,9 +85,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[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;
|
this.worldRenderer = worldRenderer;
|
||||||
|
|
||||||
editorActorLayer = world.WorldActor.Trait<EditorActorLayer>();
|
editorActorLayer = world.WorldActor.Trait<EditorActorLayer>();
|
||||||
editorActionManager = world.WorldActor.Trait<EditorActionManager>();
|
editorActionManager = world.WorldActor.Trait<EditorActionManager>();
|
||||||
|
|
||||||
@@ -101,7 +114,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
actorIDErrorLabel = actorEditPanel.Get<LabelWidget>("ACTOR_ID_ERROR_LABEL");
|
actorIDErrorLabel = actorEditPanel.Get<LabelWidget>("ACTOR_ID_ERROR_LABEL");
|
||||||
actorIDErrorLabel.IsVisible = () => actorIDStatus != ActorIDStatus.Normal;
|
actorIDErrorLabel.IsVisible = () => actorIDStatus != ActorIDStatus.Normal;
|
||||||
actorIDErrorLabel.GetText = () => actorIDStatus == ActorIDStatus.Duplicate ?
|
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))
|
if (logicArgs.TryGetValue("EditPanelPadding", out var yaml))
|
||||||
editPanelPadding = FieldLoader.GetValue<int>("EditPanelPadding", yaml.Value);
|
editPanelPadding = FieldLoader.GetValue<int>("EditPanelPadding", yaml.Value);
|
||||||
@@ -131,7 +145,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (editorActorLayer[actorId] != null)
|
if (editorActorLayer[actorId] != null)
|
||||||
{
|
{
|
||||||
nextActorIDStatus = ActorIDStatus.Duplicate;
|
nextActorIDStatus = ActorIDStatus.Duplicate;
|
||||||
actorIDErrorLabel.Text = "Duplicate ActorID";
|
actorIDErrorLabel.Text = modData.Translation.GetString(DuplicateActorId);
|
||||||
actorIDErrorLabel.Visible = true;
|
actorIDErrorLabel.Visible = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -215,7 +229,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
// Add owner dropdown
|
// Add owner dropdown
|
||||||
var ownerContainer = dropdownOptionTemplate.Clone();
|
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 ownerDropdown = ownerContainer.Get<DropDownButtonWidget>("OPTION");
|
||||||
var selectedOwner = actor.Owner;
|
var selectedOwner = actor.Owner;
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly ActorSelectorActor[] allActors;
|
readonly ActorSelectorActor[] allActors;
|
||||||
readonly EditorCursorLayer editorCursor;
|
readonly EditorCursorLayer editorCursor;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Type = "type";
|
||||||
|
|
||||||
PlayerReference selectedOwner;
|
PlayerReference selectedOwner;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ActorSelectorLogic(Widget widget, World world, WorldRenderer worldRenderer)
|
public ActorSelectorLogic(Widget widget, ModData modData, World world, WorldRenderer worldRenderer)
|
||||||
: base(widget, world, worldRenderer, "ACTORTEMPLATE_LIST", "ACTORPREVIEW_TEMPLATE")
|
: base(widget, modData, world, worldRenderer, "ACTORTEMPLATE_LIST", "ACTORPREVIEW_TEMPLATE")
|
||||||
{
|
{
|
||||||
mapRules = world.Map.Rules;
|
mapRules = world.Map.Rules;
|
||||||
ownersDropDown = widget.Get<DropDownButtonWidget>("OWNERS_DROPDOWN");
|
ownersDropDown = widget.Get<DropDownButtonWidget>("OWNERS_DROPDOWN");
|
||||||
@@ -112,7 +115,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (tooltip != null)
|
if (tooltip != null)
|
||||||
searchTerms.Add(tooltip.Name);
|
searchTerms.Add(tooltip.Name);
|
||||||
|
|
||||||
var tooltipText = (tooltip == null ? "Type: " : tooltip.Name + "\nType: ") + a.Name;
|
var type = modData.Translation.GetString(Type);
|
||||||
|
var tooltipText = (tooltip == null ? $"{type}: " : tooltip.Name + $"\n{type}: ") + a.Name;
|
||||||
allActorsTemp.Add(new ActorSelectorActor(a, editorData.Categories, searchTerms.ToArray(), tooltipText));
|
allActorsTemp.Add(new ActorSelectorActor(a, editorData.Categories, searchTerms.ToArray(), tooltipText));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
public abstract class CommonSelectorLogic : ChromeLogic
|
public abstract class CommonSelectorLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
protected readonly Widget Widget;
|
protected readonly Widget Widget;
|
||||||
|
protected readonly ModData ModData;
|
||||||
protected readonly TextFieldWidget SearchTextField;
|
protected readonly TextFieldWidget SearchTextField;
|
||||||
protected readonly World World;
|
protected readonly World World;
|
||||||
protected readonly WorldRenderer WorldRenderer;
|
protected readonly WorldRenderer WorldRenderer;
|
||||||
@@ -33,9 +34,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
protected string[] allCategories;
|
protected string[] allCategories;
|
||||||
protected string searchFilter;
|
protected string searchFilter;
|
||||||
|
|
||||||
public CommonSelectorLogic(Widget widget, World world, WorldRenderer worldRenderer, string templateListId, string previewTemplateId)
|
[TranslationReference]
|
||||||
|
static readonly string None = "none";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SearchResults = "search-results";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string All = "all";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Multiple = "multiple";
|
||||||
|
|
||||||
|
public CommonSelectorLogic(Widget widget, ModData modData, World world, WorldRenderer worldRenderer, string templateListId, string previewTemplateId)
|
||||||
{
|
{
|
||||||
Widget = widget;
|
Widget = widget;
|
||||||
|
ModData = modData;
|
||||||
World = world;
|
World = world;
|
||||||
WorldRenderer = worldRenderer;
|
WorldRenderer = worldRenderer;
|
||||||
Editor = widget.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
Editor = widget.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
||||||
@@ -61,18 +75,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
categorySelector.GetText = () =>
|
categorySelector.GetText = () =>
|
||||||
{
|
{
|
||||||
if (SelectedCategories.Count == 0)
|
if (SelectedCategories.Count == 0)
|
||||||
return "None";
|
return ModData.Translation.GetString(None);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchFilter))
|
if (!string.IsNullOrEmpty(searchFilter))
|
||||||
return "Search Results";
|
return ModData.Translation.GetString(SearchResults);
|
||||||
|
|
||||||
if (SelectedCategories.Count == 1)
|
if (SelectedCategories.Count == 1)
|
||||||
return SelectedCategories.First();
|
return SelectedCategories.First();
|
||||||
|
|
||||||
if (SelectedCategories.Count == allCategories.Length)
|
if (SelectedCategories.Count == allCategories.Length)
|
||||||
return "All";
|
return ModData.Translation.GetString(All);
|
||||||
|
|
||||||
return "Multiple";
|
return ModData.Translation.GetString(Multiple);
|
||||||
};
|
};
|
||||||
|
|
||||||
categorySelector.OnMouseDown = _ =>
|
categorySelector.OnMouseDown = _ =>
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly EditorCursorLayer editorCursor;
|
readonly EditorCursorLayer editorCursor;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public TileSelectorLogic(Widget widget, World world, WorldRenderer worldRenderer)
|
public TileSelectorLogic(Widget widget, ModData modData, World world, WorldRenderer worldRenderer)
|
||||||
: base(widget, world, worldRenderer, "TILETEMPLATE_LIST", "TILEPREVIEW_TEMPLATE")
|
: base(widget, modData, world, worldRenderer, "TILETEMPLATE_LIST", "TILEPREVIEW_TEMPLATE")
|
||||||
{
|
{
|
||||||
terrainInfo = world.Map.Rules.TerrainInfo as ITemplatedTerrainInfo;
|
terrainInfo = world.Map.Rules.TerrainInfo as ITemplatedTerrainInfo;
|
||||||
if (terrainInfo == null)
|
if (terrainInfo == null)
|
||||||
|
|||||||
@@ -29,16 +29,31 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
IngameInfoPanel activePanel;
|
IngameInfoPanel activePanel;
|
||||||
readonly bool hasError;
|
readonly bool hasError;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Objectives = "objectives";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Briefing = "briefing";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Options = "options";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Debug = "debug";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Chat = "chat";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public GameInfoLogic(Widget widget, ModData modData, World world, IngameInfoPanel initialPanel, Action<bool> hideMenu)
|
public GameInfoLogic(Widget widget, ModData modData, World world, IngameInfoPanel initialPanel, Action<bool> hideMenu)
|
||||||
{
|
{
|
||||||
var panels = new Dictionary<IngameInfoPanel, (string Panel, string Label, Action<ButtonWidget, Widget> Setup)>()
|
var panels = new Dictionary<IngameInfoPanel, (string Panel, string Label, Action<ButtonWidget, Widget> Setup)>()
|
||||||
{
|
{
|
||||||
{ IngameInfoPanel.Objectives, ("OBJECTIVES_PANEL", "Objectives", SetupObjectivesPanel) },
|
{ IngameInfoPanel.Objectives, ("OBJECTIVES_PANEL", Objectives, SetupObjectivesPanel) },
|
||||||
{ IngameInfoPanel.Map, ("MAP_PANEL", "Briefing", SetupMapPanel) },
|
{ IngameInfoPanel.Map, ("MAP_PANEL", Briefing, SetupMapPanel) },
|
||||||
{ IngameInfoPanel.LobbbyOptions, ("LOBBY_OPTIONS_PANEL", "Options", SetupLobbyOptionsPanel) },
|
{ IngameInfoPanel.LobbbyOptions, ("LOBBY_OPTIONS_PANEL", Options, SetupLobbyOptionsPanel) },
|
||||||
{ IngameInfoPanel.Debug, ("DEBUG_PANEL", "Debug", SetupDebugPanel) },
|
{ IngameInfoPanel.Debug, ("DEBUG_PANEL", Debug, SetupDebugPanel) },
|
||||||
{ IngameInfoPanel.Chat, ("CHAT_PANEL", "Chat", SetupChatPanel) }
|
{ IngameInfoPanel.Chat, ("CHAT_PANEL", Chat, SetupChatPanel) }
|
||||||
};
|
};
|
||||||
|
|
||||||
this.world = world;
|
this.world = world;
|
||||||
@@ -91,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
if (tabButton != null)
|
if (tabButton != null)
|
||||||
{
|
{
|
||||||
tabButton.Text = info.Label;
|
tabButton.Text = modData.Translation.GetString(info.Label);
|
||||||
tabButton.OnClick = () =>
|
tabButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
if (activePanel == IngameInfoPanel.Chat)
|
if (activePanel == IngameInfoPanel.Chat)
|
||||||
|
|||||||
@@ -21,8 +21,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
readonly ContainerWidget template;
|
readonly ContainerWidget template;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InProgress = "in-progress";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Accomplished = "accomplished";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Failed = "failed";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public GameInfoObjectivesLogic(Widget widget, World world)
|
public GameInfoObjectivesLogic(Widget widget, World world, ModData modData)
|
||||||
{
|
{
|
||||||
var player = world.RenderPlayer ?? world.LocalPlayer;
|
var player = world.RenderPlayer ?? world.LocalPlayer;
|
||||||
|
|
||||||
@@ -43,8 +52,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
var missionStatus = widget.Get<LabelWidget>("MISSION_STATUS");
|
var missionStatus = widget.Get<LabelWidget>("MISSION_STATUS");
|
||||||
missionStatus.GetText = () => player.WinState == WinState.Undefined ? "In progress" :
|
var inProgress = modData.Translation.GetString(InProgress);
|
||||||
player.WinState == WinState.Won ? "Accomplished" : "Failed";
|
var accomplished = modData.Translation.GetString(Accomplished);
|
||||||
|
var failed = modData.Translation.GetString(Failed);
|
||||||
|
missionStatus.GetText = () => player.WinState == WinState.Undefined ? inProgress :
|
||||||
|
player.WinState == WinState.Won ? accomplished : failed;
|
||||||
missionStatus.GetColor = () => player.WinState == WinState.Undefined ? Color.White :
|
missionStatus.GetColor = () => player.WinState == WinState.Undefined ? Color.White :
|
||||||
player.WinState == WinState.Won ? Color.LimeGreen : Color.Red;
|
player.WinState == WinState.Won ? Color.LimeGreen : Color.Red;
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,20 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class GameTimerLogic : ChromeLogic
|
public class GameTimerLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Paused = "paused";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string MaxSpeed = "max-speed";
|
||||||
|
|
||||||
|
[TranslationReference("percentage")]
|
||||||
|
static readonly string Speed = "speed";
|
||||||
|
|
||||||
|
[TranslationReference("percentage")]
|
||||||
|
static readonly string Complete = "complete";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public GameTimerLogic(Widget widget, OrderManager orderManager, World world)
|
public GameTimerLogic(Widget widget, ModData modData, OrderManager orderManager, World world)
|
||||||
{
|
{
|
||||||
var timer = widget.GetOrNull<LabelWidget>("GAME_TIMER");
|
var timer = widget.GetOrNull<LabelWidget>("GAME_TIMER");
|
||||||
var status = widget.GetOrNull<LabelWidget>("GAME_TIMER_STATUS");
|
var status = widget.GetOrNull<LabelWidget>("GAME_TIMER_STATUS");
|
||||||
@@ -31,12 +43,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
Func<bool> paused = () => world.Paused || world.ReplayTimestep == 0;
|
Func<bool> paused = () => world.Paused || world.ReplayTimestep == 0;
|
||||||
|
|
||||||
|
var pausedText = modData.Translation.GetString(Paused);
|
||||||
|
var maxSpeedText = modData.Translation.GetString(MaxSpeed);
|
||||||
|
var speedText = new CachedTransform<int, string>(p =>
|
||||||
|
modData.Translation.GetString(Speed, Translation.Arguments("percentage", p)));
|
||||||
|
|
||||||
if (timer != null)
|
if (timer != null)
|
||||||
{
|
{
|
||||||
timer.GetText = () =>
|
timer.GetText = () =>
|
||||||
{
|
{
|
||||||
if (status == null && paused() && shouldShowStatus())
|
if (status == null && paused() && shouldShowStatus())
|
||||||
return "Paused";
|
return pausedText;
|
||||||
|
|
||||||
var timeLimit = tlm?.TimeLimit ?? 0;
|
var timeLimit = tlm?.TimeLimit ?? 0;
|
||||||
var displayTick = timeLimit > 0 ? timeLimit - world.WorldTick : world.WorldTick;
|
var displayTick = timeLimit > 0 ? timeLimit - world.WorldTick : world.WorldTick;
|
||||||
@@ -51,22 +68,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
status.GetText = () =>
|
status.GetText = () =>
|
||||||
{
|
{
|
||||||
if (paused())
|
if (paused())
|
||||||
return "Paused";
|
return pausedText;
|
||||||
|
|
||||||
if (world.ReplayTimestep == 1)
|
if (world.ReplayTimestep == 1)
|
||||||
return "Max Speed";
|
return maxSpeedText;
|
||||||
|
|
||||||
return $"{world.Timestep * 100 / world.ReplayTimestep}% Speed";
|
return speedText.Update(world.Timestep * 100 / world.ReplayTimestep);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var timerText = new CachedTransform<int, string>(p =>
|
||||||
|
modData.Translation.GetString(Complete, Translation.Arguments("percentage", p)));
|
||||||
if (timer is LabelWithTooltipWidget timerTooltip)
|
if (timer is LabelWithTooltipWidget timerTooltip)
|
||||||
{
|
{
|
||||||
var connection = orderManager.Connection as ReplayConnection;
|
var connection = orderManager.Connection as ReplayConnection;
|
||||||
if (connection != null && connection.FinalGameTick != 0)
|
if (connection != null && connection.FinalGameTick != 0)
|
||||||
timerTooltip.GetTooltipText = () => $"{world.WorldTick * 100 / connection.FinalGameTick}% complete";
|
timerTooltip.GetTooltipText = () => timerText.Update(world.WorldTick * 100 / connection.FinalGameTick);
|
||||||
else if (connection != null && connection.TickCount != 0)
|
else if (connection != null && connection.TickCount != 0)
|
||||||
timerTooltip.GetTooltipText = () => $"{orderManager.NetFrameNumber * 100 / connection.TickCount}% complete";
|
timerTooltip.GetTooltipText = () => timerText.Update(orderManager.NetFrameNumber * 100 / connection.TickCount);
|
||||||
else
|
else
|
||||||
timerTooltip.GetTooltipText = null;
|
timerTooltip.GetTooltipText = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,26 +23,32 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly World world;
|
readonly World world;
|
||||||
readonly Player player;
|
readonly Player player;
|
||||||
readonly PlayerResources playerResources;
|
readonly PlayerResources playerResources;
|
||||||
readonly string cashLabel;
|
readonly LabelWithTooltipWidget cashLabel;
|
||||||
|
readonly CachedTransform<(int Resources, int Capacity), string> siloUsageTooltipCache;
|
||||||
|
readonly string cashTemplate;
|
||||||
|
|
||||||
int nextCashTickTime = 0;
|
int nextCashTickTime = 0;
|
||||||
int displayResources;
|
int displayResources;
|
||||||
string displayLabel;
|
|
||||||
|
string siloUsageTooltip = "";
|
||||||
|
|
||||||
|
[TranslationReference("resources", "capacity")]
|
||||||
|
static readonly string SiloUsage = "silo-usage";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public IngameCashCounterLogic(Widget widget, World world)
|
public IngameCashCounterLogic(Widget widget, ModData modData, World world)
|
||||||
{
|
{
|
||||||
var cash = widget.Get<LabelWithTooltipWidget>("CASH");
|
|
||||||
|
|
||||||
this.world = world;
|
this.world = world;
|
||||||
player = world.LocalPlayer;
|
player = world.LocalPlayer;
|
||||||
playerResources = player.PlayerActor.Trait<PlayerResources>();
|
playerResources = player.PlayerActor.Trait<PlayerResources>();
|
||||||
displayResources = playerResources.Cash + playerResources.Resources;
|
displayResources = playerResources.Cash + playerResources.Resources;
|
||||||
cashLabel = cash.Text;
|
|
||||||
displayLabel = cashLabel.F(displayResources);
|
|
||||||
|
|
||||||
cash.GetText = () => displayLabel;
|
siloUsageTooltipCache = new CachedTransform<(int Resources, int Capacity), string>(x =>
|
||||||
cash.GetTooltipText = () => $"Silo Usage: {playerResources.Resources}/{playerResources.ResourceCapacity}";
|
modData.Translation.GetString(SiloUsage, Translation.Arguments("resources", x.Resources, "capacity", x.Capacity)));
|
||||||
|
cashLabel = widget.Get<LabelWithTooltipWidget>("CASH");
|
||||||
|
cashLabel.GetTooltipText = () => siloUsageTooltip;
|
||||||
|
|
||||||
|
cashTemplate = cashLabel.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Tick()
|
public override void Tick()
|
||||||
@@ -73,7 +79,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
displayLabel = cashLabel.F(displayResources);
|
siloUsageTooltip = siloUsageTooltipCache.Update((playerResources.Resources, playerResources.ResourceCapacity));
|
||||||
|
cashLabel.Text = cashTemplate.F(displayResources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
readonly bool isMenuChat;
|
readonly bool isMenuChat;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Team = "team";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string All = "all";
|
||||||
|
|
||||||
|
[TranslationReference("seconds")]
|
||||||
|
static readonly string ChatAvailability = "chat-availability";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public IngameChatLogic(Widget widget, OrderManager orderManager, World world, ModData modData, bool isMenuChat, Dictionary<string, MiniYaml> logicArgs)
|
public IngameChatLogic(Widget widget, OrderManager orderManager, World world, ModData modData, bool isMenuChat, Dictionary<string, MiniYaml> logicArgs)
|
||||||
{
|
{
|
||||||
@@ -57,6 +66,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var disableTeamChat = alwaysDisabled || (world.LocalPlayer != null && !players.Any(p => p.IsAlliedWith(world.LocalPlayer)));
|
var disableTeamChat = alwaysDisabled || (world.LocalPlayer != null && !players.Any(p => p.IsAlliedWith(world.LocalPlayer)));
|
||||||
var teamChat = !disableTeamChat;
|
var teamChat = !disableTeamChat;
|
||||||
|
|
||||||
|
var teamMessage = modData.Translation.GetString(Team);
|
||||||
|
var allMessage = modData.Translation.GetString(All);
|
||||||
|
|
||||||
tabCompletion.Commands = chatTraits.OfType<ChatCommands>().ToArray().SelectMany(x => x.Commands.Keys);
|
tabCompletion.Commands = chatTraits.OfType<ChatCommands>().ToArray().SelectMany(x => x.Commands.Keys);
|
||||||
tabCompletion.Names = orderManager.LobbyInfo.Clients.Select(c => c.Name).Distinct().ToList();
|
tabCompletion.Names = orderManager.LobbyInfo.Clients.Select(c => c.Name).Distinct().ToList();
|
||||||
|
|
||||||
@@ -81,7 +93,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
chatChrome.Visible = true;
|
chatChrome.Visible = true;
|
||||||
|
|
||||||
var chatMode = chatChrome.Get<ButtonWidget>("CHAT_MODE");
|
var chatMode = chatChrome.Get<ButtonWidget>("CHAT_MODE");
|
||||||
chatMode.GetText = () => teamChat && !disableTeamChat ? "Team" : "All";
|
chatMode.GetText = () => teamChat && !disableTeamChat ? teamMessage : allMessage;
|
||||||
chatMode.OnClick = () => teamChat ^= true;
|
chatMode.OnClick = () => teamChat ^= true;
|
||||||
|
|
||||||
// Enable teamchat if we are a player and die,
|
// Enable teamchat if we are a player and die,
|
||||||
@@ -171,7 +183,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
chatDisabledLabel = new CachedTransform<int, string>(x => x > 0 ? $"Chat available in {x} seconds..." : "Chat Disabled");
|
chatDisabledLabel = new CachedTransform<int, string>(x => modData.Translation.GetString(ChatAvailability, Translation.Arguments("seconds", x)));
|
||||||
|
|
||||||
if (!isMenuChat)
|
if (!isMenuChat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,15 +17,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class IngamePowerBarLogic : ChromeLogic
|
public class IngamePowerBarLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string PowerUsage = "power-usage";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public IngamePowerBarLogic(Widget widget, World world)
|
public IngamePowerBarLogic(Widget widget, ModData modData, World world)
|
||||||
{
|
{
|
||||||
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
|
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
|
||||||
var powerBar = widget.Get<ResourceBarWidget>("POWERBAR");
|
var powerBar = widget.Get<ResourceBarWidget>("POWERBAR");
|
||||||
|
|
||||||
powerBar.GetProvided = () => powerManager.PowerProvided;
|
powerBar.GetProvided = () => powerManager.PowerProvided;
|
||||||
powerBar.GetUsed = () => powerManager.PowerDrained;
|
powerBar.GetUsed = () => powerManager.PowerDrained;
|
||||||
powerBar.TooltipFormat = "Power Usage: {0}/{1}";
|
powerBar.TooltipFormat = modData.Translation.GetString(PowerUsage) + ": {0}/{1}";
|
||||||
powerBar.GetBarColor = () =>
|
powerBar.GetBarColor = () =>
|
||||||
{
|
{
|
||||||
if (powerManager.PowerState == PowerState.Critical)
|
if (powerManager.PowerState == PowerState.Critical)
|
||||||
|
|||||||
@@ -17,8 +17,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class IngamePowerCounterLogic : ChromeLogic
|
public class IngamePowerCounterLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string PowerUsage = "power-usage";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public IngamePowerCounterLogic(Widget widget, World world)
|
public IngamePowerCounterLogic(Widget widget, ModData modData, World world)
|
||||||
{
|
{
|
||||||
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
|
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
|
||||||
var power = widget.Get<LabelWithTooltipWidget>("POWER");
|
var power = widget.Get<LabelWithTooltipWidget>("POWER");
|
||||||
@@ -26,8 +29,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
powerIcon.GetImageName = () => powerManager.ExcessPower < 0 ? "power-critical" : "power-normal";
|
powerIcon.GetImageName = () => powerManager.ExcessPower < 0 ? "power-critical" : "power-normal";
|
||||||
power.GetColor = () => powerManager.ExcessPower < 0 ? Color.Red : Color.White;
|
power.GetColor = () => powerManager.ExcessPower < 0 ? Color.Red : Color.White;
|
||||||
power.GetText = () => powerManager.PowerProvided == 1000000 ? "inf" : powerManager.ExcessPower.ToString();
|
power.GetText = () => powerManager.PowerProvided == 1000000 ? "∞" : powerManager.ExcessPower.ToString();
|
||||||
power.GetTooltipText = () => "Power Usage: " + powerManager.PowerDrained.ToString() +
|
power.GetTooltipText = () => modData.Translation.GetString(PowerUsage) + ": " + powerManager.PowerDrained.ToString() +
|
||||||
(powerManager.PowerProvided != 1000000 ? "/" + powerManager.PowerProvided.ToString() : "");
|
(powerManager.PowerProvided != 1000000 ? "/" + powerManager.PowerProvided.ToString() : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,15 +17,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class IngameSiloBarLogic : ChromeLogic
|
public class IngameSiloBarLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SiloUsage = "silo-usage";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public IngameSiloBarLogic(Widget widget, World world)
|
public IngameSiloBarLogic(Widget widget, ModData modData, World world)
|
||||||
{
|
{
|
||||||
var playerResources = world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
|
var playerResources = world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
|
||||||
var siloBar = widget.Get<ResourceBarWidget>("SILOBAR");
|
var siloBar = widget.Get<ResourceBarWidget>("SILOBAR");
|
||||||
|
|
||||||
siloBar.GetProvided = () => playerResources.ResourceCapacity;
|
siloBar.GetProvided = () => playerResources.ResourceCapacity;
|
||||||
siloBar.GetUsed = () => playerResources.Resources;
|
siloBar.GetUsed = () => playerResources.Resources;
|
||||||
siloBar.TooltipFormat = "Silo Usage: {0}/{1}";
|
siloBar.TooltipFormat = modData.Translation.GetString(SiloUsage) + ": {0}/{1}";
|
||||||
siloBar.GetBarColor = () =>
|
siloBar.GetBarColor = () =>
|
||||||
{
|
{
|
||||||
if (playerResources.Resources == playerResources.ResourceCapacity)
|
if (playerResources.Resources == playerResources.ResourceCapacity)
|
||||||
|
|||||||
@@ -35,6 +35,21 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
CameraOption selected;
|
CameraOption selected;
|
||||||
readonly LabelWidget shroudLabel;
|
readonly LabelWidget shroudLabel;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string CameraOptionAllPlayers = "camera-option-all-players";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string CameraOptionDisableShroud = "camera-option-disable-shroud";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string CameraOptionOther = "camera-option-other";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Players = "players";
|
||||||
|
|
||||||
|
[TranslationReference("team")]
|
||||||
|
static readonly string Team = "team-no-team";
|
||||||
|
|
||||||
class CameraOption
|
class CameraOption
|
||||||
{
|
{
|
||||||
public readonly Player Player;
|
public readonly Player Player;
|
||||||
@@ -86,10 +101,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var groups = new Dictionary<string, IEnumerable<CameraOption>>();
|
var groups = new Dictionary<string, IEnumerable<CameraOption>>();
|
||||||
|
|
||||||
combined = new CameraOption(this, world, "All Players", world.Players.First(p => p.InternalName == "Everyone"));
|
combined = new CameraOption(this, world, modData.Translation.GetString(CameraOptionAllPlayers), world.Players.First(p => p.InternalName == "Everyone"));
|
||||||
disableShroud = new CameraOption(this, world, "Disable Shroud", null);
|
disableShroud = new CameraOption(this, world, modData.Translation.GetString(CameraOptionDisableShroud), null);
|
||||||
if (!limitViews)
|
if (!limitViews)
|
||||||
groups.Add("Other", new List<CameraOption>() { combined, disableShroud });
|
groups.Add(modData.Translation.GetString(CameraOptionOther), new List<CameraOption>() { combined, disableShroud });
|
||||||
|
|
||||||
teams = world.Players.Where(p => !p.NonCombatant && p.Playable)
|
teams = world.Players.Where(p => !p.NonCombatant && p.Playable)
|
||||||
.Select(p => new CameraOption(this, p))
|
.Select(p => new CameraOption(this, p))
|
||||||
@@ -101,7 +116,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
foreach (var t in teams)
|
foreach (var t in teams)
|
||||||
{
|
{
|
||||||
totalPlayers += t.Count();
|
totalPlayers += t.Count();
|
||||||
var label = noTeams ? "Players" : t.Key == 0 ? "No Team" : $"Team {t.Key}";
|
var label = noTeams ? modData.Translation.GetString(Players) : modData.Translation.GetString(Team, Translation.Arguments("team", t.Key));
|
||||||
groups.Add(label, t);
|
groups.Add(label, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,36 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly string clickSound = ChromeMetrics.Get<string>("ClickSound");
|
readonly string clickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||||
ObserverStatsPanel activePanel;
|
ObserverStatsPanel activePanel;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InformationNone = "information-none";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Basic = "basic";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Economy = "economy";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Production = "production";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SupportPowers = "support-powers";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Combat = "combat";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Army = "army";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string EarningsGraph = "earnings-graph";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ArmyGraph = "army-graph";
|
||||||
|
|
||||||
|
[TranslationReference("team")]
|
||||||
|
static readonly string Team = "team-no-team";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ObserverStatsLogic(World world, ModData modData, WorldRenderer worldRenderer, Widget widget, Dictionary<string, MiniYaml> logicArgs)
|
public ObserverStatsLogic(World world, ModData modData, WorldRenderer worldRenderer, Widget widget, Dictionary<string, MiniYaml> logicArgs)
|
||||||
{
|
{
|
||||||
@@ -111,6 +141,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var statsDropDown = widget.Get<DropDownButtonWidget>("STATS_DROPDOWN");
|
var statsDropDown = widget.Get<DropDownButtonWidget>("STATS_DROPDOWN");
|
||||||
Func<string, ObserverStatsPanel, ScrollItemWidget, Action, StatsDropDownOption> createStatsOption = (title, panel, template, a) =>
|
Func<string, ObserverStatsPanel, ScrollItemWidget, Action, StatsDropDownOption> createStatsOption = (title, panel, template, a) =>
|
||||||
{
|
{
|
||||||
|
title = modData.Translation.GetString(title);
|
||||||
return new StatsDropDownOption
|
return new StatsDropDownOption
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
@@ -134,24 +165,25 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
new StatsDropDownOption
|
new StatsDropDownOption
|
||||||
{
|
{
|
||||||
Title = "Information: None",
|
Title = modData.Translation.GetString(InformationNone),
|
||||||
IsSelected = () => activePanel == ObserverStatsPanel.None,
|
IsSelected = () => activePanel == ObserverStatsPanel.None,
|
||||||
OnClick = () =>
|
OnClick = () =>
|
||||||
{
|
{
|
||||||
statsDropDown.GetText = () => "Information: None";
|
var informationNone = modData.Translation.GetString(InformationNone);
|
||||||
|
statsDropDown.GetText = () => informationNone;
|
||||||
playerStatsPanel.Visible = false;
|
playerStatsPanel.Visible = false;
|
||||||
ClearStats();
|
ClearStats();
|
||||||
activePanel = ObserverStatsPanel.None;
|
activePanel = ObserverStatsPanel.None;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createStatsOption("Basic", ObserverStatsPanel.Basic, basicPlayerTemplate, () => DisplayStats(BasicStats)),
|
createStatsOption(Basic, ObserverStatsPanel.Basic, basicPlayerTemplate, () => DisplayStats(BasicStats, modData)),
|
||||||
createStatsOption("Economy", ObserverStatsPanel.Economy, economyPlayerTemplate, () => DisplayStats(EconomyStats)),
|
createStatsOption(Economy, ObserverStatsPanel.Economy, economyPlayerTemplate, () => DisplayStats(EconomyStats, modData)),
|
||||||
createStatsOption("Production", ObserverStatsPanel.Production, productionPlayerTemplate, () => DisplayStats(ProductionStats)),
|
createStatsOption(Production, ObserverStatsPanel.Production, productionPlayerTemplate, () => DisplayStats(ProductionStats, modData)),
|
||||||
createStatsOption("Support Powers", ObserverStatsPanel.SupportPowers, supportPowersPlayerTemplate, () => DisplayStats(SupportPowerStats)),
|
createStatsOption(SupportPowers, ObserverStatsPanel.SupportPowers, supportPowersPlayerTemplate, () => DisplayStats(SupportPowerStats, modData)),
|
||||||
createStatsOption("Combat", ObserverStatsPanel.Combat, combatPlayerTemplate, () => DisplayStats(CombatStats)),
|
createStatsOption(Combat, ObserverStatsPanel.Combat, combatPlayerTemplate, () => DisplayStats(CombatStats, modData)),
|
||||||
createStatsOption("Army", ObserverStatsPanel.Army, armyPlayerTemplate, () => DisplayStats(ArmyStats)),
|
createStatsOption(Army, ObserverStatsPanel.Army, armyPlayerTemplate, () => DisplayStats(ArmyStats, modData)),
|
||||||
createStatsOption("Earnings (graph)", ObserverStatsPanel.Graph, null, () => IncomeGraph()),
|
createStatsOption(EarningsGraph, ObserverStatsPanel.Graph, null, () => IncomeGraph()),
|
||||||
createStatsOption("Army (graph)", ObserverStatsPanel.ArmyGraph, null, () => ArmyValueGraph()),
|
createStatsOption(ArmyGraph, ObserverStatsPanel.ArmyGraph, null, () => ArmyValueGraph()),
|
||||||
};
|
};
|
||||||
|
|
||||||
Func<StatsDropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
|
Func<StatsDropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
|
||||||
@@ -230,7 +262,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
(p.PlayerActor.TraitOrDefault<PlayerStatistics>() ?? new PlayerStatistics(p.PlayerActor)).ArmySamples.Select(s => (float)s)));
|
(p.PlayerActor.TraitOrDefault<PlayerStatistics>() ?? new PlayerStatistics(p.PlayerActor)).ArmySamples.Select(s => (float)s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayStats(Func<Player, ScrollItemWidget> createItem)
|
void DisplayStats(Func<Player, ScrollItemWidget> createItem, ModData modData)
|
||||||
{
|
{
|
||||||
foreach (var team in teams)
|
foreach (var team in teams)
|
||||||
{
|
{
|
||||||
@@ -240,7 +272,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
tt.IgnoreMouseOver = true;
|
tt.IgnoreMouseOver = true;
|
||||||
|
|
||||||
var teamLabel = tt.Get<LabelWidget>("TEAM");
|
var teamLabel = tt.Get<LabelWidget>("TEAM");
|
||||||
var teamText = team.Key == 0 ? "No Team" : "Team " + team.Key;
|
var teamText = modData.Translation.GetString(Team, Translation.Arguments("team-no-team", team.Key));
|
||||||
teamLabel.GetText = () => teamText;
|
teamLabel.GetText = () => teamText;
|
||||||
tt.Bounds.Width = teamLabel.Bounds.Width = Game.Renderer.Fonts[tt.Font].Measure(tt.Get<LabelWidget>("TEAM").GetText()).X;
|
tt.Bounds.Width = teamLabel.Bounds.Width = Game.Renderer.Fonts[tt.Font].Measure(tt.Get<LabelWidget>("TEAM").GetText()).X;
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class WorldTooltipLogic : ChromeLogic
|
public class WorldTooltipLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string UnrevealedTerrain = "unrevealed-terrain";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public WorldTooltipLogic(Widget widget, World world, TooltipContainerWidget tooltipContainer, ViewportControllerWidget viewport)
|
public WorldTooltipLogic(Widget widget, ModData modData, World world, TooltipContainerWidget tooltipContainer, ViewportControllerWidget viewport)
|
||||||
{
|
{
|
||||||
widget.IsVisible = () => viewport.TooltipType != WorldTooltipType.None;
|
widget.IsVisible = () => viewport.TooltipType != WorldTooltipType.None;
|
||||||
var label = widget.Get<LabelWidget>("LABEL");
|
var label = widget.Get<LabelWidget>("LABEL");
|
||||||
@@ -54,7 +57,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
switch (viewport.TooltipType)
|
switch (viewport.TooltipType)
|
||||||
{
|
{
|
||||||
case WorldTooltipType.Unexplored:
|
case WorldTooltipType.Unexplored:
|
||||||
labelText = "Unrevealed Terrain";
|
labelText = modData.Translation.GetString(UnrevealedTerrain);
|
||||||
break;
|
break;
|
||||||
case WorldTooltipType.Resource:
|
case WorldTooltipType.Resource:
|
||||||
labelText = viewport.ResourceTooltip;
|
labelText = viewport.ResourceTooltip;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
## Server Orders
|
## Server Orders
|
||||||
|
|
||||||
custom-rules = This map contains custom rules. Game experience may change.
|
custom-rules = This map contains custom rules. Game experience may change.
|
||||||
bots-disabled = Bots have been disabled on this map.
|
map-bots-disabled = Bots have been disabled on this map.
|
||||||
two-humans-required = This server requires at least two human players to start a match.
|
two-humans-required = This server requires at least two human players to start a match.
|
||||||
unknown-server-command = Unknown server command: { $command }
|
unknown-server-command = Unknown server command: { $command }
|
||||||
only-only-host-start-game = Only the host can start the game.
|
only-only-host-start-game = Only the host can start the game.
|
||||||
@@ -86,7 +85,92 @@ requires-forum-account = Server requires players to have an OpenRA forum account
|
|||||||
no-permission = You do not have permission to join this server.
|
no-permission = You do not have permission to join this server.
|
||||||
slot-closed = Your slot was closed by the host.
|
slot-closed = Your slot was closed by the host.
|
||||||
|
|
||||||
|
|
||||||
## Server
|
## Server
|
||||||
|
|
||||||
game-started = Game started
|
game-started = Game started
|
||||||
|
|
||||||
|
## Server also LobbyUtils
|
||||||
|
bots-disabled = Bots Disabled
|
||||||
|
|
||||||
|
## ActorEditLogic
|
||||||
|
duplicate-actor-id = Duplicate Actor ID
|
||||||
|
enter-actor-id = Enter an Actor ID
|
||||||
|
owner = Owner
|
||||||
|
|
||||||
|
## ActorSelectorLogic
|
||||||
|
type = Type
|
||||||
|
|
||||||
|
## CommonSelectorLogic
|
||||||
|
search-results = Search Results
|
||||||
|
multiple = Multiple
|
||||||
|
|
||||||
|
## GameInfoLogic
|
||||||
|
objectives = Objectives
|
||||||
|
briefing = Briefing
|
||||||
|
options = Options
|
||||||
|
debug = Debug
|
||||||
|
chat = Chat
|
||||||
|
|
||||||
|
## GameInfoObjectivesLogic also GameInfoStatsLogic
|
||||||
|
in-progress = In progress
|
||||||
|
accomplished = Accomplished
|
||||||
|
failed = Failed
|
||||||
|
|
||||||
|
## GameTimerLogic
|
||||||
|
paused = Paused
|
||||||
|
max-speed = Max Speed
|
||||||
|
speed = { $percentage }% Speed
|
||||||
|
complete = { $percentage }% complete
|
||||||
|
|
||||||
|
## LobbyLogic, InGameChatLogic
|
||||||
|
chat-availability =
|
||||||
|
{ $seconds ->
|
||||||
|
[zero] Chat Disabled
|
||||||
|
[one] Chat available in { $seconds } second...
|
||||||
|
*[other] Chat available in { $seconds } seconds...
|
||||||
|
}
|
||||||
|
|
||||||
|
## IngamePowerBarLogic
|
||||||
|
## IngamePowerCounterLogic
|
||||||
|
power-usage = Power Usage
|
||||||
|
|
||||||
|
## IngameSiloBarLogic
|
||||||
|
## IngameCashCounterLogic
|
||||||
|
silo-usage = Silo Usage: { $resources }/{ $capacity }
|
||||||
|
|
||||||
|
## ObserverShroudSelectorLogic
|
||||||
|
camera-option-all-players = All Players
|
||||||
|
camera-option-disable-shroud = Disable Shroud
|
||||||
|
camera-option-other = Other
|
||||||
|
|
||||||
|
## ObserverStatsLogic
|
||||||
|
information-none = Information: None
|
||||||
|
basic = Basic
|
||||||
|
economy = Economy
|
||||||
|
production = Production
|
||||||
|
support-powers = Support Powers
|
||||||
|
combat = Combat
|
||||||
|
army = Army
|
||||||
|
earnings-graph = Earnings (graph)
|
||||||
|
army-graph = Army (graph)
|
||||||
|
|
||||||
|
## WorldTooltipLogic
|
||||||
|
unrevealed-terrain = Unrevealed Terrain
|
||||||
|
|
||||||
|
## ServerlistLogic, GameInfoStatsLogic, ObserverShroudSelectorLogic, SpawnSelectorTooltipLogic
|
||||||
|
team-no-team =
|
||||||
|
{ $team ->
|
||||||
|
[zero] No Team
|
||||||
|
*[other] Team { $team }
|
||||||
|
}
|
||||||
|
|
||||||
|
## LobbyLogic, CommonSelectorLogic, InGameChatLogic
|
||||||
|
all = All
|
||||||
|
|
||||||
|
## InputSettingsLogic, CommonSelectorLogic
|
||||||
|
none = None
|
||||||
|
|
||||||
|
## LobbyLogic, IngameChatLogic
|
||||||
|
team = Team
|
||||||
|
|
||||||
|
## ServerListLogic, ReplayBrowserLogic also ObserverShroudSelectorLogic
|
||||||
|
players = Players
|
||||||
|
|||||||
Reference in New Issue
Block a user