Extract translation strings.
This commit is contained in:
committed by
Gustas
parent
dfd5a960ed
commit
0b67b5bfae
@@ -17,7 +17,7 @@ namespace OpenRA.Server
|
|||||||
class PlayerMessageTracker
|
class PlayerMessageTracker
|
||||||
{
|
{
|
||||||
[TranslationReference("remaining")]
|
[TranslationReference("remaining")]
|
||||||
static readonly string ChatDisabled = "chat-disabled";
|
static readonly string ChatTemporaryDisabled = "chat-temp-disabled";
|
||||||
|
|
||||||
readonly Dictionary<int, List<long>> messageTracker = new Dictionary<int, List<long>>();
|
readonly Dictionary<int, List<long>> messageTracker = new Dictionary<int, List<long>>();
|
||||||
readonly Server server;
|
readonly Server server;
|
||||||
@@ -56,7 +56,7 @@ namespace OpenRA.Server
|
|||||||
if (!isAdmin && time < settings.FloodLimitJoinCooldown)
|
if (!isAdmin && time < settings.FloodLimitJoinCooldown)
|
||||||
{
|
{
|
||||||
var remaining = CalculateRemaining(settings.FloodLimitJoinCooldown);
|
var remaining = CalculateRemaining(settings.FloodLimitJoinCooldown);
|
||||||
sendLocalizedMessageTo(conn, ChatDisabled, Translation.Arguments("remaining", remaining));
|
sendLocalizedMessageTo(conn, ChatTemporaryDisabled, Translation.Arguments("remaining", remaining));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ namespace OpenRA.Server
|
|||||||
if (tracker.Count >= settings.FloodLimitMessageCount)
|
if (tracker.Count >= settings.FloodLimitMessageCount)
|
||||||
{
|
{
|
||||||
var remaining = CalculateRemaining(tracker[0] + settings.FloodLimitInterval);
|
var remaining = CalculateRemaining(tracker[0] + settings.FloodLimitInterval);
|
||||||
sendLocalizedMessageTo(conn, ChatDisabled, Translation.Arguments("remaining", remaining));
|
sendLocalizedMessageTo(conn, ChatTemporaryDisabled, Translation.Arguments("remaining", remaining));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,9 +132,12 @@ namespace OpenRA.Server
|
|||||||
[TranslationReference("player")]
|
[TranslationReference("player")]
|
||||||
static readonly string LobbyDisconnected = "lobby-disconnected";
|
static readonly string LobbyDisconnected = "lobby-disconnected";
|
||||||
|
|
||||||
[TranslationReference("player", "team")]
|
[TranslationReference("player")]
|
||||||
static readonly string PlayerDisconnected = "player-disconnected";
|
static readonly string PlayerDisconnected = "player-disconnected";
|
||||||
|
|
||||||
|
[TranslationReference("player", "team")]
|
||||||
|
static readonly string PlayerTeamDisconnected = "player-team-disconnected";
|
||||||
|
|
||||||
[TranslationReference("player")]
|
[TranslationReference("player")]
|
||||||
static readonly string ObserverDisconnected = "observer-disconnected";
|
static readonly string ObserverDisconnected = "observer-disconnected";
|
||||||
|
|
||||||
@@ -1178,8 +1181,10 @@ namespace OpenRA.Server
|
|||||||
{
|
{
|
||||||
if (dropClient.IsObserver)
|
if (dropClient.IsObserver)
|
||||||
SendLocalizedMessage(ObserverDisconnected, Translation.Arguments("player", dropClient.Name));
|
SendLocalizedMessage(ObserverDisconnected, Translation.Arguments("player", dropClient.Name));
|
||||||
|
else if (dropClient.Team > 0)
|
||||||
|
SendLocalizedMessage(PlayerTeamDisconnected, Translation.Arguments("player", dropClient.Name, "team", dropClient.Team));
|
||||||
else
|
else
|
||||||
SendLocalizedMessage(PlayerDisconnected, Translation.Arguments("player", dropClient.Name, "team", dropClient.Team));
|
SendLocalizedMessage(PlayerDisconnected, Translation.Arguments("player", dropClient.Name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SendLocalizedMessage(LobbyDisconnected, Translation.Arguments("player", dropClient.Name));
|
SendLocalizedMessage(LobbyDisconnected, Translation.Arguments("player", dropClient.Name));
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
|
if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.ModData, Game.LoadShellMap))
|
||||||
Game.JoinReplay(Launch.Replay);
|
Game.JoinReplay(Launch.Replay);
|
||||||
|
|
||||||
if (replayMeta != null)
|
if (replayMeta != null)
|
||||||
|
|||||||
@@ -785,14 +785,14 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log.Write("server", $"Kicking client {kickClientID}.");
|
Log.Write("server", $"Kicking client {kickClientID}.");
|
||||||
server.SendLocalizedMessage(Kicked, Translation.Arguments("admin", client.Name, "client", kickClient.Name));
|
server.SendLocalizedMessage(Kicked, Translation.Arguments("admin", client.Name, "player", kickClient.Name));
|
||||||
server.SendOrderTo(kickConn, "ServerError", YouWereKicked);
|
server.SendOrderTo(kickConn, "ServerError", YouWereKicked);
|
||||||
server.DropClient(kickConn);
|
server.DropClient(kickConn);
|
||||||
|
|
||||||
if (bool.TryParse(split[1], out var tempBan) && tempBan)
|
if (bool.TryParse(split[1], out var tempBan) && tempBan)
|
||||||
{
|
{
|
||||||
Log.Write("server", $"Temporarily banning client {kickClientID} ({kickClient.IPAddress}).");
|
Log.Write("server", $"Temporarily banning client {kickClientID} ({kickClient.IPAddress}).");
|
||||||
server.SendLocalizedMessage(TempBan, Translation.Arguments("admin", client.Name, "client", kickClient.Name));
|
server.SendLocalizedMessage(TempBan, Translation.Arguments("admin", client.Name, "player", kickClient.Name));
|
||||||
server.TempBans.Add(kickClient.IPAddress);
|
server.TempBans.Add(kickClient.IPAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets
|
namespace OpenRA.Mods.Common.Widgets
|
||||||
@@ -17,8 +18,11 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public static class ConfirmationDialogs
|
public static class ConfirmationDialogs
|
||||||
{
|
{
|
||||||
public static void ButtonPrompt(
|
public static void ButtonPrompt(
|
||||||
|
ModData modData,
|
||||||
string title,
|
string title,
|
||||||
string text,
|
string text,
|
||||||
|
Dictionary<string, object> titleArguments = null,
|
||||||
|
Dictionary<string, object> textArguments = null,
|
||||||
Action onConfirm = null,
|
Action onConfirm = null,
|
||||||
Action onCancel = null,
|
Action onCancel = null,
|
||||||
Action onOther = null,
|
Action onOther = null,
|
||||||
@@ -32,10 +36,12 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
var cancelButton = prompt.GetOrNull<ButtonWidget>("CANCEL_BUTTON");
|
var cancelButton = prompt.GetOrNull<ButtonWidget>("CANCEL_BUTTON");
|
||||||
var otherButton = prompt.GetOrNull<ButtonWidget>("OTHER_BUTTON");
|
var otherButton = prompt.GetOrNull<ButtonWidget>("OTHER_BUTTON");
|
||||||
|
|
||||||
prompt.Get<LabelWidget>("PROMPT_TITLE").GetText = () => title;
|
var titleMessage = modData.Translation.GetString(title, titleArguments);
|
||||||
|
prompt.Get<LabelWidget>("PROMPT_TITLE").GetText = () => titleMessage;
|
||||||
|
|
||||||
var headerTemplate = prompt.Get<LabelWidget>("PROMPT_TEXT");
|
var headerTemplate = prompt.Get<LabelWidget>("PROMPT_TEXT");
|
||||||
var headerLines = text.Replace("\\n", "\n").Split('\n');
|
var textMessage = modData.Translation.GetString(text, textArguments);
|
||||||
|
var headerLines = textMessage.Split('\n');
|
||||||
var headerHeight = 0;
|
var headerHeight = 0;
|
||||||
foreach (var l in headerLines)
|
foreach (var l in headerLines)
|
||||||
{
|
{
|
||||||
@@ -61,7 +67,10 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(confirmText))
|
if (!string.IsNullOrEmpty(confirmText))
|
||||||
confirmButton.GetText = () => confirmText;
|
{
|
||||||
|
var confirmTextMessage = modData.Translation.GetString(confirmText);
|
||||||
|
confirmButton.GetText = () => confirmTextMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onCancel != null && cancelButton != null)
|
if (onCancel != null && cancelButton != null)
|
||||||
@@ -75,7 +84,10 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(cancelText))
|
if (!string.IsNullOrEmpty(cancelText))
|
||||||
cancelButton.GetText = () => cancelText;
|
{
|
||||||
|
var cancelTextMessage = modData.Translation.GetString(cancelText);
|
||||||
|
cancelButton.GetText = () => cancelTextMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onOther != null && otherButton != null)
|
if (onOther != null && otherButton != null)
|
||||||
@@ -88,11 +100,14 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(otherText))
|
if (!string.IsNullOrEmpty(otherText))
|
||||||
otherButton.GetText = () => otherText;
|
{
|
||||||
|
var otherTextMessage = modData.Translation.GetString(otherText);
|
||||||
|
otherButton.GetText = () => otherTextMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TextInputPrompt(
|
public static void TextInputPrompt(ModData modData,
|
||||||
string title, string prompt, string initialText,
|
string title, string prompt, string initialText,
|
||||||
Action<string> onAccept, Action onCancel = null,
|
Action<string> onAccept, Action onCancel = null,
|
||||||
string acceptText = null, string cancelText = null,
|
string acceptText = null, string cancelText = null,
|
||||||
@@ -102,13 +117,12 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
Func<bool> doValidate = null;
|
Func<bool> doValidate = null;
|
||||||
ButtonWidget acceptButton = null, cancelButton = null;
|
ButtonWidget acceptButton = null, cancelButton = null;
|
||||||
|
|
||||||
// Title
|
var titleMessage = modData.Translation.GetString(title);
|
||||||
panel.Get<LabelWidget>("PROMPT_TITLE").GetText = () => title;
|
panel.Get<LabelWidget>("PROMPT_TITLE").GetText = () => titleMessage;
|
||||||
|
|
||||||
// Prompt
|
var promptMessage = modData.Translation.GetString(prompt);
|
||||||
panel.Get<LabelWidget>("PROMPT_TEXT").GetText = () => prompt;
|
panel.Get<LabelWidget>("PROMPT_TEXT").GetText = () => promptMessage;
|
||||||
|
|
||||||
// Text input
|
|
||||||
var input = panel.Get<TextFieldWidget>("INPUT_TEXT");
|
var input = panel.Get<TextFieldWidget>("INPUT_TEXT");
|
||||||
var isValid = false;
|
var isValid = false;
|
||||||
input.Text = initialText;
|
input.Text = initialText;
|
||||||
@@ -133,10 +147,12 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
input.CursorPosition = input.Text.Length;
|
input.CursorPosition = input.Text.Length;
|
||||||
input.OnTextEdited = () => doValidate();
|
input.OnTextEdited = () => doValidate();
|
||||||
|
|
||||||
// Buttons
|
|
||||||
acceptButton = panel.Get<ButtonWidget>("ACCEPT_BUTTON");
|
acceptButton = panel.Get<ButtonWidget>("ACCEPT_BUTTON");
|
||||||
if (!string.IsNullOrEmpty(acceptText))
|
if (!string.IsNullOrEmpty(acceptText))
|
||||||
acceptButton.GetText = () => acceptText;
|
{
|
||||||
|
var acceptTextMessage = modData.Translation.GetString(acceptText);
|
||||||
|
acceptButton.GetText = () => acceptTextMessage;
|
||||||
|
}
|
||||||
|
|
||||||
acceptButton.OnClick = () =>
|
acceptButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
@@ -149,7 +165,10 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
cancelButton = panel.Get<ButtonWidget>("CANCEL_BUTTON");
|
cancelButton = panel.Get<ButtonWidget>("CANCEL_BUTTON");
|
||||||
if (!string.IsNullOrEmpty(cancelText))
|
if (!string.IsNullOrEmpty(cancelText))
|
||||||
cancelButton.GetText = () => cancelText;
|
{
|
||||||
|
var cancelTextMessage = modData.Translation.GetString(cancelText);
|
||||||
|
cancelButton.GetText = () => cancelTextMessage;
|
||||||
|
}
|
||||||
|
|
||||||
cancelButton.OnClick = () =>
|
cancelButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
@@ -157,7 +176,6 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
onCancel?.Invoke();
|
onCancel?.Invoke();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Validation
|
|
||||||
doValidate = () =>
|
doValidate = () =>
|
||||||
{
|
{
|
||||||
if (inputValidator == null)
|
if (inputValidator == null)
|
||||||
|
|||||||
@@ -60,6 +60,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
float spriteScale;
|
float spriteScale;
|
||||||
float modelScale;
|
float modelScale;
|
||||||
|
|
||||||
|
[TranslationReference("length")]
|
||||||
|
static readonly string LengthInSeconds = "length-in-seconds";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string AllPackages = "all-packages";
|
||||||
|
|
||||||
|
readonly string allPackages;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public AssetBrowserLogic(Widget widget, Action onExit, ModData modData, WorldRenderer worldRenderer)
|
public AssetBrowserLogic(Widget widget, Action onExit, ModData modData, WorldRenderer worldRenderer)
|
||||||
{
|
{
|
||||||
@@ -67,6 +75,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
this.modData = modData;
|
this.modData = modData;
|
||||||
panel = widget;
|
panel = widget;
|
||||||
|
|
||||||
|
allPackages = modData.Translation.GetString(AllPackages);
|
||||||
|
|
||||||
var colorPickerPalettes = world.WorldActor.TraitsImplementing<IProvidesAssetBrowserColorPickerPalettes>()
|
var colorPickerPalettes = world.WorldActor.TraitsImplementing<IProvidesAssetBrowserColorPickerPalettes>()
|
||||||
.SelectMany(p => p.ColorPickerPaletteNames)
|
.SelectMany(p => p.ColorPickerPaletteNames)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
@@ -194,13 +204,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var frameText = panel.GetOrNull<LabelWidget>("FRAME_COUNT");
|
var frameText = panel.GetOrNull<LabelWidget>("FRAME_COUNT");
|
||||||
if (frameText != null)
|
if (frameText != null)
|
||||||
{
|
{
|
||||||
|
var soundLength = new CachedTransform<int, string>(p =>
|
||||||
|
modData.Translation.GetString(LengthInSeconds, Translation.Arguments("length", p)));
|
||||||
frameText.GetText = () =>
|
frameText.GetText = () =>
|
||||||
{
|
{
|
||||||
if (isVideoLoaded)
|
if (isVideoLoaded)
|
||||||
return $"{player.Video.CurrentFrameIndex + 1} / {player.Video.FrameCount}";
|
return $"{player.Video.CurrentFrameIndex + 1} / {player.Video.FrameCount}";
|
||||||
|
|
||||||
if (currentSoundFormat != null)
|
if (currentSoundFormat != null)
|
||||||
return $"{Math.Round(currentSoundFormat.LengthInSeconds, 3)} sec";
|
return soundLength.Update((int)currentSoundFormat.LengthInSeconds);
|
||||||
|
|
||||||
return $"{currentFrame} / {currentSprites.Length - 1}";
|
return $"{currentFrame} / {currentSprites.Length - 1}";
|
||||||
};
|
};
|
||||||
@@ -607,7 +619,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
string GetSourceDisplayName(IReadOnlyPackage source)
|
string GetSourceDisplayName(IReadOnlyPackage source)
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null)
|
||||||
return "All Packages";
|
return allPackages;
|
||||||
|
|
||||||
// Packages that are explicitly mounted in the filesystem use their explicit mount name
|
// Packages that are explicitly mounted in the filesystem use their explicit mount name
|
||||||
var fs = (OpenRA.FileSystem.FileSystem)modData.DefaultFileSystem;
|
var fs = (OpenRA.FileSystem.FileSystem)modData.DefaultFileSystem;
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly Action onAbort;
|
readonly Action onAbort;
|
||||||
readonly Action<string> onRetry;
|
readonly Action<string> onRetry;
|
||||||
|
|
||||||
|
[TranslationReference("endpoint")]
|
||||||
|
static readonly string ConnectingToEndpoint = "connecting-to-endpoint";
|
||||||
|
|
||||||
void ConnectionStateChanged(OrderManager om, string password, NetworkConnection connection)
|
void ConnectionStateChanged(OrderManager om, string password, NetworkConnection connection)
|
||||||
{
|
{
|
||||||
if (connection.ConnectionState == ConnectionState.Connected)
|
if (connection.ConnectionState == ConnectionState.Connected)
|
||||||
@@ -51,7 +54,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ConnectionLogic(Widget widget, ConnectionTarget endpoint, Action onConnect, Action onAbort, Action<string> onRetry)
|
public ConnectionLogic(Widget widget, ModData modData, ConnectionTarget endpoint, Action onConnect, Action onAbort, Action<string> onRetry)
|
||||||
{
|
{
|
||||||
this.onConnect = onConnect;
|
this.onConnect = onConnect;
|
||||||
this.onAbort = onAbort;
|
this.onAbort = onAbort;
|
||||||
@@ -62,7 +65,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var panel = widget;
|
var panel = widget;
|
||||||
panel.Get<ButtonWidget>("ABORT_BUTTON").OnClick = () => { CloseWindow(); onAbort(); };
|
panel.Get<ButtonWidget>("ABORT_BUTTON").OnClick = () => { CloseWindow(); onAbort(); };
|
||||||
|
|
||||||
widget.Get<LabelWidget>("CONNECTING_DESC").GetText = () => $"Connecting to {endpoint}...";
|
var connectingDesc = modData.Translation.GetString(ConnectingToEndpoint, Translation.Arguments("endpoint", endpoint));
|
||||||
|
widget.Get<LabelWidget>("CONNECTING_DESC").GetText = () => connectingDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Connect(ConnectionTarget endpoint, string password, Action onConnect, Action onAbort)
|
public static void Connect(ConnectionTarget endpoint, string password, Action onConnect, Action onAbort)
|
||||||
@@ -85,6 +89,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly PasswordFieldWidget passwordField;
|
readonly PasswordFieldWidget passwordField;
|
||||||
bool passwordOffsetAdjusted;
|
bool passwordOffsetAdjusted;
|
||||||
|
|
||||||
|
[TranslationReference("target")]
|
||||||
|
static readonly string CouldNotConnectToTarget = "could-not-connect-to-target";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string UnknownError = "unknown-error";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string PasswordRequired = "password-required";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ConnectionFailed = "connection-failed";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ConnectionFailedLogic(Widget widget, ModData modData, OrderManager orderManager, NetworkConnection connection, string password, Action onAbort, Action<string> onRetry)
|
public ConnectionFailedLogic(Widget widget, ModData modData, OrderManager orderManager, NetworkConnection connection, string password, Action onAbort, Action<string> onRetry)
|
||||||
{
|
{
|
||||||
@@ -104,13 +120,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
onRetry(pass);
|
onRetry(pass);
|
||||||
};
|
};
|
||||||
|
|
||||||
widget.Get<LabelWidget>("CONNECTING_DESC").GetText = () => $"Could not connect to {connection.Target}";
|
var connectingDescText = modData.Translation.GetString(CouldNotConnectToTarget, Translation.Arguments("target", connection.Target));
|
||||||
|
widget.Get<LabelWidget>("CONNECTING_DESC").GetText = () => connectingDescText;
|
||||||
|
|
||||||
var connectionError = widget.Get<LabelWidget>("CONNECTION_ERROR");
|
var connectionError = widget.Get<LabelWidget>("CONNECTION_ERROR");
|
||||||
connectionError.GetText = () => modData.Translation.GetString(orderManager.ServerError) ?? connection.ErrorMessage ?? "Unknown error";
|
var connectionErrorText = modData.Translation.GetString(orderManager.ServerError) ?? connection.ErrorMessage ?? modData.Translation.GetString(UnknownError);
|
||||||
|
connectionError.GetText = () => connectionErrorText;
|
||||||
|
|
||||||
var panelTitle = widget.Get<LabelWidget>("TITLE");
|
var panelTitle = widget.Get<LabelWidget>("TITLE");
|
||||||
panelTitle.GetText = () => orderManager.AuthenticationFailed ? "Password Required" : "Connection Failed";
|
var panelTitleText = orderManager.AuthenticationFailed ? modData.Translation.GetString(PasswordRequired) : modData.Translation.GetString(ConnectionFailed);
|
||||||
|
panelTitle.GetText = () => panelTitleText;
|
||||||
|
|
||||||
passwordField = panel.GetOrNull<PasswordFieldWidget>("PASSWORD");
|
passwordField = panel.GetOrNull<PasswordFieldWidget>("PASSWORD");
|
||||||
if (passwordField != null)
|
if (passwordField != null)
|
||||||
@@ -151,6 +170,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
public class ConnectionSwitchModLogic : ChromeLogic
|
public class ConnectionSwitchModLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ModSwitchFailed = "mod-switch-failed";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ConnectionSwitchModLogic(Widget widget, OrderManager orderManager, NetworkConnection connection, Action onAbort, Action<string> onRetry)
|
public ConnectionSwitchModLogic(Widget widget, OrderManager orderManager, NetworkConnection connection, Action onAbort, Action<string> onRetry)
|
||||||
{
|
{
|
||||||
@@ -167,7 +189,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var launchCommand = $"Launch.URI={new UriBuilder("tcp", connection.EndPoint.Address.ToString(), connection.EndPoint.Port)}";
|
var launchCommand = $"Launch.URI={new UriBuilder("tcp", connection.EndPoint.Address.ToString(), connection.EndPoint.Port)}";
|
||||||
Game.SwitchToExternalMod(CurrentServerSettings.ServerExternalMod, new[] { launchCommand }, () =>
|
Game.SwitchToExternalMod(CurrentServerSettings.ServerExternalMod, new[] { launchCommand }, () =>
|
||||||
{
|
{
|
||||||
orderManager.ServerError = "Failed to switch mod.";
|
orderManager.ServerError = ModSwitchFailed;
|
||||||
Ui.CloseWindow();
|
Ui.CloseWindow();
|
||||||
Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,22 +71,27 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var none = ModData.Translation.GetString(None);
|
||||||
|
var searchResults = ModData.Translation.GetString(SearchResults);
|
||||||
|
var all = ModData.Translation.GetString(All);
|
||||||
|
var multiple = ModData.Translation.GetString(Multiple);
|
||||||
|
|
||||||
var categorySelector = widget.Get<DropDownButtonWidget>("CATEGORIES_DROPDOWN");
|
var categorySelector = widget.Get<DropDownButtonWidget>("CATEGORIES_DROPDOWN");
|
||||||
categorySelector.GetText = () =>
|
categorySelector.GetText = () =>
|
||||||
{
|
{
|
||||||
if (SelectedCategories.Count == 0)
|
if (SelectedCategories.Count == 0)
|
||||||
return ModData.Translation.GetString(None);
|
return none;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchFilter))
|
if (!string.IsNullOrEmpty(searchFilter))
|
||||||
return ModData.Translation.GetString(SearchResults);
|
return 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 ModData.Translation.GetString(All);
|
return all;
|
||||||
|
|
||||||
return ModData.Translation.GetString(Multiple);
|
return multiple;
|
||||||
};
|
};
|
||||||
|
|
||||||
categorySelector.OnMouseDown = _ =>
|
categorySelector.OnMouseDown = _ =>
|
||||||
|
|||||||
@@ -42,6 +42,36 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SaveMapFailedTitle = "save-map-failed-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SaveMapFailedPrompt = "save-map-failed-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SaveMapFailedAccept = "save-map-failed-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Unpacked = "unpacked";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string OverwriteMapFailedTitle = "overwrite-map-failed-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string OverwriteMapFailedPrompt = "overwrite-map-failed-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SaveMapFailedConfirm = "overwrite-map-failed-confirm";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string OverwriteMapOutsideEditTitle = "overwrite-map-outside-edit-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string OverwriteMapOutsideEditPrompt = "overwrite-map-outside-edit-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SaveMapMapOutsideConfirm = "overwrite-map-outside-edit-confirm";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public SaveMapLogic(Widget widget, ModData modData, Action<string> onSave, Action onExit,
|
public SaveMapLogic(Widget widget, ModData modData, Action<string> onSave, Action onExit,
|
||||||
Map map, List<MiniYamlNode> playerDefinitions, List<MiniYamlNode> actorDefinitions)
|
Map map, List<MiniYamlNode> playerDefinitions, List<MiniYamlNode> actorDefinitions)
|
||||||
@@ -135,7 +165,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var fileTypes = new Dictionary<MapFileType, MapFileTypeInfo>()
|
var fileTypes = new Dictionary<MapFileType, MapFileTypeInfo>()
|
||||||
{
|
{
|
||||||
{ MapFileType.OraMap, new MapFileTypeInfo { Extension = ".oramap", UiLabel = ".oramap" } },
|
{ MapFileType.OraMap, new MapFileTypeInfo { Extension = ".oramap", UiLabel = ".oramap" } },
|
||||||
{ MapFileType.Unpacked, new MapFileTypeInfo { Extension = "", UiLabel = "(unpacked)" } }
|
{ MapFileType.Unpacked, new MapFileTypeInfo { Extension = "", UiLabel = $"({modData.Translation.GetString(Unpacked)})" } }
|
||||||
};
|
};
|
||||||
|
|
||||||
var typeDropdown = widget.Get<DropDownButtonWidget>("TYPE_DROPDOWN");
|
var typeDropdown = widget.Get<DropDownButtonWidget>("TYPE_DROPDOWN");
|
||||||
@@ -192,11 +222,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Log.Write("debug", $"Failed to save map at {combinedPath}");
|
Log.Write("debug", $"Failed to save map at {combinedPath}");
|
||||||
Log.Write("debug", e);
|
Log.Write("debug", e);
|
||||||
|
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Failed to save map",
|
title: SaveMapFailedTitle,
|
||||||
text: "See debug.log for details.",
|
text: SaveMapFailedPrompt,
|
||||||
onConfirm: () => { },
|
onConfirm: () => { },
|
||||||
confirmText: "OK");
|
confirmText: SaveMapFailedAccept);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -213,10 +243,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
// When creating a new map or when file paths don't match
|
// When creating a new map or when file paths don't match
|
||||||
if (modData.MapCache.Any(m => m.Status == MapStatus.Available && m.Package?.Name == combinedPath))
|
if (modData.MapCache.Any(m => m.Status == MapStatus.Available && m.Package?.Name == combinedPath))
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Warning",
|
title: OverwriteMapFailedTitle,
|
||||||
text: "By saving you will overwrite\n an already existing map.",
|
text: OverwriteMapFailedPrompt,
|
||||||
confirmText: "Save",
|
confirmText: SaveMapFailedConfirm,
|
||||||
onConfirm: () => saveMap(combinedPath),
|
onConfirm: () => saveMap(combinedPath),
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
|
|
||||||
@@ -229,10 +259,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var recentUid = modData.MapCache.GetUpdatedMap(map.Uid);
|
var recentUid = modData.MapCache.GetUpdatedMap(map.Uid);
|
||||||
if (recentUid != null && map.Uid != recentUid && modData.MapCache[recentUid].Status == MapStatus.Available)
|
if (recentUid != null && map.Uid != recentUid && modData.MapCache[recentUid].Status == MapStatus.Available)
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Warning",
|
title: OverwriteMapOutsideEditTitle,
|
||||||
text: "The map has been edited from outside the editor.\n By saving you may overwrite progress",
|
text: OverwriteMapOutsideEditPrompt,
|
||||||
confirmText: "Save",
|
confirmText: SaveMapMapOutsideConfirm,
|
||||||
onConfirm: () => saveMap(combinedPath),
|
onConfirm: () => saveMap(combinedPath),
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,45 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly string defaultSaveFilename;
|
readonly string defaultSaveFilename;
|
||||||
string selectedSave;
|
string selectedSave;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RenameSaveTitle = "rename-save-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RenameSavePrompt = "rename-save-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RenameSaveAccept = "rename-save-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteSaveTitle = "delete-save-title";
|
||||||
|
|
||||||
|
[TranslationReference("save")]
|
||||||
|
static readonly string DeleteSavePrompt = "delete-save-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteSaveAccept = "delete-save-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteAllSavesTitle = "delete-all-saves-title";
|
||||||
|
|
||||||
|
[TranslationReference("count")]
|
||||||
|
static readonly string DeleteAllSavesPrompt = "delete-all-saves-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteAllSavesAccept = "delete-all-saves-accept";
|
||||||
|
|
||||||
|
[TranslationReference("savePath")]
|
||||||
|
static readonly string SaveDeletionFailed = "save-deletion-failed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string OverwriteSaveTitle = "overwrite-save-title";
|
||||||
|
|
||||||
|
[TranslationReference("file")]
|
||||||
|
static readonly string OverwriteSavePrompt = "overwrite-save-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string OverwriteSaveAccpet = "overwrite-save-accept";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public GameSaveBrowserLogic(Widget widget, ModData modData, Action onExit, Action onStart, bool isSavePanel, World world)
|
public GameSaveBrowserLogic(Widget widget, ModData modData, Action onExit, Action onStart, bool isSavePanel, World world)
|
||||||
{
|
{
|
||||||
@@ -100,13 +139,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var initialName = Path.GetFileNameWithoutExtension(selectedSave);
|
var initialName = Path.GetFileNameWithoutExtension(selectedSave);
|
||||||
var invalidChars = Path.GetInvalidFileNameChars();
|
var invalidChars = Path.GetInvalidFileNameChars();
|
||||||
|
|
||||||
ConfirmationDialogs.TextInputPrompt(
|
ConfirmationDialogs.TextInputPrompt(modData,
|
||||||
"Rename Save",
|
RenameSaveTitle,
|
||||||
"Enter a new file name:",
|
RenameSavePrompt,
|
||||||
initialName,
|
initialName,
|
||||||
onAccept: newName => Rename(initialName, newName),
|
onAccept: newName => Rename(initialName, newName),
|
||||||
onCancel: null,
|
onCancel: null,
|
||||||
acceptText: "Rename",
|
acceptText: RenameSaveAccept,
|
||||||
cancelText: null,
|
cancelText: null,
|
||||||
inputValidator: newName =>
|
inputValidator: newName =>
|
||||||
{
|
{
|
||||||
@@ -130,9 +169,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
deleteButton.IsDisabled = () => selectedSave == null;
|
deleteButton.IsDisabled = () => selectedSave == null;
|
||||||
deleteButton.OnClick = () =>
|
deleteButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Delete selected game save?",
|
title: DeleteSaveTitle,
|
||||||
text: $"Delete '{Path.GetFileNameWithoutExtension(selectedSave)}'?",
|
text: DeleteSavePrompt,
|
||||||
|
textArguments: Translation.Arguments("save", Path.GetFileNameWithoutExtension(selectedSave)),
|
||||||
onConfirm: () =>
|
onConfirm: () =>
|
||||||
{
|
{
|
||||||
Delete(selectedSave);
|
Delete(selectedSave);
|
||||||
@@ -145,7 +185,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
else
|
else
|
||||||
SelectFirstVisible();
|
SelectFirstVisible();
|
||||||
},
|
},
|
||||||
confirmText: "Delete",
|
confirmText: DeleteSaveAccept,
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -153,9 +193,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
deleteAllButton.IsDisabled = () => games.Count == 0;
|
deleteAllButton.IsDisabled = () => games.Count == 0;
|
||||||
deleteAllButton.OnClick = () =>
|
deleteAllButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Delete all game saves?",
|
title: DeleteAllSavesTitle,
|
||||||
text: $"Delete {games.Count} game saves?",
|
text: DeleteAllSavesPrompt,
|
||||||
|
textArguments: Translation.Arguments("count", games.Count),
|
||||||
onConfirm: () =>
|
onConfirm: () =>
|
||||||
{
|
{
|
||||||
foreach (var s in games.ToList())
|
foreach (var s in games.ToList())
|
||||||
@@ -164,7 +205,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Ui.CloseWindow();
|
Ui.CloseWindow();
|
||||||
onExit();
|
onExit();
|
||||||
},
|
},
|
||||||
confirmText: "Delete All",
|
confirmText: DeleteAllSavesAccept,
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -251,7 +292,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TextNotificationsManager.Debug("Failed to delete save file '{0}'. See the logs for details.", savePath);
|
TextNotificationsManager.Debug(modData.Translation.GetString(SaveDeletionFailed, Translation.Arguments("savePath", savePath)));
|
||||||
Log.Write("debug", ex.ToString());
|
Log.Write("debug", ex.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -319,11 +360,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
if (selectedSave != null || File.Exists(testPath))
|
if (selectedSave != null || File.Exists(testPath))
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Overwrite save game?",
|
title: OverwriteSaveTitle,
|
||||||
text: $"Overwrite {saveTextField.Text}?",
|
text: OverwriteSavePrompt,
|
||||||
|
textArguments: Translation.Arguments("file", saveTextField.Text),
|
||||||
onConfirm: inner,
|
onConfirm: inner,
|
||||||
confirmText: "Overwrite",
|
confirmText: OverwriteSaveAccpet,
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -28,6 +28,36 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
[TranslationReference]
|
[TranslationReference]
|
||||||
static readonly string Mute = "mute";
|
static readonly string Mute = "mute";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Accomplished = "accomplished";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Failed = "failed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InProgress = "in-progress";
|
||||||
|
|
||||||
|
[TranslationReference("team")]
|
||||||
|
static readonly string TeamNumber = "team-number";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoTeam = "no-team";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Spectators = "spectators";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Gone = "gone";
|
||||||
|
|
||||||
|
[TranslationReference("player")]
|
||||||
|
static readonly string KickTitle = "kick-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string KickPrompt = "kick-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string KickAccept = "kick-accept";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public GameInfoStatsLogic(Widget widget, ModData modData, World world, OrderManager orderManager, WorldRenderer worldRenderer, Action<bool> hideMenu)
|
public GameInfoStatsLogic(Widget widget, ModData modData, World world, OrderManager orderManager, WorldRenderer worldRenderer, Action<bool> hideMenu)
|
||||||
{
|
{
|
||||||
@@ -49,8 +79,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
checkbox.GetText = () => mo.Objectives.First().Description;
|
checkbox.GetText = () => mo.Objectives.First().Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
statusLabel.GetText = () => player.WinState == WinState.Won ? "Accomplished" :
|
statusLabel.GetText = () => player.WinState == WinState.Won ? Accomplished :
|
||||||
player.WinState == WinState.Lost ? "Failed" : "In progress";
|
player.WinState == WinState.Lost ? Failed : InProgress;
|
||||||
statusLabel.GetColor = () => player.WinState == WinState.Won ? Color.LimeGreen :
|
statusLabel.GetColor = () => player.WinState == WinState.Won ? Color.LimeGreen :
|
||||||
player.WinState == WinState.Lost ? Color.Red : Color.White;
|
player.WinState == WinState.Lost ? Color.Red : Color.White;
|
||||||
}
|
}
|
||||||
@@ -86,7 +116,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (teams.Count() > 1)
|
if (teams.Count() > 1)
|
||||||
{
|
{
|
||||||
var teamHeader = ScrollItemWidget.Setup(teamTemplate, () => true, () => { });
|
var teamHeader = ScrollItemWidget.Setup(teamTemplate, () => true, () => { });
|
||||||
teamHeader.Get<LabelWidget>("TEAM").GetText = () => t.Key == 0 ? "No Team" : $"Team {t.Key}";
|
var team = t.Key > 0
|
||||||
|
? modData.Translation.GetString(TeamNumber, Translation.Arguments("team", t.Key))
|
||||||
|
: modData.Translation.GetString(NoTeam);
|
||||||
|
teamHeader.Get<LabelWidget>("TEAM").GetText = () => team;
|
||||||
var teamRating = teamHeader.Get<LabelWidget>("TEAM_SCORE");
|
var teamRating = teamHeader.Get<LabelWidget>("TEAM_SCORE");
|
||||||
var scoreCache = new CachedTransform<int, string>(s => s.ToString());
|
var scoreCache = new CachedTransform<int, string>(s => s.ToString());
|
||||||
var teamMemberScores = t.Select(tt => tt.PlayerStatistics).Where(s => s != null).ToArray().Select(s => s.Experience);
|
var teamMemberScores = t.Select(tt => tt.PlayerStatistics).Where(s => s != null).ToArray().Select(s => s.Experience);
|
||||||
@@ -137,7 +170,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (spectators.Count > 0)
|
if (spectators.Count > 0)
|
||||||
{
|
{
|
||||||
var spectatorHeader = ScrollItemWidget.Setup(teamTemplate, () => true, () => { });
|
var spectatorHeader = ScrollItemWidget.Setup(teamTemplate, () => true, () => { });
|
||||||
spectatorHeader.Get<LabelWidget>("TEAM").GetText = () => "Spectators";
|
var spectatorTeam = modData.Translation.GetString(Spectators);
|
||||||
|
spectatorHeader.Get<LabelWidget>("TEAM").GetText = () => spectatorTeam;
|
||||||
|
|
||||||
playerPanel.AddChild(spectatorHeader);
|
playerPanel.AddChild(spectatorHeader);
|
||||||
|
|
||||||
@@ -155,7 +189,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
nameLabel.GetText = () =>
|
nameLabel.GetText = () =>
|
||||||
{
|
{
|
||||||
var suffix = client.State == Session.ClientState.Disconnected ? " (Gone)" : "";
|
var suffix = client.State == Session.ClientState.Disconnected ? $" ({modData.Translation.GetString(Gone)})" : "";
|
||||||
return name.Update((client.Name, suffix));
|
return name.Update((client.Name, suffix));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -164,16 +198,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
kickButton.OnClick = () =>
|
kickButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
hideMenu(true);
|
hideMenu(true);
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: $"Kick {client.Name}?",
|
title: KickTitle,
|
||||||
text: "They will not be able to rejoin this game.",
|
titleArguments: Translation.Arguments("player", client.Name),
|
||||||
|
text: KickPrompt,
|
||||||
onConfirm: () =>
|
onConfirm: () =>
|
||||||
{
|
{
|
||||||
orderManager.IssueOrder(Order.Command($"kick {client.Index} {false}"));
|
orderManager.IssueOrder(Order.Command($"kick {client.Index} {false}"));
|
||||||
hideMenu(false);
|
hideMenu(false);
|
||||||
},
|
},
|
||||||
onCancel: () => hideMenu(false),
|
onCancel: () => hideMenu(false),
|
||||||
confirmText: "Kick");
|
confirmText: KickAccept);
|
||||||
};
|
};
|
||||||
|
|
||||||
var muteCheckbox = item.Get<CheckboxWidget>("MUTE");
|
var muteCheckbox = item.Get<CheckboxWidget>("MUTE");
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly ContainerWidget chatChrome;
|
readonly ContainerWidget chatChrome;
|
||||||
readonly ScrollPanelWidget chatScrollPanel;
|
readonly ScrollPanelWidget chatScrollPanel;
|
||||||
readonly TextFieldWidget chatText;
|
readonly TextFieldWidget chatText;
|
||||||
readonly CachedTransform<int, string> chatDisabledLabel;
|
readonly CachedTransform<int, string> chatAvailableIn;
|
||||||
|
readonly string chatDisabled;
|
||||||
readonly Dictionary<TextNotificationPool, Widget> templates = new Dictionary<TextNotificationPool, Widget>();
|
readonly Dictionary<TextNotificationPool, Widget> templates = new Dictionary<TextNotificationPool, Widget>();
|
||||||
|
|
||||||
readonly TabCompletionLogic tabCompletion = new TabCompletionLogic();
|
readonly TabCompletionLogic tabCompletion = new TabCompletionLogic();
|
||||||
@@ -52,6 +53,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
[TranslationReference("seconds")]
|
[TranslationReference("seconds")]
|
||||||
static readonly string ChatAvailability = "chat-availability";
|
static readonly string ChatAvailability = "chat-availability";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ChatDisabled = "chat-disabled";
|
||||||
|
|
||||||
[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)
|
||||||
{
|
{
|
||||||
@@ -69,6 +73,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var teamMessage = modData.Translation.GetString(Team);
|
var teamMessage = modData.Translation.GetString(Team);
|
||||||
var allMessage = modData.Translation.GetString(All);
|
var allMessage = modData.Translation.GetString(All);
|
||||||
|
|
||||||
|
chatDisabled = modData.Translation.GetString(ChatDisabled);
|
||||||
|
|
||||||
// Only execute this once, the first time this widget is loaded
|
// Only execute this once, the first time this widget is loaded
|
||||||
if (TextNotificationsManager.MutedPlayers.Count == 0)
|
if (TextNotificationsManager.MutedPlayers.Count == 0)
|
||||||
foreach (var c in orderManager.LobbyInfo.Clients)
|
foreach (var c in orderManager.LobbyInfo.Clients)
|
||||||
@@ -188,7 +194,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
chatDisabledLabel = new CachedTransform<int, string>(x => modData.Translation.GetString(ChatAvailability, Translation.Arguments("seconds", x)));
|
chatAvailableIn = new CachedTransform<int, string>(x => modData.Translation.GetString(ChatAvailability, Translation.Arguments("seconds", x)));
|
||||||
|
|
||||||
if (!isMenuChat)
|
if (!isMenuChat)
|
||||||
{
|
{
|
||||||
@@ -320,7 +326,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (TextNotificationsManager.ChatDisabledUntil != uint.MaxValue)
|
if (TextNotificationsManager.ChatDisabledUntil != uint.MaxValue)
|
||||||
remaining = (int)(TextNotificationsManager.ChatDisabledUntil - Game.RunTime + 999) / 1000;
|
remaining = (int)(TextNotificationsManager.ChatDisabledUntil - Game.RunTime + 999) / 1000;
|
||||||
|
|
||||||
chatText.Text = chatDisabledLabel.Update(remaining);
|
chatText.Text = remaining == 0 ? chatDisabled : chatAvailableIn.Update(remaining);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,102 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
bool leaving;
|
bool leaving;
|
||||||
bool hideMenu;
|
bool hideMenu;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Leave = "leave";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string AbortMission = "abort-mission";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LeaveMissionTitle = "leave-mission-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LeaveMissionPrompt = "leave-mission-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LeaveMissionAccept = "leave-mission-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LeaveMissionCancel = "leave-mission-cancel";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RestartButton = "restart-button";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RestartMissionTitle = "restart-mission-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RestartMissionPrompt = "restart-mission-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RestartMissionAccept = "restart-mission-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RestartMissionCancel = "restart-mission-cancel";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SurrenderButton = "surrender-button";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SurrenderTitle = "surrender-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SurrenderPrompt = "surrender-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SurrenderAccept = "surrender-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SurrenderCancel = "surrender-cancel";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LoadGameButton = "load-game-button";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SaveGameButton = "save-game-button";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string MusicButton = "music-button";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SettingsButton = "settings-button";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ReturnToMap = "return-to-map";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Resume = "resume";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SaveMapButton = "save-map-button";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ErrorMaxPlayerTitle = "error-max-player-title";
|
||||||
|
|
||||||
|
[TranslationReference("players", "max")]
|
||||||
|
static readonly string ErrorMaxPlayerPrompt = "error-max-player-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ErrorMaxPlayerAccept = "error-max-player-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ExitMapButton = "exit-map-button";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ExitMapEditorTitle = "exit-map-editor-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ExitMapEditorPromptUnsaved = "exit-map-editor-prompt-unsaved";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ExitMapEditorPromptDeleted = "exit-map-editor-prompt-deleted";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ExitMapEditorAnywayConfirm = "exit-map-editor-confirm-anyway";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ExitMapEditorConfirm = "exit-map-editor-confirm";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public IngameMenuLogic(Widget widget, ModData modData, World world, Action onExit, WorldRenderer worldRenderer,
|
public IngameMenuLogic(Widget widget, ModData modData, World world, Action onExit, WorldRenderer worldRenderer,
|
||||||
IngameInfoPanel initialPanel, Dictionary<string, MiniYaml> logicArgs)
|
IngameInfoPanel initialPanel, Dictionary<string, MiniYaml> logicArgs)
|
||||||
@@ -175,7 +271,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
button.Id = id;
|
button.Id = id;
|
||||||
button.IsDisabled = () => leaving;
|
button.IsDisabled = () => leaving;
|
||||||
button.GetText = () => text;
|
var translation = modData.Translation.GetString(text);
|
||||||
|
button.GetText = () => translation;
|
||||||
buttonContainer.AddChild(button);
|
buttonContainer.AddChild(button);
|
||||||
buttons.Add(button);
|
buttons.Add(button);
|
||||||
|
|
||||||
@@ -187,19 +284,21 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (world.Type != WorldType.Regular)
|
if (world.Type != WorldType.Regular)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var button = AddButton("ABORT_MISSION", world.IsGameOver ? "Leave" : "Abort Mission");
|
var button = AddButton("ABORT_MISSION", world.IsGameOver
|
||||||
|
? modData.Translation.GetString(Leave)
|
||||||
|
: modData.Translation.GetString(AbortMission));
|
||||||
|
|
||||||
button.OnClick = () =>
|
button.OnClick = () =>
|
||||||
{
|
{
|
||||||
hideMenu = true;
|
hideMenu = true;
|
||||||
|
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Leave Mission",
|
title: LeaveMissionTitle,
|
||||||
text: "Leave this game and return to the menu?",
|
text: LeaveMissionPrompt,
|
||||||
onConfirm: OnQuit,
|
onConfirm: OnQuit,
|
||||||
onCancel: ShowMenu,
|
onCancel: ShowMenu,
|
||||||
confirmText: "Leave",
|
confirmText: LeaveMissionAccept,
|
||||||
cancelText: "Stay");
|
cancelText: LeaveMissionCancel);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,18 +323,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Game.RunAfterDelay(exitDelay, Game.RestartGame);
|
Game.RunAfterDelay(exitDelay, Game.RestartGame);
|
||||||
};
|
};
|
||||||
|
|
||||||
var button = AddButton("RESTART", "Restart");
|
var button = AddButton("RESTART", RestartButton);
|
||||||
button.IsDisabled = () => hasError || leaving;
|
button.IsDisabled = () => hasError || leaving;
|
||||||
button.OnClick = () =>
|
button.OnClick = () =>
|
||||||
{
|
{
|
||||||
hideMenu = true;
|
hideMenu = true;
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Restart",
|
title: RestartMissionTitle,
|
||||||
text: "Are you sure you want to restart?",
|
text: RestartMissionPrompt,
|
||||||
onConfirm: onRestart,
|
onConfirm: onRestart,
|
||||||
onCancel: ShowMenu,
|
onCancel: ShowMenu,
|
||||||
confirmText: "Restart",
|
confirmText: RestartMissionAccept,
|
||||||
cancelText: "Stay");
|
cancelText: RestartMissionCancel);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,18 +349,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
CloseMenu();
|
CloseMenu();
|
||||||
};
|
};
|
||||||
|
|
||||||
var button = AddButton("SURRENDER", "Surrender");
|
var button = AddButton("SURRENDER", SurrenderButton);
|
||||||
button.IsDisabled = () => world.LocalPlayer.WinState != WinState.Undefined || hasError || leaving;
|
button.IsDisabled = () => world.LocalPlayer.WinState != WinState.Undefined || hasError || leaving;
|
||||||
button.OnClick = () =>
|
button.OnClick = () =>
|
||||||
{
|
{
|
||||||
hideMenu = true;
|
hideMenu = true;
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Surrender",
|
title: SurrenderTitle,
|
||||||
text: "Are you sure you want to surrender?",
|
text: SurrenderPrompt,
|
||||||
onConfirm: onSurrender,
|
onConfirm: onSurrender,
|
||||||
onCancel: ShowMenu,
|
onCancel: ShowMenu,
|
||||||
confirmText: "Surrender",
|
confirmText: SurrenderAccept,
|
||||||
cancelText: "Stay");
|
cancelText: SurrenderCancel);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +369,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (world.Type != WorldType.Regular || !world.LobbyInfo.GlobalSettings.GameSavesEnabled || world.IsReplay)
|
if (world.Type != WorldType.Regular || !world.LobbyInfo.GlobalSettings.GameSavesEnabled || world.IsReplay)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var button = AddButton("LOAD_GAME", "Load Game");
|
var button = AddButton("LOAD_GAME", LoadGameButton);
|
||||||
button.IsDisabled = () => leaving || !GameSaveBrowserLogic.IsLoadPanelEnabled(modData.Manifest);
|
button.IsDisabled = () => leaving || !GameSaveBrowserLogic.IsLoadPanelEnabled(modData.Manifest);
|
||||||
button.OnClick = () =>
|
button.OnClick = () =>
|
||||||
{
|
{
|
||||||
@@ -290,7 +389,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (world.Type != WorldType.Regular || !world.LobbyInfo.GlobalSettings.GameSavesEnabled || world.IsReplay)
|
if (world.Type != WorldType.Regular || !world.LobbyInfo.GlobalSettings.GameSavesEnabled || world.IsReplay)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var button = AddButton("SAVE_GAME", "Save Game");
|
var button = AddButton("SAVE_GAME", SaveGameButton);
|
||||||
button.IsDisabled = () => hasError || leaving || !world.Players.Any(p => p.Playable && p.WinState == WinState.Undefined);
|
button.IsDisabled = () => hasError || leaving || !world.Players.Any(p => p.Playable && p.WinState == WinState.Undefined);
|
||||||
button.OnClick = () =>
|
button.OnClick = () =>
|
||||||
{
|
{
|
||||||
@@ -307,7 +406,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void CreateMusicButton()
|
void CreateMusicButton()
|
||||||
{
|
{
|
||||||
var button = AddButton("MUSIC", "Music");
|
var button = AddButton("MUSIC", MusicButton);
|
||||||
button.OnClick = () =>
|
button.OnClick = () =>
|
||||||
{
|
{
|
||||||
hideMenu = true;
|
hideMenu = true;
|
||||||
@@ -321,7 +420,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void CreateSettingsButton()
|
void CreateSettingsButton()
|
||||||
{
|
{
|
||||||
var button = AddButton("SETTINGS", "Settings");
|
var button = AddButton("SETTINGS", SettingsButton);
|
||||||
button.OnClick = () =>
|
button.OnClick = () =>
|
||||||
{
|
{
|
||||||
hideMenu = true;
|
hideMenu = true;
|
||||||
@@ -336,7 +435,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void CreateResumeButton()
|
void CreateResumeButton()
|
||||||
{
|
{
|
||||||
var button = AddButton("RESUME", world.IsGameOver ? "Return to map" : "Resume");
|
var button = AddButton("RESUME", world.IsGameOver ? ReturnToMap : Resume);
|
||||||
button.Key = modData.Hotkeys["escape"];
|
button.Key = modData.Hotkeys["escape"];
|
||||||
button.OnClick = CloseMenu;
|
button.OnClick = CloseMenu;
|
||||||
}
|
}
|
||||||
@@ -346,7 +445,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (world.Type != WorldType.Editor)
|
if (world.Type != WorldType.Editor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var button = AddButton("SAVE_MAP", "Save Map");
|
var button = AddButton("SAVE_MAP", SaveMapButton);
|
||||||
button.OnClick = () =>
|
button.OnClick = () =>
|
||||||
{
|
{
|
||||||
hideMenu = true;
|
hideMenu = true;
|
||||||
@@ -358,11 +457,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var playerCount = new MapPlayers(playerDefinitions).Players.Count;
|
var playerCount = new MapPlayers(playerDefinitions).Players.Count;
|
||||||
if (playerCount > MapPlayers.MaximumPlayerCount)
|
if (playerCount > MapPlayers.MaximumPlayerCount)
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Error: Max player count exceeded",
|
title: ErrorMaxPlayerTitle,
|
||||||
text: $"There are too many players defined ({playerCount}/{MapPlayers.MaximumPlayerCount}).",
|
text: ErrorMaxPlayerPrompt,
|
||||||
|
textArguments: Translation.Arguments("players", playerCount, "max", MapPlayers.MaximumPlayerCount),
|
||||||
onConfirm: ShowMenu,
|
onConfirm: ShowMenu,
|
||||||
confirmText: "Back");
|
confirmText: ErrorMaxPlayerAccept);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -384,7 +484,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var actionManager = world.WorldActor.Trait<EditorActionManager>();
|
var actionManager = world.WorldActor.Trait<EditorActionManager>();
|
||||||
var button = AddButton("EXIT_EDITOR", "Exit Map Editor");
|
var button = AddButton("EXIT_EDITOR", ExitMapButton);
|
||||||
|
|
||||||
// Show dialog only if updated since last save
|
// Show dialog only if updated since last save
|
||||||
button.OnClick = () =>
|
button.OnClick = () =>
|
||||||
@@ -394,10 +494,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (actionManager.HasUnsavedItems() || deletedOrUnavailable)
|
if (actionManager.HasUnsavedItems() || deletedOrUnavailable)
|
||||||
{
|
{
|
||||||
hideMenu = true;
|
hideMenu = true;
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Warning",
|
title: ExitMapEditorTitle,
|
||||||
text: deletedOrUnavailable ? "The map may have been deleted outside the editor" : "Exit and lose all unsaved changes?",
|
text: deletedOrUnavailable ? ExitMapEditorPromptDeleted : ExitMapEditorPromptUnsaved,
|
||||||
confirmText: deletedOrUnavailable ? "Exit anyway" : "Exit",
|
confirmText: deletedOrUnavailable ? ExitMapEditorAnywayConfirm : ExitMapEditorConfirm,
|
||||||
onConfirm: OnQuit,
|
onConfirm: OnQuit,
|
||||||
onCancel: ShowMenu);
|
onCancel: ShowMenu);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
static readonly string Players = "players";
|
static readonly string Players = "players";
|
||||||
|
|
||||||
[TranslationReference("team")]
|
[TranslationReference("team")]
|
||||||
static readonly string Team = "team-no-team";
|
static readonly string TeamNumber = "team-number";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoTeam = "no-team";
|
||||||
|
|
||||||
class CameraOption
|
class CameraOption
|
||||||
{
|
{
|
||||||
@@ -116,7 +119,10 @@ 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 ? modData.Translation.GetString(Players) : modData.Translation.GetString(Team, Translation.Arguments("team", t.Key));
|
var label = noTeams ? modData.Translation.GetString(Players) : t.Key > 0
|
||||||
|
? modData.Translation.GetString(TeamNumber, Translation.Arguments("team", t.Key))
|
||||||
|
: modData.Translation.GetString(NoTeam);
|
||||||
|
|
||||||
groups.Add(label, t);
|
groups.Add(label, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
static readonly string ArmyGraph = "army-graph";
|
static readonly string ArmyGraph = "army-graph";
|
||||||
|
|
||||||
[TranslationReference("team")]
|
[TranslationReference("team")]
|
||||||
static readonly string Team = "team-no-team";
|
static readonly string TeamNumber = "team-number";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoTeam = "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)
|
||||||
@@ -91,7 +94,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
|
|
||||||
MiniYaml yaml;
|
MiniYaml yaml;
|
||||||
string[] keyNames = Enum.GetNames(typeof(ObserverStatsPanel));
|
var keyNames = Enum.GetNames(typeof(ObserverStatsPanel));
|
||||||
var statsHotkeys = new HotkeyReference[keyNames.Length];
|
var statsHotkeys = new HotkeyReference[keyNames.Length];
|
||||||
for (var i = 0; i < keyNames.Length; i++)
|
for (var i = 0; i < keyNames.Length; i++)
|
||||||
statsHotkeys[i] = logicArgs.TryGetValue("Statistics" + keyNames[i] + "Key", out yaml) ? modData.Hotkeys[yaml.Value] : new HotkeyReference();
|
statsHotkeys[i] = logicArgs.TryGetValue("Statistics" + keyNames[i] + "Key", out yaml) ? modData.Hotkeys[yaml.Value] : new HotkeyReference();
|
||||||
@@ -144,7 +147,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
title = modData.Translation.GetString(title);
|
title = modData.Translation.GetString(title);
|
||||||
return new StatsDropDownOption
|
return new StatsDropDownOption
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = modData.Translation.GetString(title),
|
||||||
IsSelected = () => activePanel == panel,
|
IsSelected = () => activePanel == panel,
|
||||||
OnClick = () =>
|
OnClick = () =>
|
||||||
{
|
{
|
||||||
@@ -272,9 +275,10 @@ 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 = modData.Translation.GetString(Team, Translation.Arguments("team-no-team", team.Key));
|
var teamText = team.Key > 0 ? modData.Translation.GetString(TeamNumber, Translation.Arguments("team", team.Key))
|
||||||
|
: modData.Translation.GetString(NoTeam);
|
||||||
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(teamText).X;
|
||||||
|
|
||||||
var colorBlockWidget = tt.Get<ColorBlockWidget>("TEAM_COLOR");
|
var colorBlockWidget = tt.Get<ColorBlockWidget>("TEAM_COLOR");
|
||||||
var scrollBarOffset = playerStatsPanel.ScrollBar != ScrollBar.Hidden
|
var scrollBarOffset = playerStatsPanel.ScrollBar != ScrollBar.Hidden
|
||||||
|
|||||||
@@ -24,6 +24,41 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
public class DownloadPackageLogic : ChromeLogic
|
public class DownloadPackageLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
|
static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
|
||||||
|
|
||||||
|
[TranslationReference("title")]
|
||||||
|
static readonly string Downloading = "downloading";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string FetchingMirrorList = "fetching-mirror-list";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string UnknownHost = "unknown-host";
|
||||||
|
|
||||||
|
[TranslationReference("host", "received", "suffix")]
|
||||||
|
static readonly string DownloadingFrom = "downloading-from";
|
||||||
|
|
||||||
|
[TranslationReference("host", "received", "total", "suffix", "progress")]
|
||||||
|
static readonly string DownloadingFromProgress = "downloading-from-progress";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string VerifyingArchive = "verifying-archive";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ArchiveValidationFailed = "archive-validation-failed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Extracting = "extracting";
|
||||||
|
|
||||||
|
[TranslationReference("entry")]
|
||||||
|
static readonly string ExtractingEntry = "extracting-entry";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ArchiveExtractionFailed = "archive-extraction-failed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string MirrorSelectionFailed = "mirror-selection-failed";
|
||||||
|
|
||||||
|
readonly ModData modData;
|
||||||
readonly ModContent.ModDownload download;
|
readonly ModContent.ModDownload download;
|
||||||
readonly Action onSuccess;
|
readonly Action onSuccess;
|
||||||
|
|
||||||
@@ -34,8 +69,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
string downloadHost;
|
string downloadHost;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public DownloadPackageLogic(Widget widget, ModContent.ModDownload download, Action onSuccess)
|
public DownloadPackageLogic(Widget widget, ModData modData, ModContent.ModDownload download, Action onSuccess)
|
||||||
{
|
{
|
||||||
|
this.modData = modData;
|
||||||
this.download = download;
|
this.download = download;
|
||||||
this.onSuccess = onSuccess;
|
this.onSuccess = onSuccess;
|
||||||
|
|
||||||
@@ -49,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var status = new CachedTransform<string, string>(s => WidgetUtils.TruncateText(s, statusLabel.Bounds.Width, statusFont));
|
var status = new CachedTransform<string, string>(s => WidgetUtils.TruncateText(s, statusLabel.Bounds.Width, statusFont));
|
||||||
statusLabel.GetText = () => status.Update(getStatusText());
|
statusLabel.GetText = () => status.Update(getStatusText());
|
||||||
|
|
||||||
var text = $"Downloading {download.Title}";
|
var text = modData.Translation.GetString(Downloading, Translation.Arguments("title", download.Title));
|
||||||
panel.Get<LabelWidget>("TITLE").Text = text;
|
panel.Get<LabelWidget>("TITLE").Text = text;
|
||||||
|
|
||||||
ShowDownloadDialog();
|
ShowDownloadDialog();
|
||||||
@@ -57,7 +93,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void ShowDownloadDialog()
|
void ShowDownloadDialog()
|
||||||
{
|
{
|
||||||
getStatusText = () => "Fetching list of mirrors...";
|
getStatusText = () => modData.Translation.GetString(FetchingMirrorList);
|
||||||
progressBar.Indeterminate = true;
|
progressBar.Indeterminate = true;
|
||||||
|
|
||||||
var retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
|
var retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
|
||||||
@@ -71,6 +107,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var dataTotal = 0.0f;
|
var dataTotal = 0.0f;
|
||||||
var mag = 0;
|
var mag = 0;
|
||||||
var dataSuffix = "";
|
var dataSuffix = "";
|
||||||
|
var host = downloadHost ?? UnknownHost;
|
||||||
|
|
||||||
if (total < 0)
|
if (total < 0)
|
||||||
{
|
{
|
||||||
@@ -78,7 +115,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
dataReceived = read / (float)(1L << (mag * 10));
|
dataReceived = read / (float)(1L << (mag * 10));
|
||||||
dataSuffix = SizeSuffixes[mag];
|
dataSuffix = SizeSuffixes[mag];
|
||||||
|
|
||||||
getStatusText = () => $"Downloading from {downloadHost ?? "unknown host"} {dataReceived:0.00} {dataSuffix}";
|
getStatusText = () => modData.Translation.GetString(DownloadingFrom,
|
||||||
|
Translation.Arguments("host", host, "received", $"{dataReceived:0.00}", "suffix", dataSuffix));
|
||||||
progressBar.Indeterminate = true;
|
progressBar.Indeterminate = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -88,7 +126,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
dataReceived = read / (float)(1L << (mag * 10));
|
dataReceived = read / (float)(1L << (mag * 10));
|
||||||
dataSuffix = SizeSuffixes[mag];
|
dataSuffix = SizeSuffixes[mag];
|
||||||
|
|
||||||
getStatusText = () => $"Downloading from {downloadHost ?? "unknown host"} {dataReceived:0.00}/{dataTotal:0.00} {dataSuffix} ({progressPercentage}%)";
|
getStatusText = () => modData.Translation.GetString(DownloadingFromProgress,
|
||||||
|
Translation.Arguments("host", host, "received", $"{dataReceived:0.00}", "total", $"{dataTotal:0.00}",
|
||||||
|
"suffix", dataSuffix, "progress", progressPercentage));
|
||||||
progressBar.Indeterminate = false;
|
progressBar.Indeterminate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +182,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
// Validate integrity
|
// Validate integrity
|
||||||
if (!string.IsNullOrEmpty(download.SHA1))
|
if (!string.IsNullOrEmpty(download.SHA1))
|
||||||
{
|
{
|
||||||
getStatusText = () => "Verifying archive...";
|
getStatusText = () => modData.Translation.GetString(VerifyingArchive);
|
||||||
progressBar.Indeterminate = true;
|
progressBar.Indeterminate = true;
|
||||||
|
|
||||||
var archiveValid = false;
|
var archiveValid = false;
|
||||||
@@ -164,13 +204,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
if (!archiveValid)
|
if (!archiveValid)
|
||||||
{
|
{
|
||||||
onError("Archive validation failed");
|
onError(modData.Translation.GetString(ArchiveValidationFailed));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatically extract
|
// Automatically extract
|
||||||
getStatusText = () => "Extracting...";
|
getStatusText = () => modData.Translation.GetString(Extracting);
|
||||||
progressBar.Indeterminate = true;
|
progressBar.Indeterminate = true;
|
||||||
|
|
||||||
var extracted = new List<string>();
|
var extracted = new List<string>();
|
||||||
@@ -185,7 +225,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (entry == null || !entry.IsFile)
|
if (entry == null || !entry.IsFile)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
onExtractProgress("Extracting " + entry.Name);
|
onExtractProgress(modData.Translation.GetString(ExtractingEntry, Translation.Arguments("entry", entry.Name)));
|
||||||
Log.Write("install", "Extracting " + entry.Name);
|
Log.Write("install", "Extracting " + entry.Name);
|
||||||
var targetPath = Platform.ResolvePath(kv.Key);
|
var targetPath = Platform.ResolvePath(kv.Key);
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(targetPath));
|
Directory.CreateDirectory(Path.GetDirectoryName(targetPath));
|
||||||
@@ -215,7 +255,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
File.Delete(f);
|
File.Delete(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
onError("Archive extraction failed");
|
onError(modData.Translation.GetString(ArchiveExtractionFailed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -248,7 +288,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
Log.Write("install", "Mirror selection failed with error:");
|
Log.Write("install", "Mirror selection failed with error:");
|
||||||
Log.Write("install", e.ToString());
|
Log.Write("install", e.ToString());
|
||||||
onError("Online mirror is not available. Please install from an original disc.");
|
onError(modData.Translation.GetString(MirrorSelectionFailed));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
enum Mode { Progress, Message, List }
|
enum Mode { Progress, Message, List }
|
||||||
|
|
||||||
|
readonly ModData modData;
|
||||||
readonly ModContent content;
|
readonly ModContent content;
|
||||||
readonly Dictionary<string, ModContent.ModSource> sources;
|
readonly Dictionary<string, ModContent.ModSource> sources;
|
||||||
|
|
||||||
@@ -53,9 +54,67 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
Mode visible = Mode.Progress;
|
Mode visible = Mode.Progress;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DetectingDrives = "detecting-drives";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string CheckingDiscs = "checking-discs";
|
||||||
|
|
||||||
|
[TranslationReference("title")]
|
||||||
|
static readonly string SearchingDiscFor = "searching-disc-for";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ContentPackageInstallation = "content-package-installation";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string GameDiscs = "game-discs";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DigitalInstalls = "digital-installs";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string GameContentNotFound = "game-content-not-found";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string AlternativeContentSources = "alternative-content-sources";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InstallingContent = "installing-content";
|
||||||
|
|
||||||
|
[TranslationReference("filename")]
|
||||||
|
static readonly string CopyingFilename = "copying-filename";
|
||||||
|
|
||||||
|
[TranslationReference("filename", "progress")]
|
||||||
|
static readonly string CopyingFilenameProgress = "copying-filename-progress";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InstallationFailed = "installation-failed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string CheckInstallLog = "check-install-log";
|
||||||
|
|
||||||
|
[TranslationReference("filename")]
|
||||||
|
static readonly string Extracing = "extracting-filename";
|
||||||
|
|
||||||
|
[TranslationReference("filename", "progress")]
|
||||||
|
static readonly string ExtracingProgress = "extracting-filename-progress";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Continue = "continue";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Cancel = "cancel";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Retry = "retry";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Back = "back";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public InstallFromDiscLogic(Widget widget, ModContent content, Dictionary<string, ModContent.ModSource> sources)
|
public InstallFromDiscLogic(Widget widget, ModData modData, ModContent content, Dictionary<string, ModContent.ModSource> sources)
|
||||||
{
|
{
|
||||||
|
this.modData = modData;
|
||||||
this.content = content;
|
this.content = content;
|
||||||
this.sources = sources;
|
this.sources = sources;
|
||||||
|
|
||||||
@@ -108,8 +167,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void DetectContentDisks()
|
void DetectContentDisks()
|
||||||
{
|
{
|
||||||
var message = "Detecting drives";
|
var message = modData.Translation.GetString(DetectingDrives);
|
||||||
ShowProgressbar("Checking Discs", () => message);
|
ShowProgressbar(modData.Translation.GetString(CheckingDiscs), () => message);
|
||||||
ShowBackRetry(DetectContentDisks);
|
ShowBackRetry(DetectContentDisks);
|
||||||
|
|
||||||
new Task(() =>
|
new Task(() =>
|
||||||
@@ -132,7 +191,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
foreach (var kv in sources)
|
foreach (var kv in sources)
|
||||||
{
|
{
|
||||||
message = "Searching for " + kv.Value.Title;
|
message = modData.Translation.GetString(SearchingDiscFor, Translation.Arguments("title", kv.Value.Title));
|
||||||
|
|
||||||
var path = FindSourcePath(kv.Value, volumes);
|
var path = FindSourcePath(kv.Value, volumes);
|
||||||
if (path != null)
|
if (path != null)
|
||||||
@@ -148,7 +207,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
Game.RunAfterTick(() =>
|
Game.RunAfterTick(() =>
|
||||||
{
|
{
|
||||||
ShowList(kv.Value.Title, "The following content packages will be installed:", packages);
|
ShowList(kv.Value.Title, modData.Translation.GetString(ContentPackageInstallation), packages);
|
||||||
ShowContinueCancel(() => InstallFromDisc(path, kv.Value));
|
ShowContinueCancel(() => InstallFromDisc(path, kv.Value));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -169,7 +228,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var options = new Dictionary<string, IEnumerable<string>>()
|
var options = new Dictionary<string, IEnumerable<string>>()
|
||||||
{
|
{
|
||||||
{ "Game Discs", discs },
|
{ modData.Translation.GetString(GameDiscs), discs },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Platform.CurrentPlatform == PlatformType.Windows)
|
if (Platform.CurrentPlatform == PlatformType.Windows)
|
||||||
@@ -179,12 +238,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
.Select(s => s.Title)
|
.Select(s => s.Title)
|
||||||
.Distinct();
|
.Distinct();
|
||||||
|
|
||||||
options.Add("Digital Installs", installations);
|
options.Add(modData.Translation.GetString(DigitalInstalls), installations);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game.RunAfterTick(() =>
|
Game.RunAfterTick(() =>
|
||||||
{
|
{
|
||||||
ShowList("Game Content Not Found", "Please insert or install one of the following content sources:", options);
|
ShowList(modData.Translation.GetString(GameContentNotFound), modData.Translation.GetString(AlternativeContentSources), options);
|
||||||
ShowBackRetry(DetectContentDisks);
|
ShowBackRetry(DetectContentDisks);
|
||||||
});
|
});
|
||||||
}).Start();
|
}).Start();
|
||||||
@@ -193,7 +252,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
void InstallFromDisc(string path, ModContent.ModSource modSource)
|
void InstallFromDisc(string path, ModContent.ModSource modSource)
|
||||||
{
|
{
|
||||||
var message = "";
|
var message = "";
|
||||||
ShowProgressbar("Installing Content", () => message);
|
ShowProgressbar(modData.Translation.GetString(InstallingContent), () => message);
|
||||||
ShowDisabledCancel();
|
ShowDisabledCancel();
|
||||||
|
|
||||||
new Task(() =>
|
new Task(() =>
|
||||||
@@ -231,9 +290,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
Action<long> onProgress = null;
|
Action<long> onProgress = null;
|
||||||
if (length < ShowPercentageThreshold)
|
if (length < ShowPercentageThreshold)
|
||||||
message = "Copying " + displayFilename;
|
message = modData.Translation.GetString(CopyingFilename, Translation.Arguments("filename", displayFilename));
|
||||||
else
|
else
|
||||||
onProgress = b => message = $"Copying {displayFilename} ({100 * b / length}%)";
|
onProgress = b => message = modData.Translation.GetString(CopyingFilenameProgress, Translation.Arguments("filename", displayFilename, "progress", 100 * b / length));
|
||||||
|
|
||||||
CopyStream(source, target, length, onProgress);
|
CopyStream(source, target, length, onProgress);
|
||||||
}
|
}
|
||||||
@@ -244,25 +303,25 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
case "extract-raw":
|
case "extract-raw":
|
||||||
{
|
{
|
||||||
ExtractFromPackage(ExtractionType.Raw, path, i.Value, extracted, m => message = m);
|
ExtractFromPackage(modData, ExtractionType.Raw, path, i.Value, extracted, m => message = m);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "extract-blast":
|
case "extract-blast":
|
||||||
{
|
{
|
||||||
ExtractFromPackage(ExtractionType.Blast, path, i.Value, extracted, m => message = m);
|
ExtractFromPackage(modData, ExtractionType.Blast, path, i.Value, extracted, m => message = m);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "extract-mscab":
|
case "extract-mscab":
|
||||||
{
|
{
|
||||||
ExtractFromMSCab(path, i.Value, extracted, m => message = m);
|
ExtractFromMSCab(modData, path, i.Value, extracted, m => message = m);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "extract-iscab":
|
case "extract-iscab":
|
||||||
{
|
{
|
||||||
ExtractFromISCab(path, i.Value, extracted, m => message = m);
|
ExtractFromISCab(modData, path, i.Value, extracted, m => message = m);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +355,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
Game.RunAfterTick(() =>
|
Game.RunAfterTick(() =>
|
||||||
{
|
{
|
||||||
ShowMessage("Installation Failed", "Refer to install.log in the logs directory for details.");
|
ShowMessage(modData.Translation.GetString(InstallationFailed), modData.Translation.GetString(CheckInstallLog));
|
||||||
ShowBackRetry(() => InstallFromDisc(path, modSource));
|
ShowBackRetry(() => InstallFromDisc(path, modSource));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -320,7 +379,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
enum ExtractionType { Raw, Blast }
|
enum ExtractionType { Raw, Blast }
|
||||||
|
|
||||||
static void ExtractFromPackage(ExtractionType type, string path, MiniYaml actionYaml, List<string> extractedFiles, Action<string> updateMessage)
|
static void ExtractFromPackage(ModData modData, ExtractionType type, string path, MiniYaml actionYaml, List<string> extractedFiles, Action<string> updateMessage)
|
||||||
{
|
{
|
||||||
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected disc path
|
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected disc path
|
||||||
var sourcePath = actionYaml.Value.StartsWith("^") ? Platform.ResolvePath(actionYaml.Value) : Path.Combine(path, actionYaml.Value);
|
var sourcePath = actionYaml.Value.StartsWith("^") ? Platform.ResolvePath(actionYaml.Value) : Path.Combine(path, actionYaml.Value);
|
||||||
@@ -360,9 +419,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
Action<long> onProgress = null;
|
Action<long> onProgress = null;
|
||||||
if (length < ShowPercentageThreshold)
|
if (length < ShowPercentageThreshold)
|
||||||
updateMessage("Extracting " + displayFilename);
|
updateMessage(modData.Translation.GetString(Extracing, Translation.Arguments("filename", displayFilename)));
|
||||||
else
|
else
|
||||||
onProgress = b => updateMessage($"Extracting {displayFilename} ({100 * b / length}%)");
|
onProgress = b => updateMessage(modData.Translation.GetString(ExtracingProgress, Translation.Arguments("filename", displayFilename, "progress", 100 * b / length)));
|
||||||
|
|
||||||
using (var target = File.OpenWrite(targetPath))
|
using (var target = File.OpenWrite(targetPath))
|
||||||
{
|
{
|
||||||
@@ -376,7 +435,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ExtractFromMSCab(string path, MiniYaml actionYaml, List<string> extractedFiles, Action<string> updateMessage)
|
static void ExtractFromMSCab(ModData modData, string path, MiniYaml actionYaml, List<string> extractedFiles, Action<string> updateMessage)
|
||||||
{
|
{
|
||||||
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected disc path
|
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected disc path
|
||||||
var sourcePath = actionYaml.Value.StartsWith("^") ? Platform.ResolvePath(actionYaml.Value) : Path.Combine(path, actionYaml.Value);
|
var sourcePath = actionYaml.Value.StartsWith("^") ? Platform.ResolvePath(actionYaml.Value) : Path.Combine(path, actionYaml.Value);
|
||||||
@@ -400,14 +459,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
Log.Write("install", $"Extracting {sourcePath} -> {targetPath}");
|
Log.Write("install", $"Extracting {sourcePath} -> {targetPath}");
|
||||||
var displayFilename = Path.GetFileName(Path.GetFileName(targetPath));
|
var displayFilename = Path.GetFileName(Path.GetFileName(targetPath));
|
||||||
Action<int> onProgress = percent => updateMessage($"Extracting {displayFilename} ({percent}%)");
|
Action<int> onProgress = percent => updateMessage(modData.Translation.GetString(ExtracingProgress, Translation.Arguments("filename", displayFilename, "progress", percent)));
|
||||||
reader.ExtractFile(node.Value.Value, target, onProgress);
|
reader.ExtractFile(node.Value.Value, target, onProgress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ExtractFromISCab(string path, MiniYaml actionYaml, List<string> extractedFiles, Action<string> updateMessage)
|
static void ExtractFromISCab(ModData modData, string path, MiniYaml actionYaml, List<string> extractedFiles, Action<string> updateMessage)
|
||||||
{
|
{
|
||||||
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected disc path
|
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected disc path
|
||||||
var sourcePath = actionYaml.Value.StartsWith("^") ? Platform.ResolvePath(actionYaml.Value) : Path.Combine(path, actionYaml.Value);
|
var sourcePath = actionYaml.Value.StartsWith("^") ? Platform.ResolvePath(actionYaml.Value) : Path.Combine(path, actionYaml.Value);
|
||||||
@@ -449,7 +508,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
Log.Write("install", $"Extracting {sourcePath} -> {targetPath}");
|
Log.Write("install", $"Extracting {sourcePath} -> {targetPath}");
|
||||||
var displayFilename = Path.GetFileName(Path.GetFileName(targetPath));
|
var displayFilename = Path.GetFileName(Path.GetFileName(targetPath));
|
||||||
Action<int> onProgress = percent => updateMessage($"Extracting {displayFilename} ({percent}%)");
|
Action<int> onProgress = percent => updateMessage(modData.Translation.GetString(ExtracingProgress, Translation.Arguments("filename", displayFilename, "progress", percent)));
|
||||||
reader.ExtractFile(node.Value.Value, target, onProgress);
|
reader.ExtractFile(node.Value.Value, target, onProgress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -627,11 +686,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
void ShowContinueCancel(Action continueAction)
|
void ShowContinueCancel(Action continueAction)
|
||||||
{
|
{
|
||||||
primaryButton.OnClick = continueAction;
|
primaryButton.OnClick = continueAction;
|
||||||
primaryButton.Text = "Continue";
|
primaryButton.Text = modData.Translation.GetString(Continue);
|
||||||
primaryButton.Visible = true;
|
primaryButton.Visible = true;
|
||||||
|
|
||||||
secondaryButton.OnClick = Ui.CloseWindow;
|
secondaryButton.OnClick = Ui.CloseWindow;
|
||||||
secondaryButton.Text = "Cancel";
|
secondaryButton.Text = modData.Translation.GetString(Cancel);
|
||||||
secondaryButton.Visible = true;
|
secondaryButton.Visible = true;
|
||||||
secondaryButton.Disabled = false;
|
secondaryButton.Disabled = false;
|
||||||
Game.RunAfterTick(Ui.ResetTooltips);
|
Game.RunAfterTick(Ui.ResetTooltips);
|
||||||
@@ -640,11 +699,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
void ShowBackRetry(Action retryAction)
|
void ShowBackRetry(Action retryAction)
|
||||||
{
|
{
|
||||||
primaryButton.OnClick = retryAction;
|
primaryButton.OnClick = retryAction;
|
||||||
primaryButton.Text = "Retry";
|
primaryButton.Text = modData.Translation.GetString(Retry);
|
||||||
primaryButton.Visible = true;
|
primaryButton.Visible = true;
|
||||||
|
|
||||||
secondaryButton.OnClick = Ui.CloseWindow;
|
secondaryButton.OnClick = Ui.CloseWindow;
|
||||||
secondaryButton.Text = "Back";
|
secondaryButton.Text = modData.Translation.GetString(Back);
|
||||||
secondaryButton.Visible = true;
|
secondaryButton.Visible = true;
|
||||||
secondaryButton.Disabled = false;
|
secondaryButton.Disabled = false;
|
||||||
Game.RunAfterTick(Ui.ResetTooltips);
|
Game.RunAfterTick(Ui.ResetTooltips);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class ModContentLogic : ChromeLogic
|
public class ModContentLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
readonly ModData modData;
|
||||||
readonly ModContent content;
|
readonly ModContent content;
|
||||||
readonly ScrollPanelWidget scrollPanel;
|
readonly ScrollPanelWidget scrollPanel;
|
||||||
readonly Widget template;
|
readonly Widget template;
|
||||||
@@ -29,9 +30,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
bool discAvailable;
|
bool discAvailable;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ManualInstall = "manual-install";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ModContentLogic(Widget widget, Manifest mod, ModContent content, Action onCancel)
|
public ModContentLogic(ModData modData, Widget widget, Manifest mod, ModContent content, Action onCancel)
|
||||||
{
|
{
|
||||||
|
this.modData = modData;
|
||||||
this.content = content;
|
this.content = content;
|
||||||
|
|
||||||
var panel = widget.Get("CONTENT_PANEL");
|
var panel = widget.Get("CONTENT_PANEL");
|
||||||
@@ -137,7 +142,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var requiresDiscWidget = container.Get<LabelWidget>("REQUIRES_DISC");
|
var requiresDiscWidget = container.Get<LabelWidget>("REQUIRES_DISC");
|
||||||
requiresDiscWidget.IsVisible = () => !installed && !downloadEnabled;
|
requiresDiscWidget.IsVisible = () => !installed && !downloadEnabled;
|
||||||
if (!isSourceAvailable)
|
if (!isSourceAvailable)
|
||||||
requiresDiscWidget.GetText = () => "Manual Install";
|
{
|
||||||
|
var manualInstall = modData.Translation.GetString(ManualInstall);
|
||||||
|
requiresDiscWidget.GetText = () => manualInstall;
|
||||||
|
}
|
||||||
|
|
||||||
scrollPanel.AddChild(container);
|
scrollPanel.AddChild(container);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,21 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly ModContent content;
|
readonly ModContent content;
|
||||||
bool requiredContentInstalled;
|
bool requiredContentInstalled;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Continue = "continue";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Quit = "quit";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ModContentPromptLogic(Widget widget, Manifest mod, ModContent content, Action continueLoading)
|
public ModContentPromptLogic(ModData modData, Widget widget, Manifest mod, ModContent content, Action continueLoading)
|
||||||
{
|
{
|
||||||
this.content = content;
|
this.content = content;
|
||||||
CheckRequiredContentInstalled();
|
CheckRequiredContentInstalled();
|
||||||
|
|
||||||
|
var continueMessage = modData.Translation.GetString(Continue);
|
||||||
|
var quitMessage = modData.Translation.GetString(Quit);
|
||||||
|
|
||||||
var panel = widget.Get("CONTENT_PROMPT_PANEL");
|
var panel = widget.Get("CONTENT_PROMPT_PANEL");
|
||||||
var headerTemplate = panel.Get<LabelWidget>("HEADER_TEMPLATE");
|
var headerTemplate = panel.Get<LabelWidget>("HEADER_TEMPLATE");
|
||||||
var headerLines = !string.IsNullOrEmpty(content.InstallPromptMessage) ? content.InstallPromptMessage.Replace("\\n", "\n").Split('\n') : Array.Empty<string>();
|
var headerLines = !string.IsNullOrEmpty(content.InstallPromptMessage) ? content.InstallPromptMessage.Replace("\\n", "\n").Split('\n') : Array.Empty<string>();
|
||||||
@@ -83,7 +92,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
};
|
};
|
||||||
|
|
||||||
var quitButton = panel.Get<ButtonWidget>("QUIT_BUTTON");
|
var quitButton = panel.Get<ButtonWidget>("QUIT_BUTTON");
|
||||||
quitButton.GetText = () => requiredContentInstalled ? "Continue" : "Quit";
|
quitButton.GetText = () => requiredContentInstalled ? continueMessage : quitMessage;
|
||||||
quitButton.Bounds.Y += headerHeight;
|
quitButton.Bounds.Y += headerHeight;
|
||||||
quitButton.OnClick = () =>
|
quitButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return Game.Settings.Game.IntroductionPromptVersion < IntroductionVersion;
|
return Game.Settings.Game.IntroductionPromptVersion < IntroductionVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Classic = "classic";
|
||||||
|
readonly string classic;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Modern = "modern";
|
||||||
|
readonly string modern;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public IntroductionPromptLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, Action onComplete)
|
public IntroductionPromptLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, Action onComplete)
|
||||||
{
|
{
|
||||||
@@ -33,6 +41,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var ds = Game.Settings.Graphics;
|
var ds = Game.Settings.Graphics;
|
||||||
var gs = Game.Settings.Game;
|
var gs = Game.Settings.Game;
|
||||||
|
|
||||||
|
classic = modData.Translation.GetString(Classic);
|
||||||
|
modern = modData.Translation.GetString(Modern);
|
||||||
|
|
||||||
var escPressed = false;
|
var escPressed = false;
|
||||||
var nameTextfield = widget.Get<TextFieldWidget>("PLAYERNAME");
|
var nameTextfield = widget.Get<TextFieldWidget>("PLAYERNAME");
|
||||||
nameTextfield.IsDisabled = () => worldRenderer.World.Type != WorldType.Shellmap;
|
nameTextfield.IsDisabled = () => worldRenderer.World.Type != WorldType.Shellmap;
|
||||||
@@ -74,8 +85,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
mouseControlDescModern.IsVisible = () => !gs.UseClassicMouseStyle;
|
mouseControlDescModern.IsVisible = () => !gs.UseClassicMouseStyle;
|
||||||
|
|
||||||
var mouseControlDropdown = widget.Get<DropDownButtonWidget>("MOUSE_CONTROL_DROPDOWN");
|
var mouseControlDropdown = widget.Get<DropDownButtonWidget>("MOUSE_CONTROL_DROPDOWN");
|
||||||
mouseControlDropdown.OnMouseDown = _ => InputSettingsLogic.ShowMouseControlDropdown(mouseControlDropdown, gs);
|
mouseControlDropdown.OnMouseDown = _ => InputSettingsLogic.ShowMouseControlDropdown(modData, mouseControlDropdown, gs);
|
||||||
mouseControlDropdown.GetText = () => gs.UseClassicMouseStyle ? "Classic" : "Modern";
|
mouseControlDropdown.GetText = () => gs.UseClassicMouseStyle ? classic : modern;
|
||||||
|
|
||||||
foreach (var container in new[] { mouseControlDescClassic, mouseControlDescModern })
|
foreach (var container in new[] { mouseControlDescClassic, mouseControlDescModern })
|
||||||
{
|
{
|
||||||
@@ -113,8 +124,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var viewportSizes = modData.Manifest.Get<WorldViewportSizes>();
|
var viewportSizes = modData.Manifest.Get<WorldViewportSizes>();
|
||||||
var battlefieldCameraDropDown = widget.Get<DropDownButtonWidget>("BATTLEFIELD_CAMERA_DROPDOWN");
|
var battlefieldCameraDropDown = widget.Get<DropDownButtonWidget>("BATTLEFIELD_CAMERA_DROPDOWN");
|
||||||
var battlefieldCameraLabel = new CachedTransform<WorldViewport, string>(vs => DisplaySettingsLogic.ViewportSizeNames[vs]);
|
var battlefieldCameraLabel = new CachedTransform<WorldViewport, string>(vs => DisplaySettingsLogic.GetViewportSizeName(modData, vs));
|
||||||
battlefieldCameraDropDown.OnMouseDown = _ => DisplaySettingsLogic.ShowBattlefieldCameraDropdown(battlefieldCameraDropDown, viewportSizes, ds);
|
battlefieldCameraDropDown.OnMouseDown = _ => DisplaySettingsLogic.ShowBattlefieldCameraDropdown(modData, battlefieldCameraDropDown, viewportSizes, ds);
|
||||||
battlefieldCameraDropDown.GetText = () => battlefieldCameraLabel.Update(ds.ViewportDistance);
|
battlefieldCameraDropDown.GetText = () => battlefieldCameraLabel.Update(ds.ViewportDistance);
|
||||||
|
|
||||||
var uiScaleDropdown = widget.Get<DropDownButtonWidget>("UI_SCALE_DROPDOWN");
|
var uiScaleDropdown = widget.Get<DropDownButtonWidget>("UI_SCALE_DROPDOWN");
|
||||||
|
|||||||
@@ -16,10 +16,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
class KickClientLogic : ChromeLogic
|
class KickClientLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference("player")]
|
||||||
|
static readonly string KickClient = "kick-client";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public KickClientLogic(Widget widget, string clientName, Action<bool> okPressed, Action cancelPressed)
|
public KickClientLogic(ModData modData, Widget widget, string clientName, Action<bool> okPressed, Action cancelPressed)
|
||||||
{
|
{
|
||||||
widget.Get<LabelWidget>("TITLE").GetText = () => $"Kick {clientName}?";
|
var kickMessage = modData.Translation.GetString(KickClient, Translation.Arguments("player", clientName));
|
||||||
|
widget.Get<LabelWidget>("TITLE").GetText = () => kickMessage;
|
||||||
|
|
||||||
var tempBan = false;
|
var tempBan = false;
|
||||||
var preventRejoiningCheckbox = widget.Get<CheckboxWidget>("PREVENT_REJOINING_CHECKBOX");
|
var preventRejoiningCheckbox = widget.Get<CheckboxWidget>("PREVENT_REJOINING_CHECKBOX");
|
||||||
|
|||||||
@@ -16,10 +16,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
class KickSpectatorsLogic : ChromeLogic
|
class KickSpectatorsLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference("count")]
|
||||||
|
static readonly string KickSpectators = "kick-spectators";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public KickSpectatorsLogic(Widget widget, int clientCount, Action okPressed, Action cancelPressed)
|
public KickSpectatorsLogic(ModData modData, Widget widget, int clientCount, Action okPressed, Action cancelPressed)
|
||||||
{
|
{
|
||||||
widget.Get<LabelWidget>("TEXT").GetText = () => $"Are you sure you want to kick {clientCount} spectators?";
|
var kickMessage = modData.Translation.GetString(KickSpectators, Translation.Arguments("count", clientCount));
|
||||||
|
widget.Get<LabelWidget>("TEXT").GetText = () => kickMessage;
|
||||||
|
|
||||||
widget.Get<ButtonWidget>("OK_BUTTON").OnClick = () =>
|
widget.Get<ButtonWidget>("OK_BUTTON").OnClick = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly ScrollPanelWidget lobbyChatPanel;
|
readonly ScrollPanelWidget lobbyChatPanel;
|
||||||
readonly Dictionary<TextNotificationPool, Widget> chatTemplates = new Dictionary<TextNotificationPool, Widget>();
|
readonly Dictionary<TextNotificationPool, Widget> chatTemplates = new Dictionary<TextNotificationPool, Widget>();
|
||||||
readonly TextFieldWidget chatTextField;
|
readonly TextFieldWidget chatTextField;
|
||||||
readonly CachedTransform<int, string> chatDisabledLabel;
|
readonly CachedTransform<int, string> chatAvailableIn;
|
||||||
|
readonly string chatDisabled;
|
||||||
|
|
||||||
readonly ScrollPanelWidget players;
|
readonly ScrollPanelWidget players;
|
||||||
|
|
||||||
@@ -74,6 +75,42 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
bool MapIsPlayable => (mapStatus & Session.MapStatus.Playable) == Session.MapStatus.Playable;
|
bool MapIsPlayable => (mapStatus & Session.MapStatus.Playable) == Session.MapStatus.Playable;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Add = "add";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Remove = "remove";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ConfigureBots = "configure-bots";
|
||||||
|
|
||||||
|
[TranslationReference("count")]
|
||||||
|
static readonly string NumberTeams = "n-teams";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string HumanVsBots = "humans-vs-bots";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string FreeForAll = "free-for-all";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ConfigureTeams = "configure-teams";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Back = "back";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Team = "team";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string All = "all";
|
||||||
|
|
||||||
|
[TranslationReference("seconds")]
|
||||||
|
static readonly string ChatAvailability = "chat-availability";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ChatDisabled = "chat-disabled";
|
||||||
|
|
||||||
// Listen for connection failures
|
// Listen for connection failures
|
||||||
void ConnectionStateChanged(OrderManager om, string password, NetworkConnection connection)
|
void ConnectionStateChanged(OrderManager om, string password, NetworkConnection connection)
|
||||||
{
|
{
|
||||||
@@ -226,7 +263,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
new DropDownOption()
|
new DropDownOption()
|
||||||
{
|
{
|
||||||
Title = "Add",
|
Title = modData.Translation.GetString(Add),
|
||||||
IsSelected = () => false,
|
IsSelected = () => false,
|
||||||
OnClick = () =>
|
OnClick = () =>
|
||||||
{
|
{
|
||||||
@@ -245,7 +282,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
botOptions.Add(new DropDownOption()
|
botOptions.Add(new DropDownOption()
|
||||||
{
|
{
|
||||||
Title = "Remove",
|
Title = modData.Translation.GetString(Remove),
|
||||||
IsSelected = () => false,
|
IsSelected = () => false,
|
||||||
OnClick = () =>
|
OnClick = () =>
|
||||||
{
|
{
|
||||||
@@ -259,7 +296,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
options.Add("Configure Bots", botOptions);
|
options.Add(modData.Translation.GetString(ConfigureBots), botOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
var teamCount = (orderManager.LobbyInfo.Slots.Count(s => !s.Value.LockTeam && orderManager.LobbyInfo.ClientInSlot(s.Key) != null) + 1) / 2;
|
var teamCount = (orderManager.LobbyInfo.Slots.Count(s => !s.Value.LockTeam && orderManager.LobbyInfo.ClientInSlot(s.Key) != null) + 1) / 2;
|
||||||
@@ -267,7 +304,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var teamOptions = Enumerable.Range(2, teamCount - 1).Reverse().Select(d => new DropDownOption
|
var teamOptions = Enumerable.Range(2, teamCount - 1).Reverse().Select(d => new DropDownOption
|
||||||
{
|
{
|
||||||
Title = $"{d} Teams",
|
Title = modData.Translation.GetString(NumberTeams, Translation.Arguments("count", d)),
|
||||||
IsSelected = () => false,
|
IsSelected = () => false,
|
||||||
OnClick = () => orderManager.IssueOrder(Order.Command($"assignteams {d}"))
|
OnClick = () => orderManager.IssueOrder(Order.Command($"assignteams {d}"))
|
||||||
}).ToList();
|
}).ToList();
|
||||||
@@ -276,7 +313,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
teamOptions.Add(new DropDownOption
|
teamOptions.Add(new DropDownOption
|
||||||
{
|
{
|
||||||
Title = "Humans vs Bots",
|
Title = modData.Translation.GetString(HumanVsBots),
|
||||||
IsSelected = () => false,
|
IsSelected = () => false,
|
||||||
OnClick = () => orderManager.IssueOrder(Order.Command("assignteams 1"))
|
OnClick = () => orderManager.IssueOrder(Order.Command("assignteams 1"))
|
||||||
});
|
});
|
||||||
@@ -284,12 +321,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
teamOptions.Add(new DropDownOption
|
teamOptions.Add(new DropDownOption
|
||||||
{
|
{
|
||||||
Title = "Free for all",
|
Title = modData.Translation.GetString(FreeForAll),
|
||||||
IsSelected = () => false,
|
IsSelected = () => false,
|
||||||
OnClick = () => orderManager.IssueOrder(Order.Command("assignteams 0"))
|
OnClick = () => orderManager.IssueOrder(Order.Command("assignteams 0"))
|
||||||
});
|
});
|
||||||
|
|
||||||
options.Add("Configure Teams", teamOptions);
|
options.Add(modData.Translation.GetString(ConfigureTeams), teamOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
Func<DropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
|
Func<DropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
|
||||||
@@ -407,7 +444,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
disconnectButton.OnClick = () => { Ui.CloseWindow(); onExit(); };
|
disconnectButton.OnClick = () => { Ui.CloseWindow(); onExit(); };
|
||||||
|
|
||||||
if (skirmishMode)
|
if (skirmishMode)
|
||||||
disconnectButton.Text = "Back";
|
disconnectButton.Text = modData.Translation.GetString(Back);
|
||||||
|
|
||||||
if (logicArgs.TryGetValue("ChatTemplates", out var templateIds))
|
if (logicArgs.TryGetValue("ChatTemplates", out var templateIds))
|
||||||
{
|
{
|
||||||
@@ -419,7 +456,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
var chatMode = lobby.Get<ButtonWidget>("CHAT_MODE");
|
var chatMode = lobby.Get<ButtonWidget>("CHAT_MODE");
|
||||||
chatMode.GetText = () => teamChat ? "Team" : "All";
|
var team = modData.Translation.GetString(Team);
|
||||||
|
var all = modData.Translation.GetString(All);
|
||||||
|
chatMode.GetText = () => teamChat ? team : all;
|
||||||
chatMode.OnClick = () => teamChat ^= true;
|
chatMode.OnClick = () => teamChat ^= true;
|
||||||
chatMode.IsDisabled = () => disableTeamChat || !chatEnabled;
|
chatMode.IsDisabled = () => disableTeamChat || !chatEnabled;
|
||||||
|
|
||||||
@@ -459,7 +498,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
chatTextField.OnEscKey = _ => chatTextField.YieldKeyboardFocus();
|
chatTextField.OnEscKey = _ => chatTextField.YieldKeyboardFocus();
|
||||||
|
|
||||||
chatDisabledLabel = new CachedTransform<int, string>(x => x > 0 ? $"Chat available in {x} seconds..." : "Chat Disabled");
|
chatAvailableIn = new CachedTransform<int, string>(x => modData.Translation.GetString(ChatAvailability, Translation.Arguments("seconds", x)));
|
||||||
|
chatDisabled = modData.Translation.GetString(ChatDisabled);
|
||||||
|
|
||||||
lobbyChatPanel = lobby.Get<ScrollPanelWidget>("CHAT_DISPLAY");
|
lobbyChatPanel = lobby.Get<ScrollPanelWidget>("CHAT_DISPLAY");
|
||||||
lobbyChatPanel.RemoveChildren();
|
lobbyChatPanel.RemoveChildren();
|
||||||
@@ -524,7 +564,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (TextNotificationsManager.ChatDisabledUntil != uint.MaxValue)
|
if (TextNotificationsManager.ChatDisabledUntil != uint.MaxValue)
|
||||||
remaining = (int)(TextNotificationsManager.ChatDisabledUntil - Game.RunTime + 999) / 1000;
|
remaining = (int)(TextNotificationsManager.ChatDisabledUntil - Game.RunTime + 999) / 1000;
|
||||||
|
|
||||||
chatTextField.Text = chatDisabledLabel.Update(remaining);
|
chatTextField.Text = remaining == 0 ? chatDisabled : chatAvailableIn.Update(remaining);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -612,9 +652,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
template = emptySlotTemplate.Clone();
|
template = emptySlotTemplate.Clone();
|
||||||
|
|
||||||
if (isHost)
|
if (isHost)
|
||||||
LobbyUtils.SetupEditableSlotWidget(template, slot, client, orderManager, map);
|
LobbyUtils.SetupEditableSlotWidget(template, slot, client, orderManager, map, modData);
|
||||||
else
|
else
|
||||||
LobbyUtils.SetupSlotWidget(template, slot, client);
|
LobbyUtils.SetupSlotWidget(template, modData, slot, client);
|
||||||
|
|
||||||
var join = template.Get<ButtonWidget>("JOIN");
|
var join = template.Get<ButtonWidget>("JOIN");
|
||||||
join.IsVisible = () => !slot.Closed;
|
join.IsVisible = () => !slot.Closed;
|
||||||
@@ -631,7 +671,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
LobbyUtils.SetupLatencyWidget(template, client, orderManager);
|
LobbyUtils.SetupLatencyWidget(template, client, orderManager);
|
||||||
|
|
||||||
if (client.Bot != null)
|
if (client.Bot != null)
|
||||||
LobbyUtils.SetupEditableSlotWidget(template, slot, client, orderManager, map);
|
LobbyUtils.SetupEditableSlotWidget(template, slot, client, orderManager, map, modData);
|
||||||
else
|
else
|
||||||
LobbyUtils.SetupEditableNameWidget(template, client, orderManager, worldRenderer);
|
LobbyUtils.SetupEditableNameWidget(template, client, orderManager, worldRenderer);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class LobbyOptionsLogic : ChromeLogic
|
public class LobbyOptionsLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
readonly ModData modData;
|
||||||
readonly ScrollPanelWidget panel;
|
readonly ScrollPanelWidget panel;
|
||||||
readonly Widget optionsContainer;
|
readonly Widget optionsContainer;
|
||||||
readonly Widget checkboxRowTemplate;
|
readonly Widget checkboxRowTemplate;
|
||||||
@@ -31,9 +32,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly Func<bool> configurationDisabled;
|
readonly Func<bool> configurationDisabled;
|
||||||
MapPreview mapPreview;
|
MapPreview mapPreview;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NotAvailable = "not-available";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
internal LobbyOptionsLogic(Widget widget, OrderManager orderManager, Func<MapPreview> getMap, Func<bool> configurationDisabled)
|
internal LobbyOptionsLogic(ModData modData, Widget widget, OrderManager orderManager, Func<MapPreview> getMap, Func<bool> configurationDisabled)
|
||||||
{
|
{
|
||||||
|
this.modData = modData;
|
||||||
this.getMap = getMap;
|
this.getMap = getMap;
|
||||||
this.orderManager = orderManager;
|
this.orderManager = orderManager;
|
||||||
this.configurationDisabled = configurationDisabled;
|
this.configurationDisabled = configurationDisabled;
|
||||||
@@ -131,7 +136,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var getOptionLabel = new CachedTransform<string, string>(id =>
|
var getOptionLabel = new CachedTransform<string, string>(id =>
|
||||||
{
|
{
|
||||||
if (id == null || !option.Values.TryGetValue(id, out var value))
|
if (id == null || !option.Values.TryGetValue(id, out var value))
|
||||||
return "Not Available";
|
return modData.Translation.GetString(NotAvailable);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,6 +23,21 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public static class LobbyUtils
|
public static class LobbyUtils
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Open = "open";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Closed = "closed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Bots = "bots";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string BotsDisabled = "bots-disabled";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Slot = "slot";
|
||||||
|
|
||||||
class SlotDropDownOption
|
class SlotDropDownOption
|
||||||
{
|
{
|
||||||
public readonly string Title;
|
public readonly string Title;
|
||||||
@@ -38,15 +53,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot,
|
public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot,
|
||||||
Session.Client client, OrderManager orderManager, MapPreview map)
|
Session.Client client, OrderManager orderManager, MapPreview map, ModData modData)
|
||||||
{
|
{
|
||||||
|
var open = modData.Translation.GetString(Open);
|
||||||
|
var closed = modData.Translation.GetString(Closed);
|
||||||
var options = new Dictionary<string, IEnumerable<SlotDropDownOption>>
|
var options = new Dictionary<string, IEnumerable<SlotDropDownOption>>
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"Slot", new List<SlotDropDownOption>
|
modData.Translation.GetString(Slot), new List<SlotDropDownOption>
|
||||||
{
|
{
|
||||||
new SlotDropDownOption("Open", "slot_open " + slot.PlayerReference, () => !slot.Closed && client == null),
|
new SlotDropDownOption(open, "slot_open " + slot.PlayerReference, () => !slot.Closed && client == null),
|
||||||
new SlotDropDownOption("Closed", "slot_close " + slot.PlayerReference, () => slot.Closed)
|
new SlotDropDownOption(closed, "slot_close " + slot.PlayerReference, () => slot.Closed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -63,7 +80,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
options.Add(bots.Count > 0 ? "Bots" : "Bots Disabled", bots);
|
options.Add(bots.Count > 0 ? Bots : BotsDisabled, bots);
|
||||||
|
|
||||||
Func<SlotDropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<SlotDropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
{
|
{
|
||||||
@@ -436,7 +453,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void SetupEditableSlotWidget(Widget parent, Session.Slot s, Session.Client c,
|
public static void SetupEditableSlotWidget(Widget parent, Session.Slot s, Session.Client c,
|
||||||
OrderManager orderManager, MapPreview map)
|
OrderManager orderManager, MapPreview map, ModData modData)
|
||||||
{
|
{
|
||||||
var slot = parent.Get<DropDownButtonWidget>("SLOT_OPTIONS");
|
var slot = parent.Get<DropDownButtonWidget>("SLOT_OPTIONS");
|
||||||
slot.IsVisible = () => true;
|
slot.IsVisible = () => true;
|
||||||
@@ -446,18 +463,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
WidgetUtils.TruncateText(name, slot.Bounds.Width - slot.Bounds.Height - slot.LeftMargin - slot.RightMargin,
|
WidgetUtils.TruncateText(name, slot.Bounds.Width - slot.Bounds.Height - slot.LeftMargin - slot.RightMargin,
|
||||||
Game.Renderer.Fonts[slot.Font]));
|
Game.Renderer.Fonts[slot.Font]));
|
||||||
|
|
||||||
slot.GetText = () => truncated.Update(c != null ? c.Name : s.Closed ? "Closed" : "Open");
|
var closed = modData.Translation.GetString(Closed);
|
||||||
slot.OnMouseDown = _ => ShowSlotDropDown(slot, s, c, orderManager, map);
|
var open = modData.Translation.GetString(Open);
|
||||||
|
slot.GetText = () => truncated.Update(c != null ? c.Name : s.Closed ? closed : open);
|
||||||
|
slot.OnMouseDown = _ => ShowSlotDropDown(slot, s, c, orderManager, map, modData);
|
||||||
|
|
||||||
// Ensure Name selector (if present) is hidden
|
// Ensure Name selector (if present) is hidden
|
||||||
HideChildWidget(parent, "NAME");
|
HideChildWidget(parent, "NAME");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetupSlotWidget(Widget parent, Session.Slot s, Session.Client c)
|
public static void SetupSlotWidget(Widget parent, ModData modData, Session.Slot s, Session.Client c)
|
||||||
{
|
{
|
||||||
var name = parent.Get<LabelWidget>("NAME");
|
var name = parent.Get<LabelWidget>("NAME");
|
||||||
name.IsVisible = () => true;
|
name.IsVisible = () => true;
|
||||||
name.GetText = () => c != null ? c.Name : s.Closed ? "Closed" : "Open";
|
name.GetText = () => c != null ? c.Name : s.Closed
|
||||||
|
? modData.Translation.GetString(Closed)
|
||||||
|
: modData.Translation.GetString(Open);
|
||||||
|
|
||||||
// Ensure Slot selector (if present) is hidden
|
// Ensure Slot selector (if present) is hidden
|
||||||
HideChildWidget(parent, "SLOT_OPTIONS");
|
HideChildWidget(parent, "SLOT_OPTIONS");
|
||||||
|
|||||||
@@ -23,6 +23,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
bool installHighlighted;
|
bool installHighlighted;
|
||||||
int blinkTick;
|
int blinkTick;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Connecting = "connecting";
|
||||||
|
|
||||||
|
[TranslationReference("size")]
|
||||||
|
static readonly string Downloading = "downloading-map";
|
||||||
|
|
||||||
|
[TranslationReference("size", "progress")]
|
||||||
|
static readonly string DownloadingPercentage = "downloading-map-progress";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RetryInstall = "retry-install";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RetrySearch = "retry-search";
|
||||||
|
|
||||||
|
[TranslationReference("author")]
|
||||||
|
static readonly string CreatedBy = "created-by";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
internal MapPreviewLogic(Widget widget, ModData modData, OrderManager orderManager, Func<(MapPreview Map, Session.MapStatus Status)> getMap,
|
internal MapPreviewLogic(Widget widget, ModData modData, OrderManager orderManager, Func<(MapPreview Map, Session.MapStatus Status)> getMap,
|
||||||
Action<MapPreviewWidget, MapPreview, MouseInput> onMouseDown, Func<Dictionary<int, SpawnOccupant>> getSpawnOccupants,
|
Action<MapPreviewWidget, MapPreview, MouseInput> onMouseDown, Func<Dictionary<int, SpawnOccupant>> getSpawnOccupants,
|
||||||
@@ -40,7 +58,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return map.Status == MapStatus.Available && isPlayable;
|
return map.Status == MapStatus.Available && isPlayable;
|
||||||
};
|
};
|
||||||
|
|
||||||
SetupWidgets(available, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
SetupWidgets(available, modData, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
var invalid = widget.GetOrNull("MAP_INVALID");
|
var invalid = widget.GetOrNull("MAP_INVALID");
|
||||||
@@ -52,7 +70,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return map.Status == MapStatus.Available && (serverStatus & Session.MapStatus.Incompatible) != 0;
|
return map.Status == MapStatus.Available && (serverStatus & Session.MapStatus.Incompatible) != 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
SetupWidgets(invalid, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
SetupWidgets(invalid, modData, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
var validating = widget.GetOrNull("MAP_VALIDATING");
|
var validating = widget.GetOrNull("MAP_VALIDATING");
|
||||||
@@ -64,7 +82,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return map.Status == MapStatus.Available && (serverStatus & Session.MapStatus.Validating) != 0;
|
return map.Status == MapStatus.Available && (serverStatus & Session.MapStatus.Validating) != 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
SetupWidgets(validating, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
SetupWidgets(validating, modData, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
var download = widget.GetOrNull("MAP_DOWNLOADABLE");
|
var download = widget.GetOrNull("MAP_DOWNLOADABLE");
|
||||||
@@ -72,7 +90,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
download.IsVisible = () => getMap().Map.Status == MapStatus.DownloadAvailable;
|
download.IsVisible = () => getMap().Map.Status == MapStatus.DownloadAvailable;
|
||||||
|
|
||||||
SetupWidgets(download, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
SetupWidgets(download, modData, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
||||||
|
|
||||||
var install = download.GetOrNull<ButtonWidget>("MAP_INSTALL");
|
var install = download.GetOrNull<ButtonWidget>("MAP_INSTALL");
|
||||||
if (install != null)
|
if (install != null)
|
||||||
@@ -99,7 +117,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return map.Status != MapStatus.Available && map.Status != MapStatus.DownloadAvailable;
|
return map.Status != MapStatus.Available && map.Status != MapStatus.DownloadAvailable;
|
||||||
};
|
};
|
||||||
|
|
||||||
SetupWidgets(progress, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
SetupWidgets(progress, modData, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints);
|
||||||
|
|
||||||
var statusSearching = progress.GetOrNull("MAP_STATUS_SEARCHING");
|
var statusSearching = progress.GetOrNull("MAP_STATUS_SEARCHING");
|
||||||
if (statusSearching != null)
|
if (statusSearching != null)
|
||||||
@@ -134,13 +152,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var (map, _) = getMap();
|
var (map, _) = getMap();
|
||||||
if (map.DownloadBytes == 0)
|
if (map.DownloadBytes == 0)
|
||||||
return "Connecting...";
|
return modData.Translation.GetString(Connecting);
|
||||||
|
|
||||||
// Server does not provide the total file length
|
// Server does not provide the total file length
|
||||||
if (map.DownloadPercentage == 0)
|
if (map.DownloadPercentage == 0)
|
||||||
return $"Downloading {map.DownloadBytes / 1024} kB";
|
modData.Translation.GetString(Downloading, Translation.Arguments("size", map.DownloadBytes / 1024));
|
||||||
|
|
||||||
return $"Downloading {map.DownloadBytes / 1024} kB ({map.DownloadPercentage}%)";
|
return modData.Translation.GetString(DownloadingPercentage, Translation.Arguments("size", map.DownloadBytes / 1024, "progress", map.DownloadPercentage));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +186,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
modData.MapCache.QueryRemoteMapDetails(mapRepository, new[] { map.Uid });
|
modData.MapCache.QueryRemoteMapDetails(mapRepository, new[] { map.Uid });
|
||||||
};
|
};
|
||||||
|
|
||||||
retry.GetText = () => getMap().Map.Status == MapStatus.DownloadError ? "Retry Install" : "Retry Search";
|
retry.GetText = () => getMap().Map.Status == MapStatus.DownloadError
|
||||||
|
? modData.Translation.GetString(RetryInstall)
|
||||||
|
: modData.Translation.GetString(RetrySearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
var progressbar = progress.GetOrNull<ProgressBarWidget>("MAP_PROGRESSBAR");
|
var progressbar = progress.GetOrNull<ProgressBarWidget>("MAP_PROGRESSBAR");
|
||||||
@@ -190,7 +210,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupWidgets(Widget parent,
|
static void SetupWidgets(Widget parent, ModData modData,
|
||||||
Func<(MapPreview Map, Session.MapStatus Status)> getMap,
|
Func<(MapPreview Map, Session.MapStatus Status)> getMap,
|
||||||
Action<MapPreviewWidget, MapPreview, MouseInput> onMouseDown,
|
Action<MapPreviewWidget, MapPreview, MouseInput> onMouseDown,
|
||||||
Func<Dictionary<int, SpawnOccupant>> getSpawnOccupants,
|
Func<Dictionary<int, SpawnOccupant>> getSpawnOccupants,
|
||||||
@@ -235,7 +255,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var font = Game.Renderer.Fonts[authorLabel.Font];
|
var font = Game.Renderer.Fonts[authorLabel.Font];
|
||||||
var author = new CachedTransform<MapPreview, string>(
|
var author = new CachedTransform<MapPreview, string>(
|
||||||
m => WidgetUtils.TruncateText($"Created by {m.Author}", authorLabel.Bounds.Width, font));
|
m => WidgetUtils.TruncateText(modData.Translation.GetString(CreatedBy, Translation.Arguments("author", m.Author)), authorLabel.Bounds.Width, font));
|
||||||
authorLabel.GetText = () => author.Update(getMap().Map);
|
authorLabel.GetText = () => author.Update(getMap().Map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class SpawnSelectorTooltipLogic : ChromeLogic
|
public class SpawnSelectorTooltipLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DisabledSpawn = "disabled-spawn";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string AvailableSpawn = "available-spawn";
|
||||||
|
|
||||||
|
[TranslationReference("team")]
|
||||||
|
static readonly string TeamNumber = "team-number";
|
||||||
|
|
||||||
|
readonly CachedTransform<int, string> teamMessage;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public SpawnSelectorTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, MapPreviewWidget preview, bool showUnoccupiedSpawnpoints)
|
public SpawnSelectorTooltipLogic(Widget widget, ModData modData, TooltipContainerWidget tooltipContainer, MapPreviewWidget preview, bool showUnoccupiedSpawnpoints)
|
||||||
{
|
{
|
||||||
var showTooltip = true;
|
var showTooltip = true;
|
||||||
widget.IsVisible = () => preview.TooltipSpawnIndex != -1 && showTooltip;
|
widget.IsVisible = () => preview.TooltipSpawnIndex != -1 && showTooltip;
|
||||||
@@ -36,6 +47,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var labelText = "";
|
var labelText = "";
|
||||||
string playerFaction = null;
|
string playerFaction = null;
|
||||||
var playerTeam = -1;
|
var playerTeam = -1;
|
||||||
|
teamMessage = new CachedTransform<int, string>(t => modData.Translation.GetString(TeamNumber, Translation.Arguments("team", t)));
|
||||||
|
var disabledSpawn = modData.Translation.GetString(DisabledSpawn);
|
||||||
|
var availableSpawn = modData.Translation.GetString(AvailableSpawn);
|
||||||
|
|
||||||
tooltipContainer.BeforeRender = () =>
|
tooltipContainer.BeforeRender = () =>
|
||||||
{
|
{
|
||||||
@@ -58,7 +72,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
labelText = preview.DisabledSpawnPoints().Contains(preview.TooltipSpawnIndex) ? "Disabled spawn" : "Available spawn";
|
labelText = preview.DisabledSpawnPoints().Contains(preview.TooltipSpawnIndex)
|
||||||
|
? disabledSpawn
|
||||||
|
: availableSpawn;
|
||||||
|
|
||||||
playerFaction = null;
|
playerFaction = null;
|
||||||
playerTeam = 0;
|
playerTeam = 0;
|
||||||
widget.Bounds.Height = singleHeight;
|
widget.Bounds.Height = singleHeight;
|
||||||
@@ -75,7 +92,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
flag.IsVisible = () => playerFaction != null;
|
flag.IsVisible = () => playerFaction != null;
|
||||||
flag.GetImageCollection = () => "flags";
|
flag.GetImageCollection = () => "flags";
|
||||||
flag.GetImageName = () => playerFaction;
|
flag.GetImageName = () => playerFaction;
|
||||||
team.GetText = () => $"Team {playerTeam}";
|
team.GetText = () => teamMessage.Update(playerTeam);
|
||||||
team.IsVisible = () => playerTeam > 0;
|
team.IsVisible = () => playerTeam > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly ScrollPanelWidget newsPanel;
|
readonly ScrollPanelWidget newsPanel;
|
||||||
readonly Widget newsTemplate;
|
readonly Widget newsTemplate;
|
||||||
readonly LabelWidget newsStatus;
|
readonly LabelWidget newsStatus;
|
||||||
|
readonly ModData modData;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LoadingNews = "loading-news";
|
||||||
|
|
||||||
|
[TranslationReference("message")]
|
||||||
|
static readonly string NewsRetrivalFailed = "news-retrival-failed";
|
||||||
|
|
||||||
|
[TranslationReference("message")]
|
||||||
|
static readonly string NewsParsingFailed = "news-parsing-failed";
|
||||||
|
|
||||||
// Update news once per game launch
|
// Update news once per game launch
|
||||||
static bool fetchedNews;
|
static bool fetchedNews;
|
||||||
@@ -52,6 +62,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public MainMenuLogic(Widget widget, World world, ModData modData)
|
public MainMenuLogic(Widget widget, World world, ModData modData)
|
||||||
{
|
{
|
||||||
|
this.modData = modData;
|
||||||
|
|
||||||
rootMenu = widget;
|
rootMenu = widget;
|
||||||
rootMenu.Get<LabelWidget>("VERSION_LABEL").Text = modData.Manifest.Metadata.Version;
|
rootMenu.Get<LabelWidget>("VERSION_LABEL").Text = modData.Manifest.Metadata.Version;
|
||||||
|
|
||||||
@@ -205,7 +217,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
newsPanel.RemoveChild(newsTemplate);
|
newsPanel.RemoveChild(newsTemplate);
|
||||||
|
|
||||||
newsStatus = newsPanel.Get<LabelWidget>("NEWS_STATUS");
|
newsStatus = newsPanel.Get<LabelWidget>("NEWS_STATUS");
|
||||||
SetNewsStatus("Loading news");
|
SetNewsStatus(modData.Translation.GetString(LoadingNews));
|
||||||
}
|
}
|
||||||
|
|
||||||
Game.OnRemoteDirectConnect += OnRemoteDirectConnect;
|
Game.OnRemoteDirectConnect += OnRemoteDirectConnect;
|
||||||
@@ -318,7 +330,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
Game.RunAfterTick(() => // run on the main thread
|
Game.RunAfterTick(() => // run on the main thread
|
||||||
{
|
{
|
||||||
SetNewsStatus($"Failed to retrieve news: {e.Message}");
|
SetNewsStatus(modData.Translation.GetString(NewsRetrivalFailed, Translation.Arguments("message", e.Message)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -390,7 +402,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
SetNewsStatus($"Failed to parse news: {ex.Message}");
|
SetNewsStatus(modData.Translation.GetString(NewsParsingFailed, Translation.Arguments("message", ex.Message)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -18,6 +18,52 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class MapChooserLogic : ChromeLogic
|
public class MapChooserLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string AllMaps = "all-maps";
|
||||||
|
readonly string allMaps;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoMatches = "no-matches";
|
||||||
|
|
||||||
|
[TranslationReference("players")]
|
||||||
|
static readonly string Players = "player-players";
|
||||||
|
|
||||||
|
[TranslationReference("author")]
|
||||||
|
static readonly string CreatedBy = "created-by";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string MapSizeHuge = "map-size-huge";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string MapSizeLarge = "map-size-large";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string MapSizeMedium = "map-size-medium";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string MapSizeSmall = "map-size-small";
|
||||||
|
|
||||||
|
[TranslationReference("map")]
|
||||||
|
static readonly string MapDeletionFailed = "map-deletion-failed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteMapTitle = "delete-map-title";
|
||||||
|
|
||||||
|
[TranslationReference("title")]
|
||||||
|
static readonly string DeleteMapPrompt = "delete-map-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteMapAccept = "delete-map-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteAllMapsTitle = "delete-all-maps-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteAllMapsPrompt = "delete-all-maps-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteAllMapsAccept = "delete-all-maps-accept";
|
||||||
|
|
||||||
readonly Widget widget;
|
readonly Widget widget;
|
||||||
readonly DropDownButtonWidget gameModeDropdown;
|
readonly DropDownButtonWidget gameModeDropdown;
|
||||||
readonly ModData modData;
|
readonly ModData modData;
|
||||||
@@ -43,6 +89,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
this.modData = modData;
|
this.modData = modData;
|
||||||
this.onSelect = onSelect;
|
this.onSelect = onSelect;
|
||||||
|
|
||||||
|
allMaps = modData.Translation.GetString(AllMaps);
|
||||||
|
|
||||||
var approving = new Action(() =>
|
var approving = new Action(() =>
|
||||||
{
|
{
|
||||||
Ui.CloseWindow();
|
Ui.CloseWindow();
|
||||||
@@ -192,7 +240,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
// 'all game types' extra item
|
// 'all game types' extra item
|
||||||
categories.Insert(0, (null as string, tabMaps[tab].Length));
|
categories.Insert(0, (null as string, tabMaps[tab].Length));
|
||||||
|
|
||||||
Func<(string Category, int Count), string> showItem = x => $"{x.Category ?? "All Maps"} ({x.Count})";
|
Func<(string Category, int Count), string> showItem = x => (x.Category ?? allMaps) + $" ({x.Count})";
|
||||||
|
|
||||||
Func<(string Category, int Count), ScrollItemWidget, ScrollItemWidget> setupItem = (ii, template) =>
|
Func<(string Category, int Count), ScrollItemWidget, ScrollItemWidget> setupItem = (ii, template) =>
|
||||||
{
|
{
|
||||||
@@ -210,7 +258,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var item = categories.FirstOrDefault(m => m.Category == category);
|
var item = categories.FirstOrDefault(m => m.Category == category);
|
||||||
if (item == default((string, int)))
|
if (item == default((string, int)))
|
||||||
item.Category = "No matches";
|
item.Category = modData.Translation.GetString(NoMatches);
|
||||||
|
|
||||||
return showItem(item);
|
return showItem(item);
|
||||||
};
|
};
|
||||||
@@ -269,25 +317,23 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (type != null)
|
if (type != null)
|
||||||
details = type + " ";
|
details = type + " ";
|
||||||
|
|
||||||
details += $"({preview.PlayerCount} players)";
|
details += modData.Translation.GetString(Players, Translation.Arguments("players", preview.PlayerCount));
|
||||||
detailsWidget.GetText = () => details;
|
detailsWidget.GetText = () => details;
|
||||||
}
|
}
|
||||||
|
|
||||||
var authorWidget = item.GetOrNull<LabelWithTooltipWidget>("AUTHOR");
|
var authorWidget = item.GetOrNull<LabelWithTooltipWidget>("AUTHOR");
|
||||||
if (authorWidget != null)
|
if (authorWidget != null && !string.IsNullOrEmpty(preview.Author))
|
||||||
{
|
WidgetUtils.TruncateLabelToTooltip(authorWidget, modData.Translation.GetString(CreatedBy, Translation.Arguments("author", preview.Author)));
|
||||||
WidgetUtils.TruncateLabelToTooltip(authorWidget, $"Created by {preview.Author}");
|
|
||||||
}
|
|
||||||
|
|
||||||
var sizeWidget = item.GetOrNull<LabelWidget>("SIZE");
|
var sizeWidget = item.GetOrNull<LabelWidget>("SIZE");
|
||||||
if (sizeWidget != null)
|
if (sizeWidget != null)
|
||||||
{
|
{
|
||||||
var size = preview.Bounds.Width + "x" + preview.Bounds.Height;
|
var size = preview.Bounds.Width + "x" + preview.Bounds.Height;
|
||||||
var numberPlayableCells = preview.Bounds.Width * preview.Bounds.Height;
|
var numberPlayableCells = preview.Bounds.Width * preview.Bounds.Height;
|
||||||
if (numberPlayableCells >= 120 * 120) size += " (Huge)";
|
if (numberPlayableCells >= 120 * 120) size += " " + modData.Translation.GetString(MapSizeHuge);
|
||||||
else if (numberPlayableCells >= 90 * 90) size += " (Large)";
|
else if (numberPlayableCells >= 90 * 90) size += " " + modData.Translation.GetString(MapSizeLarge);
|
||||||
else if (numberPlayableCells >= 60 * 60) size += " (Medium)";
|
else if (numberPlayableCells >= 60 * 60) size += " " + modData.Translation.GetString(MapSizeMedium);
|
||||||
else size += " (Small)";
|
else size += " " + modData.Translation.GetString(MapSizeSmall);
|
||||||
sizeWidget.GetText = () => size;
|
sizeWidget.GetText = () => size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +361,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TextNotificationsManager.Debug("Failed to delete map '{0}'. See the debug.log file for details.", map);
|
TextNotificationsManager.Debug(modData.Translation.GetString(MapDeletionFailed, Translation.Arguments("map", map)));
|
||||||
Log.Write("debug", ex.ToString());
|
Log.Write("debug", ex.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,23 +370,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void DeleteOneMap(string map, Action<string> after)
|
void DeleteOneMap(string map, Action<string> after)
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Delete map",
|
title: DeleteMapTitle,
|
||||||
text: $"Delete the map '{modData.MapCache[map].Title}'?",
|
text: DeleteMapPrompt,
|
||||||
|
textArguments: Translation.Arguments("title", modData.MapCache[map].Title),
|
||||||
onConfirm: () =>
|
onConfirm: () =>
|
||||||
{
|
{
|
||||||
var newUid = DeleteMap(map);
|
var newUid = DeleteMap(map);
|
||||||
after?.Invoke(newUid);
|
after?.Invoke(newUid);
|
||||||
},
|
},
|
||||||
confirmText: "Delete",
|
confirmText: DeleteMapAccept,
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteAllMaps(string[] maps, Action<string> after)
|
void DeleteAllMaps(string[] maps, Action<string> after)
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Delete maps",
|
title: DeleteAllMapsTitle,
|
||||||
text: "Delete all maps on this page?",
|
text: DeleteAllMapsPrompt,
|
||||||
onConfirm: () =>
|
onConfirm: () =>
|
||||||
{
|
{
|
||||||
foreach (var map in maps)
|
foreach (var map in maps)
|
||||||
@@ -348,7 +395,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
after?.Invoke(Game.ModData.MapCache.ChooseInitialMap(null, Game.CosmeticRandom));
|
after?.Invoke(Game.ModData.MapCache.ChooseInitialMap(null, Game.CosmeticRandom));
|
||||||
},
|
},
|
||||||
confirmText: "Delete",
|
confirmText: DeleteAllMapsAccept,
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
enum PlayingVideo { None, Info, Briefing, GameStart }
|
enum PlayingVideo { None, Info, Briefing, GameStart }
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoVideoTitle = "no-video-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoVideoText = "no-video-text";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoVideoCancel = "no-video-cancel";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string CantPlayTitle = "cant-play-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string CantPlayPrompt = "cant-play-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string CantPlayCancel = "cant-play-cancel";
|
||||||
|
|
||||||
readonly ModData modData;
|
readonly ModData modData;
|
||||||
readonly Action onStart;
|
readonly Action onStart;
|
||||||
readonly ScrollPanelWidget descriptionPanel;
|
readonly ScrollPanelWidget descriptionPanel;
|
||||||
@@ -330,10 +348,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
if (!modData.DefaultFileSystem.Exists(video))
|
if (!modData.DefaultFileSystem.Exists(video))
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Video not installed",
|
title: NoVideoTitle,
|
||||||
text: "The game videos can be installed from the\n\"Manage Content\" menu in the mod chooser.",
|
text: NoVideoText,
|
||||||
cancelText: "Back",
|
cancelText: NoVideoCancel,
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -347,10 +365,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
StopVideo(player);
|
StopVideo(player);
|
||||||
|
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Unable to play video",
|
title: CantPlayTitle,
|
||||||
text: "Something went wrong during video playback.",
|
text: CantPlayPrompt,
|
||||||
cancelText: "Back",
|
cancelText: CantPlayCancel,
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class MusicPlayerLogic : ChromeLogic
|
public class MusicPlayerLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SoundMuted = "sound-muted";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoSongPlaying = "no-song-playing";
|
||||||
|
|
||||||
readonly ScrollPanelWidget musicList;
|
readonly ScrollPanelWidget musicList;
|
||||||
readonly ScrollItemWidget itemTemplate;
|
readonly ScrollItemWidget itemTemplate;
|
||||||
|
|
||||||
@@ -25,7 +31,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
MusicInfo currentSong = null;
|
MusicInfo currentSong = null;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public MusicPlayerLogic(Widget widget, World world, Action onExit)
|
public MusicPlayerLogic(Widget widget, World world, ModData modData, Action onExit)
|
||||||
{
|
{
|
||||||
var panel = widget;
|
var panel = widget;
|
||||||
|
|
||||||
@@ -43,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
panel.Get<LabelWidget>("MUTE_LABEL").GetText = () =>
|
panel.Get<LabelWidget>("MUTE_LABEL").GetText = () =>
|
||||||
{
|
{
|
||||||
if (Game.Settings.Sound.Mute)
|
if (Game.Settings.Sound.Mute)
|
||||||
return "Audio has been muted in settings.";
|
return modData.Translation.GetString(SoundMuted);
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
@@ -95,9 +101,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return $"{minutes:D2}:{seconds:D2} / {totalMinutes:D2}:{totalSeconds:D2}";
|
return $"{minutes:D2}:{seconds:D2} / {totalMinutes:D2}:{totalSeconds:D2}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var noSongPlaying = modData.Translation.GetString(NoSongPlaying);
|
||||||
var musicTitle = panel.GetOrNull<LabelWidget>("TITLE_LABEL");
|
var musicTitle = panel.GetOrNull<LabelWidget>("TITLE_LABEL");
|
||||||
if (musicTitle != null)
|
if (musicTitle != null)
|
||||||
musicTitle.GetText = () => currentSong != null ? currentSong.Title : "No song playing";
|
musicTitle.GetText = () => currentSong != null ? currentSong.Title : noSongPlaying;
|
||||||
|
|
||||||
var musicSlider = panel.Get<SliderWidget>("MUSIC_SLIDER");
|
var musicSlider = panel.Get<SliderWidget>("MUSIC_SLIDER");
|
||||||
musicSlider.OnChange += x => Game.Sound.MusicVolume = x;
|
musicSlider.OnChange += x => Game.Sound.MusicVolume = x;
|
||||||
|
|||||||
@@ -18,9 +18,20 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
[ChromeLogicArgsHotkeys("MuteAudioKey")]
|
[ChromeLogicArgsHotkeys("MuteAudioKey")]
|
||||||
public class MuteHotkeyLogic : SingleHotkeyBaseLogic
|
public class MuteHotkeyLogic : SingleHotkeyBaseLogic
|
||||||
{
|
{
|
||||||
|
readonly ModData modData;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string AudioMuted = "audio-muted";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string AudioUnmuted = "audio-unmuted";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public MuteHotkeyLogic(Widget widget, ModData modData, Dictionary<string, MiniYaml> logicArgs)
|
public MuteHotkeyLogic(Widget widget, ModData modData, Dictionary<string, MiniYaml> logicArgs)
|
||||||
: base(widget, modData, "MuteAudioKey", "GLOBAL_KEYHANDLER", logicArgs) { }
|
: base(widget, modData, "MuteAudioKey", "GLOBAL_KEYHANDLER", logicArgs)
|
||||||
|
{
|
||||||
|
this.modData = modData;
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnHotkeyActivated(KeyInput e)
|
protected override bool OnHotkeyActivated(KeyInput e)
|
||||||
{
|
{
|
||||||
@@ -29,12 +40,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (Game.Settings.Sound.Mute)
|
if (Game.Settings.Sound.Mute)
|
||||||
{
|
{
|
||||||
Game.Sound.MuteAudio();
|
Game.Sound.MuteAudio();
|
||||||
TextNotificationsManager.AddFeedbackLine("Audio muted.");
|
TextNotificationsManager.AddFeedbackLine(modData.Translation.GetString(AudioMuted));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Game.Sound.UnmuteAudio();
|
Game.Sound.UnmuteAudio();
|
||||||
TextNotificationsManager.AddFeedbackLine("Audio unmuted.");
|
TextNotificationsManager.AddFeedbackLine(modData.Translation.GetString(AudioUnmuted));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -131,6 +131,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
public class RegisteredProfileTooltipLogic : ChromeLogic
|
public class RegisteredProfileTooltipLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LoadingPlayerProfile = "loading-player-profile";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LoadingPlayerProfileFailed = "loading-player-profile-failed";
|
||||||
|
|
||||||
readonly PlayerDatabase playerDatabase;
|
readonly PlayerDatabase playerDatabase;
|
||||||
PlayerProfile profile;
|
PlayerProfile profile;
|
||||||
bool profileLoaded;
|
bool profileLoaded;
|
||||||
@@ -154,7 +160,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var profileWidth = 0;
|
var profileWidth = 0;
|
||||||
var maxProfileWidth = widget.Bounds.Width;
|
var maxProfileWidth = widget.Bounds.Width;
|
||||||
var messageText = "Loading player profile...";
|
var messageText = modData.Translation.GetString(LoadingPlayerProfile);
|
||||||
var messageWidth = messageFont.Measure(messageText).X + 2 * message.Bounds.Left;
|
var messageWidth = messageFont.Measure(messageText).X + 2 * message.Bounds.Left;
|
||||||
|
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
@@ -243,7 +249,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
messageText = "Failed to load player profile.";
|
messageText = modData.Translation.GetString(LoadingPlayerProfileFailed);
|
||||||
messageWidth = messageFont.Measure(messageText).X + 2 * message.Bounds.Left;
|
messageWidth = messageFont.Measure(messageText).X + 2 * message.Bounds.Left;
|
||||||
header.Bounds.Width = widget.Bounds.Width = messageWidth;
|
header.Bounds.Width = widget.Bounds.Width = messageWidth;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,78 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class ReplayBrowserLogic : ChromeLogic
|
public class ReplayBrowserLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference("time")]
|
||||||
|
static readonly string Duration = "duration";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Singleplayer = "singleplayer";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Multiplayer = "multiplayer";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Today = "today";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LastWeek = "last-week";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LastFortnight = "last-fortnight";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LastMonth = "last-month";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ReplayDurationVeryShort = "replay-duration-very-short";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ReplayDurationShort = "replay-duration-short";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ReplayDurationMedium = "replay-duration-medium";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ReplayDurationLong = "replay-duration-long";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RenameReplayTitle = "rename-replay-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RenameReplayPrompt = "rename-replay-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RenameReplayAccept = "rename-replay-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteReplayTitle = "delete-replay-title";
|
||||||
|
|
||||||
|
[TranslationReference("replay")]
|
||||||
|
static readonly string DeleteReplayPrompt = "delete-replay-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteReplayAccept = "delete-replay-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteAllReplaysTitle = "delete-all-replays-title";
|
||||||
|
|
||||||
|
[TranslationReference("count")]
|
||||||
|
static readonly string DeleteAllReplaysPrompt = "delete-all-replays-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string DeleteAllReplaysAccept = "delete-all-replays-accept";
|
||||||
|
|
||||||
|
[TranslationReference("file")]
|
||||||
|
static readonly string ReplayDeletionFailed = "replay-deletion-failed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Players = "players";
|
||||||
|
|
||||||
|
[TranslationReference("team")]
|
||||||
|
static readonly string TeamNumber = "team-number";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoTeam = "no-team";
|
||||||
|
|
||||||
static Filter filter = new Filter();
|
static Filter filter = new Filter();
|
||||||
|
|
||||||
readonly Widget panel;
|
readonly Widget panel;
|
||||||
@@ -101,7 +173,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
});
|
});
|
||||||
|
|
||||||
var replayDuration = new CachedTransform<ReplayMetadata, string>(r =>
|
var replayDuration = new CachedTransform<ReplayMetadata, string>(r =>
|
||||||
$"Duration: {WidgetUtils.FormatTimeSeconds((int)selectedReplay.GameInfo.Duration.TotalSeconds)}");
|
modData.Translation.GetString(Duration, Translation.Arguments("time", WidgetUtils.FormatTimeSeconds((int)selectedReplay.GameInfo.Duration.TotalSeconds))));
|
||||||
panel.Get<LabelWidget>("DURATION").GetText = () => replayDuration.Update(selectedReplay);
|
panel.Get<LabelWidget>("DURATION").GetText = () => replayDuration.Update(selectedReplay);
|
||||||
|
|
||||||
SetupFilters();
|
SetupFilters();
|
||||||
@@ -153,8 +225,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var options = new List<(GameType GameType, string Text)>
|
var options = new List<(GameType GameType, string Text)>
|
||||||
{
|
{
|
||||||
(GameType.Any, ddb.GetText()),
|
(GameType.Any, ddb.GetText()),
|
||||||
(GameType.Singleplayer, "Singleplayer"),
|
(GameType.Singleplayer, modData.Translation.GetString(Singleplayer)),
|
||||||
(GameType.Multiplayer, "Multiplayer")
|
(GameType.Multiplayer, modData.Translation.GetString(Multiplayer))
|
||||||
};
|
};
|
||||||
|
|
||||||
var lookup = options.ToDictionary(kvp => kvp.GameType, kvp => kvp.Text);
|
var lookup = options.ToDictionary(kvp => kvp.GameType, kvp => kvp.Text);
|
||||||
@@ -186,10 +258,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var options = new List<(DateType DateType, string Text)>
|
var options = new List<(DateType DateType, string Text)>
|
||||||
{
|
{
|
||||||
(DateType.Any, ddb.GetText()),
|
(DateType.Any, ddb.GetText()),
|
||||||
(DateType.Today, "Today"),
|
(DateType.Today, modData.Translation.GetString(Today)),
|
||||||
(DateType.LastWeek, "Last 7 days"),
|
(DateType.LastWeek, modData.Translation.GetString(LastWeek)),
|
||||||
(DateType.LastFortnight, "Last 14 days"),
|
(DateType.LastFortnight, modData.Translation.GetString(LastFortnight)),
|
||||||
(DateType.LastMonth, "Last 30 days")
|
(DateType.LastMonth, modData.Translation.GetString(LastMonth))
|
||||||
};
|
};
|
||||||
|
|
||||||
var lookup = options.ToDictionary(kvp => kvp.DateType, kvp => kvp.Text);
|
var lookup = options.ToDictionary(kvp => kvp.DateType, kvp => kvp.Text);
|
||||||
@@ -222,10 +294,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var options = new List<(DurationType DurationType, string Text)>
|
var options = new List<(DurationType DurationType, string Text)>
|
||||||
{
|
{
|
||||||
(DurationType.Any, ddb.GetText()),
|
(DurationType.Any, ddb.GetText()),
|
||||||
(DurationType.VeryShort, "Under 5 min"),
|
(DurationType.VeryShort, modData.Translation.GetString(ReplayDurationVeryShort)),
|
||||||
(DurationType.Short, "Short (10 min)"),
|
(DurationType.Short, modData.Translation.GetString(ReplayDurationShort)),
|
||||||
(DurationType.Medium, "Medium (30 min)"),
|
(DurationType.Medium, modData.Translation.GetString(ReplayDurationMedium)),
|
||||||
(DurationType.Long, "Long (60+ min)")
|
(DurationType.Long, modData.Translation.GetString(ReplayDurationLong))
|
||||||
};
|
};
|
||||||
|
|
||||||
var lookup = options.ToDictionary(kvp => kvp.DurationType, kvp => kvp.Text);
|
var lookup = options.ToDictionary(kvp => kvp.DurationType, kvp => kvp.Text);
|
||||||
@@ -393,13 +465,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var directoryName = Path.GetDirectoryName(r.FilePath);
|
var directoryName = Path.GetDirectoryName(r.FilePath);
|
||||||
var invalidChars = Path.GetInvalidFileNameChars();
|
var invalidChars = Path.GetInvalidFileNameChars();
|
||||||
|
|
||||||
ConfirmationDialogs.TextInputPrompt(
|
ConfirmationDialogs.TextInputPrompt(modData,
|
||||||
"Rename Replay",
|
RenameReplayTitle,
|
||||||
"Enter a new file name:",
|
RenameReplayPrompt,
|
||||||
initialName,
|
initialName,
|
||||||
onAccept: newName => RenameReplay(r, newName),
|
onAccept: newName => RenameReplay(r, newName),
|
||||||
onCancel: null,
|
onCancel: null,
|
||||||
acceptText: "Rename",
|
acceptText: RenameReplayAccept,
|
||||||
cancelText: null,
|
cancelText: null,
|
||||||
inputValidator: newName =>
|
inputValidator: newName =>
|
||||||
{
|
{
|
||||||
@@ -421,15 +493,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
Action<ReplayMetadata, Action> onDeleteReplay = (r, after) =>
|
Action<ReplayMetadata, Action> onDeleteReplay = (r, after) =>
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Delete selected replay?",
|
title: DeleteReplayTitle,
|
||||||
text: $"Delete replay '{Path.GetFileNameWithoutExtension(r.FilePath)}'?",
|
text: DeleteReplayPrompt,
|
||||||
|
textArguments: Translation.Arguments("replay", Path.GetFileNameWithoutExtension(r.FilePath)),
|
||||||
onConfirm: () =>
|
onConfirm: () =>
|
||||||
{
|
{
|
||||||
DeleteReplay(r);
|
DeleteReplay(r);
|
||||||
after?.Invoke();
|
after?.Invoke();
|
||||||
},
|
},
|
||||||
confirmText: "Delete",
|
confirmText: DeleteReplayAccept,
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -458,9 +531,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Delete all selected replays?",
|
title: DeleteAllReplaysTitle,
|
||||||
text: $"Delete {list.Count} replays?",
|
text: DeleteAllReplaysPrompt,
|
||||||
|
textArguments: Translation.Arguments("count", list.Count),
|
||||||
onConfirm: () =>
|
onConfirm: () =>
|
||||||
{
|
{
|
||||||
foreach (var replayMetadata in list)
|
foreach (var replayMetadata in list)
|
||||||
@@ -469,7 +543,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (selectedReplay == null)
|
if (selectedReplay == null)
|
||||||
SelectFirstVisibleReplay();
|
SelectFirstVisibleReplay();
|
||||||
},
|
},
|
||||||
confirmText: "Delete All",
|
confirmText: DeleteAllReplaysAccept,
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -500,7 +574,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TextNotificationsManager.Debug("Failed to delete replay file '{0}'. See the logs for details.", replay.FilePath);
|
TextNotificationsManager.Debug(modData.Translation.GetString(ReplayDeletionFailed, Translation.Arguments("file", replay.FilePath)));
|
||||||
Log.Write("debug", ex.ToString());
|
Log.Write("debug", ex.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -636,7 +710,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var noTeams = players.Count() == 1;
|
var noTeams = players.Count() == 1;
|
||||||
foreach (var p in players)
|
foreach (var p in players)
|
||||||
{
|
{
|
||||||
var label = noTeams ? "Players" : p.Key == 0 ? "No Team" : $"Team {p.Key}";
|
var label = noTeams ? modData.Translation.GetString(Players) : p.Key > 0
|
||||||
|
? modData.Translation.GetString(TeamNumber, Translation.Arguments("team", p.Key))
|
||||||
|
: modData.Translation.GetString(NoTeam);
|
||||||
|
|
||||||
teams.Add(label, p);
|
teams.Add(label, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,7 +762,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void WatchReplay()
|
void WatchReplay()
|
||||||
{
|
{
|
||||||
if (selectedReplay != null && ReplayUtils.PromptConfirmReplayCompatibility(selectedReplay))
|
if (selectedReplay != null && ReplayUtils.PromptConfirmReplayCompatibility(selectedReplay, modData))
|
||||||
{
|
{
|
||||||
cancelLoadingReplays = true;
|
cancelLoadingReplays = true;
|
||||||
|
|
||||||
|
|||||||
@@ -10,52 +10,72 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||||
{
|
{
|
||||||
public static class ReplayUtils
|
public static class ReplayUtils
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string IncompatibleReplayTitle = "incompatible-replay-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string IncompatibleReplayPrompt = "incompatible-replay-prompt";
|
||||||
|
|
||||||
|
[TranslationReference("version")]
|
||||||
|
static readonly string UnknownVersion = "incompatible-replay-unknown-version";
|
||||||
|
|
||||||
|
[TranslationReference("mod")]
|
||||||
|
static readonly string UnknownMod = "incompatible-replay-unknown-mod";
|
||||||
|
|
||||||
|
[TranslationReference("mod")]
|
||||||
|
static readonly string UnvailableMod = "incompatible-replay-unavailable-mod";
|
||||||
|
|
||||||
|
[TranslationReference("version")]
|
||||||
|
static readonly string IncompatibleVersion = "incompatible-replay-incompatible-version";
|
||||||
|
|
||||||
|
[TranslationReference("map")]
|
||||||
|
static readonly string UnvailableMap = "incompatible-replay-unavailable-map";
|
||||||
|
|
||||||
static readonly Action DoNothing = () => { };
|
static readonly Action DoNothing = () => { };
|
||||||
|
|
||||||
public static bool PromptConfirmReplayCompatibility(ReplayMetadata replayMeta, Action onCancel = null)
|
public static bool PromptConfirmReplayCompatibility(ReplayMetadata replayMeta, ModData modData, Action onCancel = null)
|
||||||
{
|
{
|
||||||
if (onCancel == null)
|
if (onCancel == null)
|
||||||
onCancel = DoNothing;
|
onCancel = DoNothing;
|
||||||
|
|
||||||
if (replayMeta == null)
|
if (replayMeta == null)
|
||||||
{
|
{
|
||||||
ConfirmationDialogs.ButtonPrompt("Incompatible Replay", "Replay metadata could not be read.", onCancel: onCancel);
|
ConfirmationDialogs.ButtonPrompt(modData, IncompatibleReplayTitle,
|
||||||
|
IncompatibleReplayPrompt, onCancel: onCancel);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var version = replayMeta.GameInfo.Version;
|
var version = replayMeta.GameInfo.Version;
|
||||||
if (version == null)
|
if (version == null)
|
||||||
return IncompatibleReplayDialog("unknown version", version, onCancel);
|
return IncompatibleReplayDialog(UnknownVersion, Translation.Arguments("version", version), modData, onCancel);
|
||||||
|
|
||||||
var mod = replayMeta.GameInfo.Mod;
|
var mod = replayMeta.GameInfo.Mod;
|
||||||
if (mod == null)
|
if (mod == null)
|
||||||
return IncompatibleReplayDialog("unknown mod", mod, onCancel);
|
return IncompatibleReplayDialog(UnknownMod, Translation.Arguments("mod", mod), modData, onCancel);
|
||||||
|
|
||||||
if (!Game.Mods.ContainsKey(mod))
|
if (!Game.Mods.ContainsKey(mod))
|
||||||
return IncompatibleReplayDialog("unavailable mod", mod, onCancel);
|
return IncompatibleReplayDialog(UnvailableMod, Translation.Arguments("mod", mod), modData, onCancel);
|
||||||
|
|
||||||
if (Game.Mods[mod].Metadata.Version != version)
|
if (Game.Mods[mod].Metadata.Version != version)
|
||||||
return IncompatibleReplayDialog("incompatible version", version, onCancel);
|
return IncompatibleReplayDialog(IncompatibleVersion, Translation.Arguments("version", version), modData, onCancel);
|
||||||
|
|
||||||
if (replayMeta.GameInfo.MapPreview.Status != MapStatus.Available)
|
if (replayMeta.GameInfo.MapPreview.Status != MapStatus.Available)
|
||||||
return IncompatibleReplayDialog("unavailable map", replayMeta.GameInfo.MapUid, onCancel);
|
return IncompatibleReplayDialog(UnvailableMap, Translation.Arguments("map", replayMeta.GameInfo.MapUid), modData, onCancel);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IncompatibleReplayDialog(string type, string name, Action onCancel)
|
static bool IncompatibleReplayDialog(string text, Dictionary<string, object> textArguments, ModData modData, Action onCancel)
|
||||||
{
|
{
|
||||||
var error = "It was recorded with an " + type;
|
ConfirmationDialogs.ButtonPrompt(modData, IncompatibleReplayTitle, text, textArguments: textArguments, onCancel: onCancel);
|
||||||
error += string.IsNullOrEmpty(name) ? "." : $":\n{name}";
|
|
||||||
|
|
||||||
ConfirmationDialogs.ButtonPrompt("Incompatible Replay", error, onCancel: onCancel);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,41 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class ServerCreationLogic : ChromeLogic
|
public class ServerCreationLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InternetServerNatA = "internet-server-nat-A";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InternetServerNatBenabled = "internet-server-nat-B-enabled";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InternetServerNatBnotSupported = "internet-server-nat-B-not-supported";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InternetServerNatBdisabled = "internet-server-nat-B-disabled";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InternetServerNatC = "internet-server-nat-C";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LocalServer = "local-server";
|
||||||
|
|
||||||
|
[TranslationReference("port")]
|
||||||
|
static readonly string ServerCreationFailedPrompt = "server-creation-failed-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ServerCreationFailedPortUsed = "server-creation-failed-port-used";
|
||||||
|
|
||||||
|
[TranslationReference("message", "code")]
|
||||||
|
static readonly string ServerCreationFailedError = "server-creation-failed-error";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ServerCreationFailedTitle = "server-creation-failed-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ServerCreationFailedCancel = "server-creation-failed-cancel";
|
||||||
|
|
||||||
readonly Widget panel;
|
readonly Widget panel;
|
||||||
|
readonly ModData modData;
|
||||||
readonly LabelWidget noticesLabelA, noticesLabelB, noticesLabelC;
|
readonly LabelWidget noticesLabelA, noticesLabelB, noticesLabelC;
|
||||||
readonly Action onCreate;
|
readonly Action onCreate;
|
||||||
readonly Action onExit;
|
readonly Action onExit;
|
||||||
@@ -30,6 +64,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
public ServerCreationLogic(Widget widget, ModData modData, Action onExit, Action openLobby)
|
public ServerCreationLogic(Widget widget, ModData modData, Action onExit, Action openLobby)
|
||||||
{
|
{
|
||||||
panel = widget;
|
panel = widget;
|
||||||
|
this.modData = modData;
|
||||||
onCreate = openLobby;
|
onCreate = openLobby;
|
||||||
this.onExit = onExit;
|
this.onExit = onExit;
|
||||||
|
|
||||||
@@ -154,12 +189,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
if (advertiseOnline)
|
if (advertiseOnline)
|
||||||
{
|
{
|
||||||
noticesLabelA.Text = "Internet Server (UPnP/NAT-PMP ";
|
noticesLabelA.Text = modData.Translation.GetString(InternetServerNatA) + " ";
|
||||||
var aWidth = Game.Renderer.Fonts[noticesLabelA.Font].Measure(noticesLabelA.Text).X;
|
var aWidth = Game.Renderer.Fonts[noticesLabelA.Font].Measure(noticesLabelA.Text).X;
|
||||||
noticesLabelA.Bounds.Width = aWidth;
|
noticesLabelA.Bounds.Width = aWidth;
|
||||||
|
|
||||||
noticesLabelB.Text = Nat.Status == NatStatus.Enabled ? "Enabled" :
|
noticesLabelB.Text = Nat.Status == NatStatus.Enabled ? modData.Translation.GetString(InternetServerNatBenabled) :
|
||||||
Nat.Status == NatStatus.NotSupported ? "Not Supported" : "Disabled";
|
Nat.Status == NatStatus.NotSupported ? modData.Translation.GetString(InternetServerNatBnotSupported)
|
||||||
|
: modData.Translation.GetString(InternetServerNatBdisabled);
|
||||||
|
|
||||||
noticesLabelB.TextColor = Nat.Status == NatStatus.Enabled ? ChromeMetrics.Get<Color>("NoticeSuccessColor") :
|
noticesLabelB.TextColor = Nat.Status == NatStatus.Enabled ? ChromeMetrics.Get<Color>("NoticeSuccessColor") :
|
||||||
Nat.Status == NatStatus.NotSupported ? ChromeMetrics.Get<Color>("NoticeErrorColor") :
|
Nat.Status == NatStatus.NotSupported ? ChromeMetrics.Get<Color>("NoticeErrorColor") :
|
||||||
@@ -170,13 +206,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
noticesLabelB.Bounds.Width = bWidth;
|
noticesLabelB.Bounds.Width = bWidth;
|
||||||
noticesLabelB.Visible = true;
|
noticesLabelB.Visible = true;
|
||||||
|
|
||||||
noticesLabelC.Text = "):";
|
noticesLabelC.Text = modData.Translation.GetString(InternetServerNatC);
|
||||||
noticesLabelC.Bounds.X = noticesLabelB.Bounds.Right;
|
noticesLabelC.Bounds.X = noticesLabelB.Bounds.Right;
|
||||||
noticesLabelC.Visible = true;
|
noticesLabelC.Visible = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
noticesLabelA.Text = "Local Server:";
|
noticesLabelA.Text = modData.Translation.GetString(LocalServer);
|
||||||
noticesLabelB.Visible = false;
|
noticesLabelB.Visible = false;
|
||||||
noticesLabelC.Visible = false;
|
noticesLabelC.Visible = false;
|
||||||
}
|
}
|
||||||
@@ -212,15 +248,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
catch (System.Net.Sockets.SocketException e)
|
catch (System.Net.Sockets.SocketException e)
|
||||||
{
|
{
|
||||||
var message = $"Could not listen on port {Game.Settings.Server.ListenPort}.";
|
var message = modData.Translation.GetString(ServerCreationFailedPrompt, Translation.Arguments("port", Game.Settings.Server.ListenPort));
|
||||||
|
|
||||||
// AddressAlreadyInUse (WSAEADDRINUSE)
|
// AddressAlreadyInUse (WSAEADDRINUSE)
|
||||||
if (e.ErrorCode == 10048)
|
if (e.ErrorCode == 10048)
|
||||||
message += "\nCheck if the port is already being used.";
|
message += "\n" + modData.Translation.GetString(ServerCreationFailedPortUsed);
|
||||||
else
|
else
|
||||||
message += $"\nError is: \"{e.Message}\" ({e.ErrorCode})";
|
message += $"\n" + modData.Translation.GetString(ServerCreationFailedError,
|
||||||
|
Translation.Arguments("message", e.Message, "code", e.ErrorCode));
|
||||||
|
|
||||||
ConfirmationDialogs.ButtonPrompt("Server Creation Failed", message, onCancel: () => { }, cancelText: "Back");
|
ConfirmationDialogs.ButtonPrompt(modData, ServerCreationFailedTitle, message,
|
||||||
|
onCancel: () => { }, cancelText: ServerCreationFailedCancel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,74 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class ServerListLogic : ChromeLogic
|
public class ServerListLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SearchStatusFailed = "search-status-failed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SearchStatusNoGames = "search-status-no-games";
|
||||||
|
|
||||||
|
[TranslationReference("players")]
|
||||||
|
static readonly string PlayersOnline = "players-online";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoServerSelected = "no-server-selected";
|
||||||
|
readonly string noServerSelected;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string MapStatusSearching = "map-status-searching";
|
||||||
|
readonly string mapStatusSearching;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string MapClassificationUnknown = "map-classification-unknown";
|
||||||
|
readonly string mapClassificationUnknown;
|
||||||
|
|
||||||
|
[TranslationReference("players")]
|
||||||
|
static readonly string PlayersLabel = "players-label";
|
||||||
|
|
||||||
|
[TranslationReference("bots")]
|
||||||
|
static readonly string BotsLabel = "bots-label";
|
||||||
|
|
||||||
|
[TranslationReference("spectators")]
|
||||||
|
static readonly string SpectatorsLabel = "spectators-label";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Players = "players";
|
||||||
|
|
||||||
|
[TranslationReference("team")]
|
||||||
|
static readonly string TeamNumber = "team-number";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoTeam = "no-team";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Spectators = "spectators";
|
||||||
|
|
||||||
|
[TranslationReference("players")]
|
||||||
|
static readonly string OtherPlayers = "n-other-players";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Playing = "playing";
|
||||||
|
readonly string playing;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Waiting = "waiting";
|
||||||
|
readonly string waiting;
|
||||||
|
|
||||||
|
[TranslationReference("minutes")]
|
||||||
|
static readonly string InProgress = "in-progress-for";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string PasswordProtected = "password-protected";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string WaitingForPlayers = "waiting-for-players";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ServerShuttingDown = "server-shutting-down";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string UnknownServerState = "unknown-server-state";
|
||||||
|
|
||||||
readonly Color incompatibleVersionColor;
|
readonly Color incompatibleVersionColor;
|
||||||
readonly Color incompatibleProtectedGameColor;
|
readonly Color incompatibleProtectedGameColor;
|
||||||
readonly Color protectedGameColor;
|
readonly Color protectedGameColor;
|
||||||
@@ -62,12 +130,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
bool activeQuery;
|
bool activeQuery;
|
||||||
IEnumerable<BeaconLocation> lanGameLocations;
|
IEnumerable<BeaconLocation> lanGameLocations;
|
||||||
|
|
||||||
|
readonly CachedTransform<int, string> players;
|
||||||
|
readonly CachedTransform<int, string> bots;
|
||||||
|
readonly CachedTransform<int, string> spectators;
|
||||||
|
|
||||||
|
readonly CachedTransform<double, string> minutes;
|
||||||
|
readonly string passwordProtected;
|
||||||
|
readonly string waitingForPlayers;
|
||||||
|
readonly string serverShuttingDown;
|
||||||
|
readonly string unknownServerState;
|
||||||
|
|
||||||
public string ProgressLabelText()
|
public string ProgressLabelText()
|
||||||
{
|
{
|
||||||
switch (searchStatus)
|
switch (searchStatus)
|
||||||
{
|
{
|
||||||
case SearchStatus.Failed: return "Failed to query server list.";
|
case SearchStatus.Failed: return modData.Translation.GetString(SearchStatusFailed);
|
||||||
case SearchStatus.NoGames: return "No games found. Try changing filters.";
|
case SearchStatus.NoGames: return modData.Translation.GetString(SearchStatusNoGames);
|
||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,6 +156,23 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
this.modData = modData;
|
this.modData = modData;
|
||||||
this.onJoin = onJoin;
|
this.onJoin = onJoin;
|
||||||
|
|
||||||
|
playing = modData.Translation.GetString(Playing);
|
||||||
|
waiting = modData.Translation.GetString(Waiting);
|
||||||
|
|
||||||
|
noServerSelected = modData.Translation.GetString(NoServerSelected);
|
||||||
|
mapStatusSearching = modData.Translation.GetString(MapStatusSearching);
|
||||||
|
mapClassificationUnknown = modData.Translation.GetString(MapClassificationUnknown);
|
||||||
|
|
||||||
|
players = new CachedTransform<int, string>(i => modData.Translation.GetString(PlayersLabel, Translation.Arguments("players", i)));
|
||||||
|
bots = new CachedTransform<int, string>(i => modData.Translation.GetString(BotsLabel, Translation.Arguments("bots", i)));
|
||||||
|
spectators = new CachedTransform<int, string>(i => modData.Translation.GetString(SpectatorsLabel, Translation.Arguments("spectators", i)));
|
||||||
|
|
||||||
|
minutes = new CachedTransform<double, string>(i => modData.Translation.GetString(InProgress, Translation.Arguments("minutes", i)));
|
||||||
|
passwordProtected = modData.Translation.GetString(PasswordProtected);
|
||||||
|
waitingForPlayers = modData.Translation.GetString(WaitingForPlayers);
|
||||||
|
serverShuttingDown = modData.Translation.GetString(ServerShuttingDown);
|
||||||
|
unknownServerState = modData.Translation.GetString(UnknownServerState);
|
||||||
|
|
||||||
services = modData.Manifest.Get<WebServices>();
|
services = modData.Manifest.Get<WebServices>();
|
||||||
|
|
||||||
incompatibleVersionColor = ChromeMetrics.Get<Color>("IncompatibleVersionColor");
|
incompatibleVersionColor = ChromeMetrics.Get<Color>("IncompatibleVersionColor");
|
||||||
@@ -222,7 +317,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var playersLabel = widget.GetOrNull<LabelWidget>("PLAYER_COUNT");
|
var playersLabel = widget.GetOrNull<LabelWidget>("PLAYER_COUNT");
|
||||||
if (playersLabel != null)
|
if (playersLabel != null)
|
||||||
{
|
{
|
||||||
var playersText = new CachedTransform<int, string>(c => c == 1 ? "1 Player Online" : c.ToString() + " Players Online");
|
var playersText = new CachedTransform<int, string>(p => modData.Translation.GetString(PlayersOnline, Translation.Arguments("players", p)));
|
||||||
playersLabel.IsVisible = () => playerCount != 0;
|
playersLabel.IsVisible = () => playerCount != 0;
|
||||||
playersLabel.GetText = () => playersText.Update(playerCount);
|
playersLabel.GetText = () => playersText.Update(playerCount);
|
||||||
}
|
}
|
||||||
@@ -250,13 +345,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
mapTitle.GetText = () =>
|
mapTitle.GetText = () =>
|
||||||
{
|
{
|
||||||
if (currentMap == null)
|
if (currentMap == null)
|
||||||
return "No Server Selected";
|
return noServerSelected;
|
||||||
|
|
||||||
if (currentMap.Status == MapStatus.Searching)
|
if (currentMap.Status == MapStatus.Searching)
|
||||||
return "Searching...";
|
return mapStatusSearching;
|
||||||
|
|
||||||
if (currentMap.Class == MapClassification.Unknown)
|
if (currentMap.Class == MapClassification.Unknown)
|
||||||
return "Unknown Map";
|
return mapClassificationUnknown;
|
||||||
|
|
||||||
return title.Update(currentMap);
|
return title.Update(currentMap);
|
||||||
};
|
};
|
||||||
@@ -288,11 +383,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
modVersion.GetText = () => version.Update(currentServer);
|
modVersion.GetText = () => version.Update(currentServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
var players = widget.GetOrNull<LabelWidget>("SELECTED_PLAYERS");
|
var selectedPlayers = widget.GetOrNull<LabelWidget>("SELECTED_PLAYERS");
|
||||||
if (players != null)
|
if (selectedPlayers != null)
|
||||||
{
|
{
|
||||||
players.IsVisible = () => currentServer != null && (clientContainer == null || currentServer.Clients.Length == 0);
|
selectedPlayers.IsVisible = () => currentServer != null && (clientContainer == null || currentServer.Clients.Length == 0);
|
||||||
players.GetText = () => PlayersLabel(currentServer);
|
selectedPlayers.GetText = () => PlayerLabel(currentServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
clientContainer = widget.GetOrNull("CLIENT_LIST_CONTAINER");
|
clientContainer = widget.GetOrNull("CLIENT_LIST_CONTAINER");
|
||||||
@@ -320,9 +415,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
RefreshServerList();
|
RefreshServerList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static string PlayersLabel(GameServer game)
|
string PlayerLabel(GameServer game)
|
||||||
{
|
{
|
||||||
return $"{(game.Players > 0 ? game.Players.ToString() : "No")} Player{(game.Players != 1 ? "s" : "")}{(game.Bots > 0 ? $", {game.Bots} Bot{(game.Bots != 1 ? "s" : "")}" : "")}{(game.Spectators > 0 ? $", {game.Spectators} Spectator{(game.Spectators != 1 ? "s" : "")}" : "")}";
|
return players.Update(game.Players)
|
||||||
|
+ bots.Update(game.Bots)
|
||||||
|
+ spectators.Update(game.Spectators);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshServerList()
|
public void RefreshServerList()
|
||||||
@@ -474,12 +571,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var noTeams = players.Count() == 1;
|
var noTeams = players.Count() == 1;
|
||||||
foreach (var p in players)
|
foreach (var p in players)
|
||||||
{
|
{
|
||||||
var label = noTeams ? "Players" : p.Key == 0 ? "No Team" : $"Team {p.Key}";
|
var label = noTeams ? modData.Translation.GetString(Players) : p.Key > 0
|
||||||
|
? modData.Translation.GetString(TeamNumber, Translation.Arguments("team", p.Key))
|
||||||
|
: modData.Translation.GetString(NoTeam);
|
||||||
teams.Add(label, p);
|
teams.Add(label, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.Clients.Any(c => c.IsSpectator))
|
if (server.Clients.Any(c => c.IsSpectator))
|
||||||
teams.Add("Spectators", server.Clients.Where(c => c.IsSpectator));
|
teams.Add(modData.Translation.GetString(Spectators), server.Clients.Where(c => c.IsSpectator));
|
||||||
|
|
||||||
var factionInfo = modData.DefaultRules.Actors[SystemActors.World].TraitInfos<FactionInfo>();
|
var factionInfo = modData.DefaultRules.Actors[SystemActors.World].TraitInfos<FactionInfo>();
|
||||||
foreach (var kv in teams)
|
foreach (var kv in teams)
|
||||||
@@ -655,7 +754,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (game.Clients.Length > 10)
|
if (game.Clients.Length > 10)
|
||||||
displayClients = displayClients
|
displayClients = displayClients
|
||||||
.Take(9)
|
.Take(9)
|
||||||
.Append($"+ {game.Clients.Length - 9} other players");
|
.Append(modData.Translation.GetString(OtherPlayers, Translation.Arguments("players", game.Clients.Length - 9)));
|
||||||
|
|
||||||
var tooltip = displayClients.JoinWith("\n");
|
var tooltip = displayClients.JoinWith("\n");
|
||||||
players.GetTooltipText = () => tooltip;
|
players.GetTooltipText = () => tooltip;
|
||||||
@@ -667,8 +766,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var state = item.GetOrNull<LabelWidget>("STATUS");
|
var state = item.GetOrNull<LabelWidget>("STATUS");
|
||||||
if (state != null)
|
if (state != null)
|
||||||
{
|
{
|
||||||
var label = game.State >= (int)ServerState.GameStarted ?
|
var label = game.State >= (int)ServerState.GameStarted ? playing : waiting;
|
||||||
"Playing" : "Waiting";
|
|
||||||
state.GetText = () => label;
|
state.GetText = () => label;
|
||||||
|
|
||||||
var color = GetStateColor(game, state, !canJoin);
|
var color = GetStateColor(game, state, !canJoin);
|
||||||
@@ -695,31 +793,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetStateLabel(GameServer game)
|
string GetStateLabel(GameServer game)
|
||||||
{
|
{
|
||||||
if (game == null)
|
if (game == null)
|
||||||
return "";
|
return string.Empty;
|
||||||
|
|
||||||
if (game.State == (int)ServerState.GameStarted)
|
if (game.State == (int)ServerState.GameStarted)
|
||||||
{
|
{
|
||||||
var label = "In progress";
|
var totalMinutes = Math.Ceiling(game.PlayTime / 60.0);
|
||||||
|
return minutes.Update(totalMinutes);
|
||||||
if (game.PlayTime > 0)
|
|
||||||
{
|
|
||||||
var totalMinutes = Math.Ceiling(game.PlayTime / 60.0);
|
|
||||||
label += $" for {totalMinutes} minute{(totalMinutes > 1 ? "s" : "")}";
|
|
||||||
}
|
|
||||||
|
|
||||||
return label;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.State == (int)ServerState.WaitingPlayers)
|
if (game.State == (int)ServerState.WaitingPlayers)
|
||||||
return game.Protected ? "Password protected" : "Waiting for players";
|
return game.Protected ? passwordProtected : waitingForPlayers;
|
||||||
|
|
||||||
if (game.State == (int)ServerState.ShuttingDown)
|
if (game.State == (int)ServerState.ShuttingDown)
|
||||||
return "Server shutting down";
|
return serverShuttingDown;
|
||||||
|
|
||||||
return "Unknown server state";
|
return unknownServerState;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color GetStateColor(GameServer game, LabelWidget label, bool darkened = false)
|
Color GetStateColor(GameServer game, LabelWidget label, bool darkened = false)
|
||||||
|
|||||||
@@ -22,6 +22,50 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class DisplaySettingsLogic : ChromeLogic
|
public class DisplaySettingsLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Close = "close";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Medium = "medium";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Far = "far";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Furthest = "furthest";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Windowed = "windowed";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string LegacyFullscreen = "legacy-fullscreen";
|
||||||
|
readonly string legacyFullscreen;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Fullscreen = "fullscreen";
|
||||||
|
readonly string fullscreen;
|
||||||
|
|
||||||
|
[TranslationReference("number")]
|
||||||
|
static readonly string Display = "display";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Standard = "standard";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ShowOnDamage = "show-on-damage";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string AlwaysShow = "always-show";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Automatic = "automatic";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Manual = "manual";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Disabled = "disabled";
|
||||||
|
|
||||||
static readonly int OriginalVideoDisplay;
|
static readonly int OriginalVideoDisplay;
|
||||||
static readonly WindowMode OriginalGraphicsMode;
|
static readonly WindowMode OriginalGraphicsMode;
|
||||||
static readonly int2 OriginalGraphicsWindowedSize;
|
static readonly int2 OriginalGraphicsWindowedSize;
|
||||||
@@ -32,6 +76,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly WorldRenderer worldRenderer;
|
readonly WorldRenderer worldRenderer;
|
||||||
readonly WorldViewportSizes viewportSizes;
|
readonly WorldViewportSizes viewportSizes;
|
||||||
|
|
||||||
|
readonly string showOnDamage;
|
||||||
|
readonly string alwaysShow;
|
||||||
|
|
||||||
|
readonly string automatic;
|
||||||
|
readonly string manual;
|
||||||
|
readonly string disabled;
|
||||||
|
|
||||||
static DisplaySettingsLogic()
|
static DisplaySettingsLogic()
|
||||||
{
|
{
|
||||||
var original = Game.Settings;
|
var original = Game.Settings;
|
||||||
@@ -49,16 +100,35 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
this.modData = modData;
|
this.modData = modData;
|
||||||
viewportSizes = modData.Manifest.Get<WorldViewportSizes>();
|
viewportSizes = modData.Manifest.Get<WorldViewportSizes>();
|
||||||
|
|
||||||
|
legacyFullscreen = modData.Translation.GetString(LegacyFullscreen);
|
||||||
|
fullscreen = modData.Translation.GetString(Fullscreen);
|
||||||
|
|
||||||
registerPanel(panelID, label, InitPanel, ResetPanel);
|
registerPanel(panelID, label, InitPanel, ResetPanel);
|
||||||
|
|
||||||
|
showOnDamage = modData.Translation.GetString(ShowOnDamage);
|
||||||
|
alwaysShow = modData.Translation.GetString(AlwaysShow);
|
||||||
|
|
||||||
|
automatic = modData.Translation.GetString(Automatic);
|
||||||
|
manual = modData.Translation.GetString(Manual);
|
||||||
|
disabled = modData.Translation.GetString(Disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly Dictionary<WorldViewport, string> ViewportSizeNames = new Dictionary<WorldViewport, string>()
|
public static string GetViewportSizeName(ModData modData, WorldViewport worldViewport)
|
||||||
{
|
{
|
||||||
{ WorldViewport.Close, "Close" },
|
switch (worldViewport)
|
||||||
{ WorldViewport.Medium, "Medium" },
|
{
|
||||||
{ WorldViewport.Far, "Far" },
|
case WorldViewport.Close:
|
||||||
{ WorldViewport.Native, "Furthest" }
|
return modData.Translation.GetString(Close);
|
||||||
};
|
case WorldViewport.Medium:
|
||||||
|
return modData.Translation.GetString(Medium);
|
||||||
|
case WorldViewport.Far:
|
||||||
|
return modData.Translation.GetString(Far);
|
||||||
|
case WorldViewport.Native:
|
||||||
|
return modData.Translation.GetString(Furthest);
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Func<bool> InitPanel(Widget panel)
|
Func<bool> InitPanel(Widget panel)
|
||||||
{
|
{
|
||||||
@@ -77,13 +147,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
SettingsUtils.BindCheckboxPref(panel, "HIDE_REPLAY_CHAT_CHECKBOX", gs, "HideReplayChat");
|
SettingsUtils.BindCheckboxPref(panel, "HIDE_REPLAY_CHAT_CHECKBOX", gs, "HideReplayChat");
|
||||||
|
|
||||||
var windowModeDropdown = panel.Get<DropDownButtonWidget>("MODE_DROPDOWN");
|
var windowModeDropdown = panel.Get<DropDownButtonWidget>("MODE_DROPDOWN");
|
||||||
windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, ds, scrollPanel);
|
windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(modData, windowModeDropdown, ds, scrollPanel);
|
||||||
windowModeDropdown.GetText = () => ds.Mode == WindowMode.Windowed ?
|
windowModeDropdown.GetText = () => ds.Mode == WindowMode.Windowed
|
||||||
"Windowed" : ds.Mode == WindowMode.Fullscreen ? "Fullscreen (Legacy)" : "Fullscreen";
|
? modData.Translation.GetString(Windowed)
|
||||||
|
: ds.Mode == WindowMode.Fullscreen ? legacyFullscreen : fullscreen;
|
||||||
|
|
||||||
var displaySelectionDropDown = panel.Get<DropDownButtonWidget>("DISPLAY_SELECTION_DROPDOWN");
|
var displaySelectionDropDown = panel.Get<DropDownButtonWidget>("DISPLAY_SELECTION_DROPDOWN");
|
||||||
displaySelectionDropDown.OnMouseDown = _ => ShowDisplaySelectionDropdown(displaySelectionDropDown, ds);
|
displaySelectionDropDown.OnMouseDown = _ => ShowDisplaySelectionDropdown(displaySelectionDropDown, ds);
|
||||||
var displaySelectionLabel = new CachedTransform<int, string>(i => $"Display {i + 1}");
|
var displaySelectionLabel = new CachedTransform<int, string>(i => modData.Translation.GetString(Display, Translation.Arguments("number", i + 1)));
|
||||||
displaySelectionDropDown.GetText = () => displaySelectionLabel.Update(ds.VideoDisplay);
|
displaySelectionDropDown.GetText = () => displaySelectionLabel.Update(ds.VideoDisplay);
|
||||||
displaySelectionDropDown.IsDisabled = () => Game.Renderer.DisplayCount < 2;
|
displaySelectionDropDown.IsDisabled = () => Game.Renderer.DisplayCount < 2;
|
||||||
|
|
||||||
@@ -95,18 +166,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
glProfileDropdown.IsDisabled = () => disableProfile;
|
glProfileDropdown.IsDisabled = () => disableProfile;
|
||||||
|
|
||||||
var statusBarsDropDown = panel.Get<DropDownButtonWidget>("STATUS_BAR_DROPDOWN");
|
var statusBarsDropDown = panel.Get<DropDownButtonWidget>("STATUS_BAR_DROPDOWN");
|
||||||
statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(statusBarsDropDown, gs);
|
statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(modData, statusBarsDropDown, gs);
|
||||||
statusBarsDropDown.GetText = () => gs.StatusBars == StatusBarsType.Standard ?
|
statusBarsDropDown.GetText = () => gs.StatusBars == StatusBarsType.Standard
|
||||||
"Standard" : gs.StatusBars == StatusBarsType.DamageShow ? "Show On Damage" : "Always Show";
|
? modData.Translation.GetString(Standard)
|
||||||
|
: gs.StatusBars == StatusBarsType.DamageShow
|
||||||
|
? showOnDamage
|
||||||
|
: alwaysShow;
|
||||||
|
|
||||||
var targetLinesDropDown = panel.Get<DropDownButtonWidget>("TARGET_LINES_DROPDOWN");
|
var targetLinesDropDown = panel.Get<DropDownButtonWidget>("TARGET_LINES_DROPDOWN");
|
||||||
targetLinesDropDown.OnMouseDown = _ => ShowTargetLinesDropdown(targetLinesDropDown, gs);
|
targetLinesDropDown.OnMouseDown = _ => ShowTargetLinesDropdown(modData, targetLinesDropDown, gs);
|
||||||
targetLinesDropDown.GetText = () => gs.TargetLines == TargetLinesType.Automatic ?
|
targetLinesDropDown.GetText = () => gs.TargetLines == TargetLinesType.Automatic
|
||||||
"Automatic" : gs.TargetLines == TargetLinesType.Manual ? "Manual" : "Disabled";
|
? automatic
|
||||||
|
: gs.TargetLines == TargetLinesType.Manual
|
||||||
|
? manual
|
||||||
|
: disabled;
|
||||||
|
|
||||||
var battlefieldCameraDropDown = panel.Get<DropDownButtonWidget>("BATTLEFIELD_CAMERA_DROPDOWN");
|
var battlefieldCameraDropDown = panel.Get<DropDownButtonWidget>("BATTLEFIELD_CAMERA_DROPDOWN");
|
||||||
var battlefieldCameraLabel = new CachedTransform<WorldViewport, string>(vs => ViewportSizeNames[vs]);
|
var battlefieldCameraLabel = new CachedTransform<WorldViewport, string>(vs => GetViewportSizeName(modData, vs));
|
||||||
battlefieldCameraDropDown.OnMouseDown = _ => ShowBattlefieldCameraDropdown(battlefieldCameraDropDown, viewportSizes, ds);
|
battlefieldCameraDropDown.OnMouseDown = _ => ShowBattlefieldCameraDropdown(modData, battlefieldCameraDropDown, viewportSizes, ds);
|
||||||
battlefieldCameraDropDown.GetText = () => battlefieldCameraLabel.Update(ds.ViewportDistance);
|
battlefieldCameraDropDown.GetText = () => battlefieldCameraLabel.Update(ds.ViewportDistance);
|
||||||
|
|
||||||
BindTextNotificationPoolFilterSettings(panel, gs);
|
BindTextNotificationPoolFilterSettings(panel, gs);
|
||||||
@@ -251,13 +328,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowWindowModeDropdown(DropDownButtonWidget dropdown, GraphicSettings s, ScrollPanelWidget scrollPanel)
|
static void ShowWindowModeDropdown(ModData modData, DropDownButtonWidget dropdown, GraphicSettings s, ScrollPanelWidget scrollPanel)
|
||||||
{
|
{
|
||||||
var options = new Dictionary<string, WindowMode>()
|
var options = new Dictionary<string, WindowMode>()
|
||||||
{
|
{
|
||||||
{ "Fullscreen", WindowMode.PseudoFullscreen },
|
{ modData.Translation.GetString(Fullscreen), WindowMode.PseudoFullscreen },
|
||||||
{ "Fullscreen (Legacy)", WindowMode.Fullscreen },
|
{ modData.Translation.GetString(LegacyFullscreen), WindowMode.Fullscreen },
|
||||||
{ "Windowed", WindowMode.Windowed },
|
{ modData.Translation.GetString(Windowed), WindowMode.Windowed },
|
||||||
};
|
};
|
||||||
|
|
||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
@@ -300,13 +377,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowStatusBarsDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
static void ShowStatusBarsDropdown(ModData modData, DropDownButtonWidget dropdown, GameSettings s)
|
||||||
{
|
{
|
||||||
var options = new Dictionary<string, StatusBarsType>()
|
var options = new Dictionary<string, StatusBarsType>()
|
||||||
{
|
{
|
||||||
{ "Standard", StatusBarsType.Standard },
|
{ modData.Translation.GetString(Standard), StatusBarsType.Standard },
|
||||||
{ "Show On Damage", StatusBarsType.DamageShow },
|
{ modData.Translation.GetString(ShowOnDamage), StatusBarsType.DamageShow },
|
||||||
{ "Always Show", StatusBarsType.AlwaysShow },
|
{ modData.Translation.GetString(AlwaysShow), StatusBarsType.AlwaysShow },
|
||||||
};
|
};
|
||||||
|
|
||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
@@ -355,13 +432,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, profiles, setupItem);
|
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, profiles, setupItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowTargetLinesDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
static void ShowTargetLinesDropdown(ModData modData, DropDownButtonWidget dropdown, GameSettings s)
|
||||||
{
|
{
|
||||||
var options = new Dictionary<string, TargetLinesType>()
|
var options = new Dictionary<string, TargetLinesType>()
|
||||||
{
|
{
|
||||||
{ "Automatic", TargetLinesType.Automatic },
|
{ modData.Translation.GetString(Automatic), TargetLinesType.Automatic },
|
||||||
{ "Manual", TargetLinesType.Manual },
|
{ modData.Translation.GetString(Manual), TargetLinesType.Manual },
|
||||||
{ "Disabled", TargetLinesType.Disabled },
|
{ modData.Translation.GetString(Disabled), TargetLinesType.Disabled },
|
||||||
};
|
};
|
||||||
|
|
||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
@@ -377,7 +454,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowBattlefieldCameraDropdown(DropDownButtonWidget dropdown, WorldViewportSizes viewportSizes, GraphicSettings gs)
|
public static void ShowBattlefieldCameraDropdown(ModData modData, DropDownButtonWidget dropdown, WorldViewportSizes viewportSizes, GraphicSettings gs)
|
||||||
{
|
{
|
||||||
Func<WorldViewport, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<WorldViewport, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
{
|
{
|
||||||
@@ -385,7 +462,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
() => gs.ViewportDistance == o,
|
() => gs.ViewportDistance == o,
|
||||||
() => gs.ViewportDistance = o);
|
() => gs.ViewportDistance = o);
|
||||||
|
|
||||||
var label = ViewportSizeNames[o];
|
var label = GetViewportSizeName(modData, o);
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => label;
|
item.Get<LabelWidget>("LABEL").GetText = () => label;
|
||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,11 +17,53 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class InputSettingsLogic : ChromeLogic
|
public class InputSettingsLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Classic = "classic";
|
||||||
|
readonly string classic;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Modern = "modern";
|
||||||
|
readonly string modern;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Disabled = "disabled";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Standard = "standard";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Inverted = "inverted";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Joystick = "joystick";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Alt = "alt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Ctrl = "ctrl";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Meta = "meta";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string Shift = "shift";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string None = "none";
|
||||||
|
|
||||||
static InputSettingsLogic() { }
|
static InputSettingsLogic() { }
|
||||||
|
|
||||||
|
readonly ModData modData;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public InputSettingsLogic(Action<string, string, Func<Widget, Func<bool>>, Func<Widget, Action>> registerPanel, string panelID, string label)
|
public InputSettingsLogic(Action<string, string, Func<Widget, Func<bool>>, Func<Widget, Action>> registerPanel, string panelID, string label, ModData modData)
|
||||||
{
|
{
|
||||||
|
this.modData = modData;
|
||||||
|
|
||||||
|
classic = modData.Translation.GetString(Classic);
|
||||||
|
modern = modData.Translation.GetString(Modern);
|
||||||
|
|
||||||
registerPanel(panelID, label, InitPanel, ResetPanel);
|
registerPanel(panelID, label, InitPanel, ResetPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,11 +80,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
SettingsUtils.BindSliderPref(panel, "UI_SCROLLSPEED_SLIDER", gs, "UIScrollSpeed");
|
SettingsUtils.BindSliderPref(panel, "UI_SCROLLSPEED_SLIDER", gs, "UIScrollSpeed");
|
||||||
|
|
||||||
var mouseControlDropdown = panel.Get<DropDownButtonWidget>("MOUSE_CONTROL_DROPDOWN");
|
var mouseControlDropdown = panel.Get<DropDownButtonWidget>("MOUSE_CONTROL_DROPDOWN");
|
||||||
mouseControlDropdown.OnMouseDown = _ => ShowMouseControlDropdown(mouseControlDropdown, gs);
|
mouseControlDropdown.OnMouseDown = _ => ShowMouseControlDropdown(modData, mouseControlDropdown, gs);
|
||||||
mouseControlDropdown.GetText = () => gs.UseClassicMouseStyle ? "Classic" : "Modern";
|
mouseControlDropdown.GetText = () => gs.UseClassicMouseStyle ? classic : modern;
|
||||||
|
|
||||||
var mouseScrollDropdown = panel.Get<DropDownButtonWidget>("MOUSE_SCROLL_TYPE_DROPDOWN");
|
var mouseScrollDropdown = panel.Get<DropDownButtonWidget>("MOUSE_SCROLL_TYPE_DROPDOWN");
|
||||||
mouseScrollDropdown.OnMouseDown = _ => ShowMouseScrollDropdown(mouseScrollDropdown, gs);
|
mouseScrollDropdown.OnMouseDown = _ => ShowMouseScrollDropdown(modData, mouseScrollDropdown, gs);
|
||||||
mouseScrollDropdown.GetText = () => gs.MouseScroll.ToString();
|
mouseScrollDropdown.GetText = () => gs.MouseScroll.ToString();
|
||||||
|
|
||||||
var mouseControlDescClassic = panel.Get("MOUSE_CONTROL_DESC_CLASSIC");
|
var mouseControlDescClassic = panel.Get("MOUSE_CONTROL_DESC_CLASSIC");
|
||||||
@@ -87,7 +129,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
};
|
};
|
||||||
|
|
||||||
var zoomModifierDropdown = panel.Get<DropDownButtonWidget>("ZOOM_MODIFIER");
|
var zoomModifierDropdown = panel.Get<DropDownButtonWidget>("ZOOM_MODIFIER");
|
||||||
zoomModifierDropdown.OnMouseDown = _ => ShowZoomModifierDropdown(zoomModifierDropdown, gs);
|
zoomModifierDropdown.OnMouseDown = _ => ShowZoomModifierDropdown(modData, zoomModifierDropdown, gs);
|
||||||
zoomModifierDropdown.GetText = () => gs.ZoomModifier.ToString();
|
zoomModifierDropdown.GetText = () => gs.ZoomModifier.ToString();
|
||||||
|
|
||||||
SettingsUtils.AdjustSettingsScrollPanelLayout(scrollPanel);
|
SettingsUtils.AdjustSettingsScrollPanelLayout(scrollPanel);
|
||||||
@@ -119,12 +161,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowMouseControlDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
public static void ShowMouseControlDropdown(ModData modData, DropDownButtonWidget dropdown, GameSettings s)
|
||||||
{
|
{
|
||||||
var options = new Dictionary<string, bool>()
|
var options = new Dictionary<string, bool>()
|
||||||
{
|
{
|
||||||
{ "Classic", true },
|
{ modData.Translation.GetString(Classic), true },
|
||||||
{ "Modern", false },
|
{ modData.Translation.GetString(Modern), false },
|
||||||
};
|
};
|
||||||
|
|
||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
@@ -139,14 +181,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowMouseScrollDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
static void ShowMouseScrollDropdown(ModData modData, DropDownButtonWidget dropdown, GameSettings s)
|
||||||
{
|
{
|
||||||
var options = new Dictionary<string, MouseScrollType>()
|
var options = new Dictionary<string, MouseScrollType>()
|
||||||
{
|
{
|
||||||
{ "Disabled", MouseScrollType.Disabled },
|
{ modData.Translation.GetString(Disabled), MouseScrollType.Disabled },
|
||||||
{ "Standard", MouseScrollType.Standard },
|
{ modData.Translation.GetString(Standard), MouseScrollType.Standard },
|
||||||
{ "Inverted", MouseScrollType.Inverted },
|
{ modData.Translation.GetString(Inverted), MouseScrollType.Inverted },
|
||||||
{ "Joystick", MouseScrollType.Joystick },
|
{ modData.Translation.GetString(Joystick), MouseScrollType.Joystick },
|
||||||
};
|
};
|
||||||
|
|
||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
@@ -161,15 +203,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowZoomModifierDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
static void ShowZoomModifierDropdown(ModData modData, DropDownButtonWidget dropdown, GameSettings s)
|
||||||
{
|
{
|
||||||
var options = new Dictionary<string, Modifiers>()
|
var options = new Dictionary<string, Modifiers>()
|
||||||
{
|
{
|
||||||
{ "Alt", Modifiers.Alt },
|
{ modData.Translation.GetString(Alt), Modifiers.Alt },
|
||||||
{ "Ctrl", Modifiers.Ctrl },
|
{ modData.Translation.GetString(Ctrl), Modifiers.Ctrl },
|
||||||
{ "Meta", Modifiers.Meta },
|
{ modData.Translation.GetString(Meta), Modifiers.Meta },
|
||||||
{ "Shift", Modifiers.Shift },
|
{ modData.Translation.GetString(Shift), Modifiers.Shift },
|
||||||
{ "None", Modifiers.None }
|
{ modData.Translation.GetString(None), Modifiers.None }
|
||||||
};
|
};
|
||||||
|
|
||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
|
|||||||
@@ -19,6 +19,39 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class SettingsLogic : ChromeLogic
|
public class SettingsLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SettingsSaveTitle = "settings-save-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SettingsSavePrompt = "settings-save-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string SettingsSaveCancel = "settings-save-cancel";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RestartTitle = "restart-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RestartPrompt = "restart-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RestartAccept = "restart-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string RestartCancel = "restart-cancel";
|
||||||
|
|
||||||
|
[TranslationReference("panel")]
|
||||||
|
static readonly string ResetTitle = "reset-title";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ResetPrompt = "reset-prompt";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ResetAccept = "reset-accept";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string ResetCancel = "reset-cancel";
|
||||||
|
|
||||||
readonly Dictionary<string, Func<bool>> leavePanelActions = new Dictionary<string, Func<bool>>();
|
readonly Dictionary<string, Func<bool>> leavePanelActions = new Dictionary<string, Func<bool>>();
|
||||||
readonly Dictionary<string, Action> resetPanelActions = new Dictionary<string, Action>();
|
readonly Dictionary<string, Action> resetPanelActions = new Dictionary<string, Action>();
|
||||||
|
|
||||||
@@ -34,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
static SettingsLogic() { }
|
static SettingsLogic() { }
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public SettingsLogic(Widget widget, Action onExit, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs)
|
public SettingsLogic(Widget widget, Action onExit, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs, ModData modData)
|
||||||
{
|
{
|
||||||
panelContainer = widget.Get("PANEL_CONTAINER");
|
panelContainer = widget.Get("PANEL_CONTAINER");
|
||||||
var panelTemplate = panelContainer.Get<ContainerWidget>("PANEL_TEMPLATE");
|
var panelTemplate = panelContainer.Get<ContainerWidget>("PANEL_TEMPLATE");
|
||||||
@@ -75,11 +108,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Action closeAndExit = () => { Ui.CloseWindow(); onExit(); };
|
Action closeAndExit = () => { Ui.CloseWindow(); onExit(); };
|
||||||
if (needsRestart)
|
if (needsRestart)
|
||||||
{
|
{
|
||||||
Action noRestart = () => ConfirmationDialogs.ButtonPrompt(
|
Action noRestart = () => ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Restart Required",
|
title: SettingsSaveTitle,
|
||||||
text: "Some changes will not be applied until\nthe game is restarted.",
|
text: SettingsSavePrompt,
|
||||||
onCancel: closeAndExit,
|
onCancel: closeAndExit,
|
||||||
cancelText: "Continue");
|
cancelText: SettingsSaveCancel);
|
||||||
|
|
||||||
if (!Game.ExternalMods.TryGetValue(ExternalMod.MakeKey(Game.ModData.Manifest), out var external))
|
if (!Game.ExternalMods.TryGetValue(ExternalMod.MakeKey(Game.ModData.Manifest), out var external))
|
||||||
{
|
{
|
||||||
@@ -87,13 +120,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: "Restart Now?",
|
title: RestartTitle,
|
||||||
text: "Some changes will not be applied until\nthe game is restarted. Restart now?",
|
text: RestartPrompt,
|
||||||
onConfirm: () => Game.SwitchToExternalMod(external, null, noRestart),
|
onConfirm: () => Game.SwitchToExternalMod(external, null, noRestart),
|
||||||
onCancel: closeAndExit,
|
onCancel: closeAndExit,
|
||||||
confirmText: "Restart Now",
|
confirmText: RestartAccept,
|
||||||
cancelText: "Restart Later");
|
cancelText: RestartCancel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
closeAndExit();
|
closeAndExit();
|
||||||
@@ -107,13 +140,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Game.Settings.Save();
|
Game.Settings.Save();
|
||||||
};
|
};
|
||||||
|
|
||||||
ConfirmationDialogs.ButtonPrompt(
|
ConfirmationDialogs.ButtonPrompt(modData,
|
||||||
title: $"Reset \"{panels[activePanel]}\"",
|
title: ResetTitle,
|
||||||
text: "Are you sure you want to reset\nall settings in this panel?",
|
titleArguments: Translation.Arguments("panel", panels[activePanel]),
|
||||||
|
text: ResetPrompt,
|
||||||
onConfirm: reset,
|
onConfirm: reset,
|
||||||
onCancel: () => { },
|
onCancel: () => { },
|
||||||
confirmText: "Reset",
|
confirmText: ResetAccept,
|
||||||
cancelText: "Cancel");
|
cancelText: ResetCancel);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,8 @@ invalid-bot-slot = Can't add bots to a slot with another client.
|
|||||||
invalid-bot-type = Invalid bot type.
|
invalid-bot-type = Invalid bot type.
|
||||||
only-host-change-map = Only the host can change the map.
|
only-host-change-map = Only the host can change the map.
|
||||||
lobby-disconnected = { $player } has left.
|
lobby-disconnected = { $player } has left.
|
||||||
player-disconnected =
|
player-disconnected = { $player } has disconnected.
|
||||||
{ $team ->
|
player-team-disconnected = { $player } (Team { $team }) has disconnected.
|
||||||
[0] { $player } has disconnected.
|
|
||||||
*[other] { $player } (Team { $team }) has disconnected.
|
|
||||||
}
|
|
||||||
observer-disconnected = { $player } (Spectator) has disconnected.
|
observer-disconnected = { $player } (Spectator) has disconnected.
|
||||||
unknown-map = Map was not found on server.
|
unknown-map = Map was not found on server.
|
||||||
searching-map = Searching for map on the Resource Center...
|
searching-map = Searching for map on the Resource Center...
|
||||||
@@ -83,11 +80,8 @@ 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
|
|
||||||
|
|
||||||
## PlayerMessageTracker
|
## PlayerMessageTracker
|
||||||
chat-disabled =
|
chat-temp-disabled =
|
||||||
{ $remaining ->
|
{ $remaining ->
|
||||||
[one] Chat is disabled. Please try again in { $remaining } second.
|
[one] Chat is disabled. Please try again in { $remaining } second.
|
||||||
*[other] Chat is disabled. Please try again in { $remaining } seconds.
|
*[other] Chat is disabled. Please try again in { $remaining } seconds.
|
||||||
@@ -105,6 +99,23 @@ type = Type
|
|||||||
search-results = Search Results
|
search-results = Search Results
|
||||||
multiple = Multiple
|
multiple = Multiple
|
||||||
|
|
||||||
|
## SaveMapLogic
|
||||||
|
unpacked = unpacked
|
||||||
|
|
||||||
|
save-map-failed-title = Failed to save map
|
||||||
|
save-map-failed-prompt = See debug.log for details.
|
||||||
|
save-map-failed-accept = OK
|
||||||
|
|
||||||
|
overwrite-map-failed-title = Warning
|
||||||
|
overwrite-map-failed-prompt = By saving you will overwrite
|
||||||
|
an already existing map.
|
||||||
|
overwrite-map-failed-confirm = Save
|
||||||
|
|
||||||
|
overwrite-map-outside-edit-title = Warning
|
||||||
|
overwrite-map-outside-edit-prompt = "The map has been edited from outside the editor.
|
||||||
|
By saving you may overwrite progress
|
||||||
|
overwrite-map-outside-edit-confirm = Save
|
||||||
|
|
||||||
## GameInfoLogic
|
## GameInfoLogic
|
||||||
objectives = Objectives
|
objectives = Objectives
|
||||||
briefing = Briefing
|
briefing = Briefing
|
||||||
@@ -112,7 +123,7 @@ options = Options
|
|||||||
debug = Debug
|
debug = Debug
|
||||||
chat = Chat
|
chat = Chat
|
||||||
|
|
||||||
## GameInfoObjectivesLogic also GameInfoStatsLogic
|
## GameInfoObjectivesLogic, GameInfoStatsLogic
|
||||||
in-progress = In progress
|
in-progress = In progress
|
||||||
accomplished = Accomplished
|
accomplished = Accomplished
|
||||||
failed = Failed
|
failed = Failed
|
||||||
@@ -121,6 +132,13 @@ failed = Failed
|
|||||||
mute = Mute this player
|
mute = Mute this player
|
||||||
unmute = Unmute this player
|
unmute = Unmute this player
|
||||||
|
|
||||||
|
## GameInfoStatsLogic
|
||||||
|
gone = Gone
|
||||||
|
|
||||||
|
kick-title = Kick { $player }?
|
||||||
|
kick-prompt = They will not be able to rejoin this game.
|
||||||
|
kick-accept = Kick
|
||||||
|
|
||||||
## GameTimerLogic
|
## GameTimerLogic
|
||||||
paused = Paused
|
paused = Paused
|
||||||
max-speed = Max Speed
|
max-speed = Max Speed
|
||||||
@@ -128,13 +146,60 @@ speed = { $percentage }% Speed
|
|||||||
complete = { $percentage }% complete
|
complete = { $percentage }% complete
|
||||||
|
|
||||||
## LobbyLogic, InGameChatLogic
|
## LobbyLogic, InGameChatLogic
|
||||||
|
chat-disabled = Chat Disabled
|
||||||
chat-availability =
|
chat-availability =
|
||||||
{ $seconds ->
|
{ $seconds ->
|
||||||
[zero] Chat Disabled
|
|
||||||
[one] Chat available in { $seconds } second...
|
[one] Chat available in { $seconds } second...
|
||||||
*[other] Chat available in { $seconds } seconds...
|
*[other] Chat available in { $seconds } seconds...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## IngameMenuLogic
|
||||||
|
leave = Leave
|
||||||
|
abort-mission = Abort Mission
|
||||||
|
|
||||||
|
leave-mission-title = Leave Mission
|
||||||
|
leave-mission-prompt = Leave this game and return to the menu?
|
||||||
|
leave-mission-accept = Leave
|
||||||
|
leave-mission-cancel = Stay
|
||||||
|
|
||||||
|
restart-button = Restart
|
||||||
|
|
||||||
|
restart-mission-title = Restart
|
||||||
|
restart-mission-prompt = Are you sure you want to restart?
|
||||||
|
restart-mission-accept = Restart
|
||||||
|
restart-mission-cancel = Stay
|
||||||
|
|
||||||
|
surrender-button = Surrender
|
||||||
|
|
||||||
|
surrender-title = Surrender
|
||||||
|
surrender-prompt = Are you sure you want to surrender?
|
||||||
|
surrender-accept = Surrender
|
||||||
|
surrender-cancel = Stay
|
||||||
|
|
||||||
|
load-game-button = Load Game
|
||||||
|
save-game-button = Save Game
|
||||||
|
|
||||||
|
music-button = Music
|
||||||
|
|
||||||
|
settings-button = Settings
|
||||||
|
|
||||||
|
return-to-map = Return to map
|
||||||
|
resume = Resume
|
||||||
|
|
||||||
|
save-map-button = Save Map
|
||||||
|
|
||||||
|
error-max-player-title = Error: Max player count exceeded
|
||||||
|
error-max-player-prompt = There are too many players defined ({ $players }/{ $max }).
|
||||||
|
error-max-player-accept = Back
|
||||||
|
|
||||||
|
exit-map-button = Exit Map Editor
|
||||||
|
|
||||||
|
exit-map-editor-title = Exit Map Editor
|
||||||
|
exit-map-editor-prompt-unsaved = Exit and lose all unsaved changes?
|
||||||
|
exit-map-editor-prompt-deleted = The map may have been deleted outside the editor.
|
||||||
|
exit-map-editor-confirm-anyway = Exit anyway
|
||||||
|
exit-map-editor-confirm = Exit
|
||||||
|
|
||||||
## IngamePowerBarLogic
|
## IngamePowerBarLogic
|
||||||
## IngamePowerCounterLogic
|
## IngamePowerCounterLogic
|
||||||
power-usage = Power Usage
|
power-usage = Power Usage
|
||||||
@@ -162,13 +227,69 @@ army-graph = Army (graph)
|
|||||||
## WorldTooltipLogic
|
## WorldTooltipLogic
|
||||||
unrevealed-terrain = Unrevealed Terrain
|
unrevealed-terrain = Unrevealed Terrain
|
||||||
|
|
||||||
## ServerlistLogic, GameInfoStatsLogic, ObserverShroudSelectorLogic, SpawnSelectorTooltipLogic
|
## DownloadPackageLogic
|
||||||
team-no-team =
|
downloading = Downloading { $title }
|
||||||
{ $team ->
|
fetching-mirror-list = Fetching list of mirrors...
|
||||||
[zero] No Team
|
downloading-from = Downloading from { $host } { $received } { $suffix }
|
||||||
*[other] Team { $team }
|
downloading-from-progress = Downloading from { $host } { $received } / { $total } { $suffix } ({ $progress }%)
|
||||||
|
unknown-host = unknown host
|
||||||
|
verifying-archive = Verifying archive...
|
||||||
|
archive-validation-failed = Archive validation failed
|
||||||
|
extracting = Extracting...
|
||||||
|
extracting-entry = Extracting { $entry }
|
||||||
|
archive-extraction-failed = Archive extraction failed
|
||||||
|
mirror-selection-failed = Online mirror is not available. Please install from an original disc.
|
||||||
|
|
||||||
|
## InstallFromDiscLogic
|
||||||
|
detecting-drives = Detecting drives
|
||||||
|
checking-discs = Checking Discs
|
||||||
|
searching-disc-for = Searching for { $title }
|
||||||
|
content-package-installation = The following content packages will be installed:
|
||||||
|
game-discs = Game Discs
|
||||||
|
digital-installs = Digital Installs
|
||||||
|
game-content-not-found = Game Content Not Found
|
||||||
|
alternative-content-sources = Please insert or install one of the following content sources:
|
||||||
|
installing-content = Installing Content
|
||||||
|
copying-filename = Copying { $filename }
|
||||||
|
copying-filename-progress = Copying { $filename } ({ $progress }%)
|
||||||
|
installation-failed = Installation Failed
|
||||||
|
check-install-log = Refer to install.log in the logs directory for details.
|
||||||
|
extracting-filename = Extracting { $filename }
|
||||||
|
extracting-filename-progress = Extracting { $filename } ({ $progress }%)
|
||||||
|
cancel = Cancel
|
||||||
|
retry = Retry
|
||||||
|
|
||||||
|
## InstallFromDiscLogic, LobbyLogic
|
||||||
|
back = Back
|
||||||
|
|
||||||
|
# InstallFromDiscLogic, ModContentPromptLogic
|
||||||
|
continue = Continue
|
||||||
|
|
||||||
|
## ModContentLogic
|
||||||
|
manual-install = Manual Install
|
||||||
|
|
||||||
|
## ModContentPromptLogic
|
||||||
|
quit = Quit
|
||||||
|
|
||||||
|
## KickClientLogic
|
||||||
|
kick-client = Kick { $player }?
|
||||||
|
|
||||||
|
## KickSpectatorsLogic
|
||||||
|
kick-spectators =
|
||||||
|
{ $count ->
|
||||||
|
[one] Are you sure you want to kick one spectator?
|
||||||
|
*[other] Are you sure you want to kick { $count } spectators?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## LobbyLogic
|
||||||
|
add = Add
|
||||||
|
remove = Remove
|
||||||
|
configure-bots = Configure Bots
|
||||||
|
n-teams = { $count } Teams
|
||||||
|
humans-vs-bots = Humans vs Bots
|
||||||
|
free-for-all = Free for all
|
||||||
|
configure-teams = Configure Teams
|
||||||
|
|
||||||
## LobbyLogic, CommonSelectorLogic, InGameChatLogic
|
## LobbyLogic, CommonSelectorLogic, InGameChatLogic
|
||||||
all = All
|
all = All
|
||||||
|
|
||||||
@@ -178,5 +299,287 @@ none = None
|
|||||||
## LobbyLogic, IngameChatLogic
|
## LobbyLogic, IngameChatLogic
|
||||||
team = Team
|
team = Team
|
||||||
|
|
||||||
## ServerListLogic, ReplayBrowserLogic also ObserverShroudSelectorLogic
|
## LobbyOptionsLogic
|
||||||
|
not-available = Not Available
|
||||||
|
|
||||||
|
## LobbyUtils
|
||||||
|
slot = Slot
|
||||||
|
open = Open
|
||||||
|
closed = Closed
|
||||||
|
bots = Bots
|
||||||
|
|
||||||
|
# LobbyUtils, Server
|
||||||
|
bots-disabled = Bots Disabled
|
||||||
|
|
||||||
|
## MapPreviewLogic
|
||||||
|
connecting = Connecting...
|
||||||
|
downloading-map = Downloading { $size } kB
|
||||||
|
downloading-map-progress = Downloading { $size } kB ({ $progress }%)
|
||||||
|
retry-install = Retry Install
|
||||||
|
retry-search = Retry Search
|
||||||
|
## also MapChooserLogic
|
||||||
|
created-by = Created by { $author }
|
||||||
|
|
||||||
|
## SpawnSelectorTooltipLogic
|
||||||
|
disabled-spawn = Disabled spawn
|
||||||
|
available-spawn = Available spawn
|
||||||
|
|
||||||
|
## DisplaySettingsLogic
|
||||||
|
close = Close
|
||||||
|
medium = Medium
|
||||||
|
far = Far
|
||||||
|
furthest = Furthest
|
||||||
|
|
||||||
|
windowed = Windowed
|
||||||
|
legacy-fullscreen = Fullscreen (Legacy)
|
||||||
|
fullscreen = Fullscreen
|
||||||
|
|
||||||
|
display = Display { $number }
|
||||||
|
|
||||||
|
show-on-damage = Show On Damage
|
||||||
|
always-show = Always Show
|
||||||
|
|
||||||
|
automatic = Automatic
|
||||||
|
manual = Manual
|
||||||
|
|
||||||
|
## DisplaySettingsLogic, InputSettingsLogic
|
||||||
|
disabled = Disabled
|
||||||
|
|
||||||
|
## DisplaySettingsLogic, InputSettingsLogic, IntroductionPromptLogic
|
||||||
|
classic = Classic
|
||||||
|
modern = Modern
|
||||||
|
standard = Standard
|
||||||
|
|
||||||
|
## DisplaySettingsLogic, IntroductionPromptLogic
|
||||||
|
inverted = Inverted
|
||||||
|
joystick = Joystick
|
||||||
|
|
||||||
|
alt = Alt
|
||||||
|
ctrl = Ctrl
|
||||||
|
meta = Meta
|
||||||
|
shift = Shift
|
||||||
|
|
||||||
|
## SettingsLogic
|
||||||
|
settings-save-title = Restart Required
|
||||||
|
settings-save-prompt = Some changes will not be applied until
|
||||||
|
the game is restarted.
|
||||||
|
settings-save-cancel = Continue
|
||||||
|
|
||||||
|
restart-title = Restart Now?
|
||||||
|
restart-prompt = Some changes will not be applied until
|
||||||
|
the game is restarted. Restart now?
|
||||||
|
restart-accept = Restart Now
|
||||||
|
restart-cancel = Restart Later
|
||||||
|
|
||||||
|
reset-title = Reset { $panel }
|
||||||
|
reset-prompt = Are you sure you want to reset
|
||||||
|
all settings in this panel?
|
||||||
|
reset-accept = Reset
|
||||||
|
reset-cancel = Cancel
|
||||||
|
|
||||||
|
## AssetBrowserLogic
|
||||||
|
all-packages = All Packages
|
||||||
|
length-in-seconds = { $length } sec
|
||||||
|
|
||||||
|
## ConnectionLogic
|
||||||
|
connecting-to-endpoint = Connecting to { $endpoint }...
|
||||||
|
could-not-connect-to-target = Could not connect to { $target }
|
||||||
|
unknown-error = Unknown error
|
||||||
|
password-required = Password Required
|
||||||
|
connection-failed = Connection Failed
|
||||||
|
mod-switch-failed = Failed to switch mod.
|
||||||
|
|
||||||
|
## GameSaveBrowserLogic
|
||||||
|
rename-save-title = Rename Save
|
||||||
|
rename-save-prompt = Enter a new file name:
|
||||||
|
rename-save-accept = Rename
|
||||||
|
|
||||||
|
delete-save-title = Delete selected game save?
|
||||||
|
delete-save-prompt = Delete '{ $save }'
|
||||||
|
delete-save-accept = Delete
|
||||||
|
|
||||||
|
delete-all-saves-title = Delete all game saves?
|
||||||
|
delete-all-saves-prompt =
|
||||||
|
{ $count ->
|
||||||
|
[one] Delete { $count } save.
|
||||||
|
*[other] Delete { $count } saves.
|
||||||
|
}
|
||||||
|
delete-all-saves-accept = Delete All
|
||||||
|
|
||||||
|
save-deletion-failed = Failed to delete save file '{ $savePath }'. See the logs for details.
|
||||||
|
|
||||||
|
overwrite-save-title = Overwrite saved game?
|
||||||
|
overwrite-save-prompt = Overwrite { $file }?
|
||||||
|
overwrite-save-accept = Overwrite
|
||||||
|
|
||||||
|
## MainMenuLogic
|
||||||
|
loading-news = Loading news
|
||||||
|
news-retrival-failed = Failed to retrieve news: { $message }
|
||||||
|
news-parsing-failed = Failed to parse news: { $message }
|
||||||
|
|
||||||
|
## MapChooserLogic
|
||||||
|
all-maps = All Maps
|
||||||
|
no-matches = No matches
|
||||||
|
player-players =
|
||||||
|
{ $players ->
|
||||||
|
[one] { $players } Player
|
||||||
|
*[other] { $players } Players
|
||||||
|
}
|
||||||
|
map-size-huge = (Huge)
|
||||||
|
map-size-large = (Large)
|
||||||
|
map-size-medium = (Medium)
|
||||||
|
map-size-small = (Small)
|
||||||
|
|
||||||
|
map-deletion-failed = Failed to delete map '{ $map }'. See the debug.log file for details.
|
||||||
|
|
||||||
|
delete-map-title = Delete map
|
||||||
|
delete-map-prompt = Delete the map '{ $title }'?
|
||||||
|
delete-map-accept = Delete
|
||||||
|
|
||||||
|
delete-all-maps-title = Delete maps
|
||||||
|
delete-all-maps-prompt = Delete all maps on this page?
|
||||||
|
delete-all-maps-accept = Delete
|
||||||
|
|
||||||
|
## MissionBrowserLogic
|
||||||
|
no-video-title = Video not installed
|
||||||
|
no-video-text = The game videos can be installed from the
|
||||||
|
"Manage Content" menu in the mod chooser.
|
||||||
|
no-video-cancel = Back
|
||||||
|
|
||||||
|
cant-play-title = Unable to play video
|
||||||
|
cant-play-prompt = Something went wrong during video playback.
|
||||||
|
cant-play-cancel = Back
|
||||||
|
|
||||||
|
## MusicPlayerLogic
|
||||||
|
sound-muted = Audio has been muted in settings.
|
||||||
|
no-song-playing = No song playing
|
||||||
|
|
||||||
|
## MuteHotkeyLogic
|
||||||
|
audio-muted = Audio muted.
|
||||||
|
audio-unmuted = Audio unmuted.
|
||||||
|
|
||||||
|
## PlayerProfileLogic
|
||||||
|
loading-player-profile = Loading player profile...
|
||||||
|
loading-player-profile-failed = Failed to load player profile.
|
||||||
|
|
||||||
|
## ReplayBrowserLogic
|
||||||
|
duration = Duration: { $time }
|
||||||
|
singleplayer = Singleplayer
|
||||||
|
multiplayer = Multiplayer
|
||||||
|
|
||||||
|
today = Today
|
||||||
|
last-week = Last 7 days
|
||||||
|
last-fortnight = Last 14 days
|
||||||
|
last-month = Last 30 days
|
||||||
|
|
||||||
|
replay-duration-very-short = Under 5 min
|
||||||
|
replay-duration-short = Short (10 min)
|
||||||
|
replay-duration-medium = Medium (30 min)
|
||||||
|
replay-duration-long = Long (60+ min)
|
||||||
|
|
||||||
|
rename-replay-title = Rename Replay
|
||||||
|
rename-replay-prompt = Enter a new file name:
|
||||||
|
rename-replay-accept = Rename
|
||||||
|
|
||||||
|
delete-replay-title = Delete selected replay?
|
||||||
|
delete-replay-prompt = Delete replay { $replay }?
|
||||||
|
delete-replay-accept = Delete
|
||||||
|
|
||||||
|
delete-all-replays-title = Delete all selected replays?
|
||||||
|
delete-all-replays-prompt =
|
||||||
|
{ $count ->
|
||||||
|
[one] Delete { $count } replay.
|
||||||
|
*[other] Delete { $count } replays.
|
||||||
|
}
|
||||||
|
delete-all-replays-accept = Delete All
|
||||||
|
|
||||||
|
replay-deletion-failed = Failed to delete replay file '{ $file }'. See the debug.log file for details.
|
||||||
|
|
||||||
|
## ReplayUtils
|
||||||
|
incompatible-replay-title = Incompatible Replay
|
||||||
|
incompatible-replay-prompt = Replay metadata could not be read.
|
||||||
|
-incompatible-replay-recorded = It was recorded with
|
||||||
|
incompatible-replay-unknown-version = { -incompatible-replay-recorded } an unknown version: { $version }.
|
||||||
|
incompatible-replay-unknown-mod = { -incompatible-replay-recorded } an unknown mod: { $mod }.
|
||||||
|
incompatible-replay-unavailable-mod = { -incompatible-replay-recorded } an unavailable mod: { $mod }.
|
||||||
|
incompatible-replay-incompatible-version = { -incompatible-replay-recorded } an incompatible version: { $version }.
|
||||||
|
incompatible-replay-unavailable-map = { -incompatible-replay-recorded } an unavailable map: { $map }.
|
||||||
|
|
||||||
|
## ServerCreationLogic
|
||||||
|
internet-server-nat-A = Internet Server (UPnP/NAT-PMP
|
||||||
|
internet-server-nat-B-enabled = Enabled
|
||||||
|
internet-server-nat-B-not-supported = Not Supported
|
||||||
|
internet-server-nat-B-disabled = Disabled
|
||||||
|
internet-server-nat-C = ):
|
||||||
|
|
||||||
|
local-server = Local Server:
|
||||||
|
|
||||||
|
server-creation-failed-prompt = Could not listen on port { $port }
|
||||||
|
server-creation-failed-port-used = Check if the port is already being used.
|
||||||
|
server-creation-failed-error = Error is: "{ $message }" ({ $code })
|
||||||
|
server-creation-failed-title = Server Creation Failed
|
||||||
|
server-creation-failed-cancel = Back
|
||||||
|
|
||||||
|
## ServerListLogic
|
||||||
|
players-online =
|
||||||
|
{ $players ->
|
||||||
|
[one] { $players } Player Online
|
||||||
|
*[other] { $players } Players Online
|
||||||
|
}
|
||||||
|
|
||||||
|
search-status-failed = Failed to query server list.
|
||||||
|
search-status-no-games = No games found. Try changing filters.
|
||||||
|
no-server-selected = No Server Selected
|
||||||
|
|
||||||
|
map-status-searching = Searching...
|
||||||
|
map-classification-unknown = Unknown Map
|
||||||
|
|
||||||
|
players-label =
|
||||||
|
{ $players ->
|
||||||
|
[0] No Players
|
||||||
|
[one] One Player
|
||||||
|
*[other] { $players } Players
|
||||||
|
}
|
||||||
|
|
||||||
|
bots-label =
|
||||||
|
{ $bots ->
|
||||||
|
[0] No Bots
|
||||||
|
[one] One Bot
|
||||||
|
*[other] { $bots } Bots
|
||||||
|
}
|
||||||
|
|
||||||
|
## ServerListLogic, ReplayBrowserLogic, ObserverShroudSelectorLogic
|
||||||
players = Players
|
players = Players
|
||||||
|
|
||||||
|
## ServerListLogic, GameInfoStatsLogic
|
||||||
|
spectators = Spectators
|
||||||
|
spectators-label =
|
||||||
|
{ $spectators ->
|
||||||
|
[0] No Spectators
|
||||||
|
[one] One Spectator
|
||||||
|
*[other] { $spectators } Spectators
|
||||||
|
}
|
||||||
|
|
||||||
|
## ServerlistLogic, GameInfoStatsLogic, ObserverShroudSelectorLogic, SpawnSelectorTooltipLogic, ReplayBrowserLogic
|
||||||
|
team-number = Team { $team }
|
||||||
|
no-team = No Team
|
||||||
|
|
||||||
|
playing = Playing
|
||||||
|
waiting = Waiting
|
||||||
|
|
||||||
|
n-other-players =
|
||||||
|
{ $players ->
|
||||||
|
[one] One other player
|
||||||
|
*[other] { $players } other players
|
||||||
|
}
|
||||||
|
|
||||||
|
in-progress-for =
|
||||||
|
{ $minutes ->
|
||||||
|
[0] In progress
|
||||||
|
[one] In progress for { $minutes } minute.
|
||||||
|
*[other] In progress for { $minutes } minutes.
|
||||||
|
}
|
||||||
|
password-protected = Password protected
|
||||||
|
waiting-for-players = Waiting for players
|
||||||
|
server-shutting-down = Server shutting down
|
||||||
|
unknown-server-state = Unknown server state
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ ChromeMetrics:
|
|||||||
common|metrics.yaml
|
common|metrics.yaml
|
||||||
modcontent|metrics.yaml
|
modcontent|metrics.yaml
|
||||||
|
|
||||||
|
Translations:
|
||||||
|
common|languages/en.ftl
|
||||||
|
|
||||||
Fonts:
|
Fonts:
|
||||||
Tiny:
|
Tiny:
|
||||||
Font: common|FreeSans.ttf
|
Font: common|FreeSans.ttf
|
||||||
|
|||||||
Reference in New Issue
Block a user