Extract text feedback messages.

This commit is contained in:
Matthias Mailänder
2023-08-19 13:03:15 +02:00
committed by Gustas
parent 94c8339e17
commit c609c4af14
77 changed files with 521 additions and 274 deletions

View File

@@ -37,6 +37,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when selecting a primary building.")]
public readonly string SelectionNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display when selecting a primary building.")]
public readonly string SelectionTextNotification = null;

View File

@@ -24,6 +24,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when a unit is delivered.")]
public readonly string ReadyAudio = "Reinforce";
[TranslationReference(optional: true)]
[Desc("Text notification to display when a unit is delivered.")]
public readonly string ReadyTextNotification = null;

View File

@@ -49,6 +49,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when setting a new rallypoint.")]
public readonly string Notification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display when setting a new rallypoint.")]
public readonly string TextNotification = null;

View File

@@ -47,10 +47,11 @@ namespace OpenRA.Mods.Common.Traits
public readonly string RepairCondition = null;
[NotificationReference("Speech")]
[Desc("Speech notification to play when the repair process is started.")]
[Desc("Voice line to play when repairs are started.")]
public readonly string RepairingNotification = null;
[Desc("Text notification to display when the repair process is started.")]
[TranslationReference(optional: true)]
[Desc("Transient text message to display when repairs are started.")]
public readonly string RepairingTextNotification = null;
[NotificationReference("Speech")]

View File

@@ -31,6 +31,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string EnabledSpeech = null;
[TranslationReference(optional: true)]
public readonly string EnabledTextNotification = null;
[NotificationReference("Sounds")]
@@ -39,6 +40,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string DisabledSpeech = null;
[TranslationReference(optional: true)]
public readonly string DisabledTextNotification = null;
public override object Create(ActorInitializer init) { return new ToggleConditionOnOrder(this); }

View File

@@ -39,6 +39,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when the crate is collected.")]
public readonly string Notification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display when the crate is collected.")]
public readonly string TextNotification = null;

View File

@@ -49,6 +49,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Sounds")]
public readonly string LevelUpNotification = null;
[TranslationReference(optional: true)]
public readonly string LevelUpTextNotification = null;
public override object Create(ActorInitializer init) { return new GainsExperience(init, this); }

View File

@@ -31,6 +31,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification type to play.")]
public readonly string Notification = "BaseAttack";
[TranslationReference(optional: true)]
[Desc("Text notification to display.")]
public readonly string TextNotification = null;
@@ -39,6 +40,7 @@ namespace OpenRA.Mods.Common.Traits
"Won't play a notification to allies if this is null.")]
public readonly string AllyNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display to allies when under attack.")]
public readonly string AllyTextNotification = null;

View File

@@ -31,6 +31,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification type to play.")]
public readonly string Notification = "HarvesterAttack";
[TranslationReference(optional: true)]
[Desc("Text notification to display.")]
public readonly string TextNotification = null;

View File

@@ -54,16 +54,19 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string WinNotification = null;
[TranslationReference(optional: true)]
public readonly string WinTextNotification = null;
[NotificationReference("Speech")]
public readonly string LoseNotification = null;
[TranslationReference(optional: true)]
public readonly string LoseTextNotification = null;
[NotificationReference("Speech")]
public readonly string LeaveNotification = null;
[TranslationReference(optional: true)]
public readonly string LeaveTextNotification = null;
public override object Create(ActorInitializer init) { return new MissionObjectives(init.Self.Owner, this); }

View File

@@ -29,6 +29,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play after building placement if new construction options are available.")]
public readonly string NewOptionsNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display after building placement if new construction options are available.")]
public readonly string NewOptionsTextNotification = null;
@@ -36,6 +37,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play if building placement is not possible.")]
public readonly string CannotPlaceNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display if building placement is not possible.")]
public readonly string CannotPlaceTextNotification = null;

View File

@@ -45,6 +45,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when the player does not have any funds.")]
public readonly string InsufficientFundsNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display when the player does not have any funds.")]
public readonly string InsufficientFundsTextNotification = null;

View File

@@ -61,6 +61,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string ReadyAudio = null;
[TranslationReference(optional: true)]
[Desc("Notification displayed when production is complete.")]
public readonly string ReadyTextNotification = null;
@@ -70,6 +71,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string BlockedAudio = null;
[TranslationReference(optional: true)]
[Desc("Notification displayed when you can't train another actor",
"when the build limit exceeded or the exit is jammed.")]
public readonly string BlockedTextNotification = null;
@@ -80,6 +82,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string LimitedAudio = null;
[TranslationReference(optional: true)]
[Desc("Notification displayed when you can't queue another actor",
"when the queue length limit is exceeded.")]
public readonly string LimitedTextNotification = null;
@@ -95,6 +98,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string QueuedAudio = null;
[TranslationReference(optional: true)]
[Desc("Notification displayed when user clicks on the build palette icon.")]
public readonly string QueuedTextNotification = null;
@@ -103,6 +107,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string OnHoldAudio = null;
[TranslationReference(optional: true)]
[Desc("Notification displayed when player right-clicks on the build palette icon.")]
public readonly string OnHoldTextNotification = null;
@@ -111,6 +116,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string CancelledAudio = null;
[TranslationReference(optional: true)]
[Desc("Notification displayed when player right-clicks on a build palette icon that is already on hold.")]
public readonly string CancelledTextNotification = null;

View File

@@ -27,6 +27,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech to play for the warning.")]
public readonly string Notification = "SilosNeeded";
[TranslationReference(optional: true)]
[Desc("Text to display for the warning.")]
public readonly string TextNotification = null;

View File

@@ -27,6 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string SpeechNotification = null;
[Desc("The text notification to display when the player is low power.")]
[TranslationReference(optional: true)]
public readonly string TextNotification = null;
public override object Create(ActorInitializer init) { return new PowerManager(init.Self, this); }

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when dropping the unit.")]
public readonly string ReadyAudio = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display when dropping the unit.")]
public readonly string ReadyTextNotification = null;

View File

@@ -42,6 +42,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when a bridge is repaired.")]
public readonly string RepairNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display when a bridge is repaired.")]
public readonly string RepairTextNotification = null;

View File

@@ -31,6 +31,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification played when starting to repair a unit.")]
public readonly string StartRepairingNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification displayed when starting to repair a unit.")]
public readonly string StartRepairingTextNotification = null;
@@ -38,6 +39,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification played when repairing a unit is done.")]
public readonly string FinishRepairingNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification displayed when repairing a unit is done.")]
public readonly string FinishRepairingTextNotification = null;

View File

@@ -30,6 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play.")]
public readonly string Notification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display.")]
public readonly string TextNotification = null;

View File

@@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
public readonly string Notification = "UnitLost";
[Desc("Text notification to display.")]
[TranslationReference(optional: true)]
public readonly string TextNotification = null;
public readonly bool NotifyAll = false;

View File

@@ -26,6 +26,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
[Desc("Speech notification to play.")]
public readonly string Notification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display.")]
public readonly string TextNotification = null;

View File

@@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
[Desc("Speech notification to play to the new owner.")]
public readonly string Notification = "BuildingCaptured";
[TranslationReference(optional: true)]
[Desc("Text notification to display to the new owner.")]
public readonly string TextNotification = null;
@@ -30,6 +31,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
[Desc("Speech notification to play to the old owner.")]
public readonly string LoseNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display to the old owner.")]
public readonly string LoseTextNotification = null;

View File

@@ -30,6 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when entering the drop zone.")]
public readonly string ReinforcementsArrivedSpeechNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display when entering the drop zone.")]
public readonly string ReinforcementsArrivedTextNotification = null;

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string ReadyAudio = null;
[TranslationReference(optional: true)]
[Desc("Text notification displayed when production is activated.")]
public readonly string ReadyTextNotification = null;
@@ -40,6 +41,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string BlockedAudio = null;
[TranslationReference(optional: true)]
[Desc("Text notification displayed when the exit is jammed.")]
public readonly string BlockedTextNotification = null;

View File

@@ -53,6 +53,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string DetectedSpeechNotification = null;
[TranslationReference(optional: true)]
public readonly string DetectedTextNotification = null;
public readonly string BeginChargeSound = null;
@@ -60,6 +61,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string BeginChargeSpeechNotification = null;
[TranslationReference(optional: true)]
public readonly string BeginChargeTextNotification = null;
public readonly string EndChargeSound = null;
@@ -67,6 +69,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string EndChargeSpeechNotification = null;
[TranslationReference(optional: true)]
public readonly string EndChargeTextNotification = null;
public readonly string SelectTargetSound = null;
@@ -74,6 +77,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string SelectTargetSpeechNotification = null;
[TranslationReference(optional: true)]
public readonly string SelectTargetTextNotification = null;
public readonly string InsufficientPowerSound = null;
@@ -81,6 +85,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string InsufficientPowerSpeechNotification = null;
[TranslationReference(optional: true)]
public readonly string InsufficientPowerTextNotification = null;
public readonly string LaunchSound = null;
@@ -88,6 +93,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string LaunchSpeechNotification = null;
[TranslationReference(optional: true)]
public readonly string LaunchTextNotification = null;
public readonly string IncomingSound = null;
@@ -95,6 +101,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string IncomingSpeechNotification = null;
[TranslationReference(optional: true)]
public readonly string IncomingTextNotification = null;
[Desc("Defines to which players the timer is shown.")]

View File

@@ -42,6 +42,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when transforming.")]
public readonly string TransformNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display when transforming.")]
public readonly string TransformTextNotification = null;
@@ -49,6 +50,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Speech notification to play when the transformation is blocked.")]
public readonly string NoTransformNotification = null;
[TranslationReference(optional: true)]
[Desc("Text notification to display when the transformation is blocked.")]
public readonly string NoTransformTextNotification = null;

View File

@@ -20,16 +20,19 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string Notification = "StartGame";
[TranslationReference(optional: true)]
public readonly string TextNotification = null;
[NotificationReference("Speech")]
public readonly string LoadedNotification = "GameLoaded";
[TranslationReference(optional: true)]
public readonly string LoadedTextNotification = null;
[NotificationReference("Speech")]
public readonly string SavedNotification = "GameSaved";
[TranslationReference(optional: true)]
public readonly string SavedTextNotification = null;
public override object Create(ActorInitializer init) { return new StartGameNotification(this); }

View File

@@ -316,7 +316,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (actionManager != null)
actionManager.Modified = false;
TextNotificationsManager.AddTransientLine(world.LocalPlayer, TranslationProvider.GetString(SaveCurrentMap));
TextNotificationsManager.AddTransientLine(world.LocalPlayer, SaveCurrentMap);
}
catch (Exception e)
{

View File

@@ -27,6 +27,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
public readonly string ClickSound = ChromeMetrics.Get<string>("ClickSound");
[TranslationReference("units")]
const string SelectedUnitsAcrossScreen = "selected-units-across-screen";
[TranslationReference("units")]
const string SelectedUnitsAcrossMap = "selected-units-across-map";
[ObjectCreator.UseCtor]
public SelectAllUnitsHotkeyLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
: base(widget, modData, "SelectAllUnitsKey", "WORLD_KEYHANDLER", logicArgs)
@@ -48,21 +54,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
// Check if selecting actors on the screen has selected new units
if (newSelection.Count > selection.Actors.Count())
{
if (newSelection.Count > 1)
TextNotificationsManager.AddFeedbackLine($"Selected {newSelection.Count} units across screen.");
else
TextNotificationsManager.AddFeedbackLine("Selected one unit across screen.");
}
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, Translation.Arguments("units", newSelection.Count));
else
{
// Select actors in the world that have highest selection priority
newSelection = SelectionUtils.SelectActorsInWorld(world, null, eligiblePlayers).SubsetWithHighestSelectionPriority(e.Modifiers).ToList();
if (newSelection.Count > 1)
TextNotificationsManager.AddFeedbackLine($"Selected {newSelection.Count} units across map.");
else
TextNotificationsManager.AddFeedbackLine("Selected one unit across map.");
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, Translation.Arguments("units", newSelection.Count));
}
selection.Combine(world, newSelection, false, false);

View File

@@ -29,6 +29,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
public readonly string ClickSound = ChromeMetrics.Get<string>("ClickSound");
public readonly string ClickDisabledSound = ChromeMetrics.Get<string>("ClickDisabledSound");
[TranslationReference]
const string NothingSelected = "nothing-selected";
[TranslationReference("units")]
const string SelectedUnitsAcrossScreen = "selected-units-across-screen";
[TranslationReference("units")]
const string SelectedUnitsAcrossMap = "selected-units-across-map";
[ObjectCreator.UseCtor]
public SelectUnitsByTypeHotkeyLogic(Widget widget, ModData modData, WorldRenderer worldRenderer, World world, Dictionary<string, MiniYaml> logicArgs)
: base(widget, modData, "SelectUnitsByTypeKey", "WORLD_KEYHANDLER", logicArgs)
@@ -45,7 +54,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
if (!selection.Actors.Any())
{
TextNotificationsManager.AddFeedbackLine("Nothing selected.");
TextNotificationsManager.AddFeedbackLine(NothingSelected);
Game.Sound.PlayNotification(world.Map.Rules, world.LocalPlayer, "Sounds", ClickDisabledSound, null);
return false;
@@ -70,21 +79,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
// Check if selecting actors on the screen has selected new units
if (newSelection.Count > selection.Actors.Count())
{
if (newSelection.Count > 1)
TextNotificationsManager.AddFeedbackLine($"Selected {newSelection.Count} units across screen.");
else
TextNotificationsManager.AddFeedbackLine("Selected one unit across screen.");
}
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, Translation.Arguments("units", newSelection.Count));
else
{
// Select actors in the world that have the same selection class as one of the already selected actors
newSelection = SelectionUtils.SelectActorsInWorld(world, selectedClasses, eligiblePlayers).ToList();
if (newSelection.Count > 1)
TextNotificationsManager.AddFeedbackLine($"Selected {newSelection.Count} units across map.");
else
TextNotificationsManager.AddFeedbackLine("Selected one unit across map.");
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, Translation.Arguments("units", newSelection.Count));
}
selection.Combine(world, newSelection, true, false);