From 1899eed839dc34408ae251ae842ce4bd8760d001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 19 Aug 2023 12:57:21 +0200 Subject: [PATCH] Add localisation support to transient lines. --- OpenRA.Game/TextNotificationsManager.cs | 20 +++++++++---------- OpenRA.Mods.Cnc/Activities/Infiltrate.cs | 2 +- .../Traits/Infiltration/InfiltrateForCash.cs | 4 ++-- .../Infiltration/InfiltrateForExploration.cs | 4 ++-- .../Infiltration/InfiltrateForPowerOutage.cs | 4 ++-- .../Infiltration/InfiltrateForSupportPower.cs | 4 ++-- .../InfiltrateForSupportPowerReset.cs | 4 ++-- OpenRA.Mods.Common/Activities/RepairBridge.cs | 2 +- OpenRA.Mods.Common/Activities/Resupply.cs | 4 ++-- OpenRA.Mods.Common/Activities/Sell.cs | 2 +- OpenRA.Mods.Common/Activities/Transform.cs | 2 +- .../Orders/PlaceBuildingOrderGenerator.cs | 4 ++-- .../Traits/Buildings/PrimaryBuilding.cs | 2 +- .../Traits/Buildings/ProductionAirdrop.cs | 2 +- .../Traits/Buildings/RallyPoint.cs | 2 +- .../Traits/Buildings/RepairableBuilding.cs | 4 ++-- .../Conditions/ToggleConditionOnOrder.cs | 4 ++-- .../Traits/Crates/CrateAction.cs | 2 +- OpenRA.Mods.Common/Traits/GainsExperience.cs | 2 +- .../Traits/Player/BaseAttackNotifier.cs | 4 ++-- .../Player/ConquestVictoryConditions.cs | 14 +++++++++---- .../Traits/Player/HarvesterAttackNotifier.cs | 2 +- .../Traits/Player/PlaceBuilding.cs | 2 +- .../Traits/Player/PlayerResources.cs | 2 +- .../Traits/Player/ProductionQueue.cs | 6 +++--- .../Traits/Player/ResourceStorageWarning.cs | 2 +- .../Player/StrategicVictoryConditions.cs | 14 +++++++++---- .../Traits/Power/Player/PowerManager.cs | 2 +- .../Traits/ProductionParadrop.cs | 2 +- .../Traits/Sound/ActorLostNotification.cs | 2 +- .../Traits/Sound/AnnounceOnSeen.cs | 2 +- .../Traits/Sound/CaptureNotification.cs | 4 ++-- .../Traits/SupportPowers/ParatroopersPower.cs | 2 +- .../Traits/SupportPowers/ProduceActorPower.cs | 4 ++-- .../Traits/SupportPowers/SpawnActorPower.cs | 2 +- .../Traits/SupportPowers/SupportPower.cs | 9 +++++---- .../SupportPowers/SupportPowerManager.cs | 2 +- OpenRA.Mods.Common/Traits/Transforms.cs | 2 +- .../Traits/World/StartGameNotification.cs | 6 +++--- .../Widgets/Logic/Editor/SaveMapLogic.cs | 2 +- .../Widgets/Logic/Ingame/IngameMenuLogic.cs | 2 +- .../Widgets/ProductionPaletteWidget.cs | 10 +++++----- .../Widgets/SupportPowersWidget.cs | 2 +- OpenRA.Mods.D2k/Activities/SwallowActor.cs | 2 +- 44 files changed, 95 insertions(+), 82 deletions(-) diff --git a/OpenRA.Game/TextNotificationsManager.cs b/OpenRA.Game/TextNotificationsManager.cs index eb2c880e4f..54c83890ab 100644 --- a/OpenRA.Game/TextNotificationsManager.cs +++ b/OpenRA.Game/TextNotificationsManager.cs @@ -32,18 +32,18 @@ namespace OpenRA SystemMessageLabel = "Battlefield Control"; } - public static void AddTransientLine(string text, Player player) + public static void AddTransientLine(Player player, string text) { if (string.IsNullOrEmpty(text)) return; if (player == null || player == player.World.LocalPlayer) - AddTextNotification(TextNotificationPool.Transients, SystemClientId, SystemMessageLabel, text); + AddTextNotification(TextNotificationPool.Transients, SystemClientId, SystemMessageLabel, TranslationProvider.GetString(text)); } - public static void AddFeedbackLine(string text) + public static void AddFeedbackLine(string text, Dictionary arguments = null) { - AddTextNotification(TextNotificationPool.Feedback, SystemClientId, SystemMessageLabel, text); + AddTextNotification(TextNotificationPool.Feedback, SystemClientId, SystemMessageLabel, TranslationProvider.GetString(text, arguments)); } public static void AddMissionLine(string prefix, string text, Color? prefixColor = null) @@ -51,19 +51,19 @@ namespace OpenRA AddTextNotification(TextNotificationPool.Mission, SystemClientId, prefix, text, prefixColor); } - public static void AddPlayerJoinedLine(string text) + public static void AddPlayerJoinedLine(string text, Dictionary arguments = null) { - AddTextNotification(TextNotificationPool.Join, SystemClientId, SystemMessageLabel, text); + AddTextNotification(TextNotificationPool.Join, SystemClientId, SystemMessageLabel, TranslationProvider.GetString(text, arguments)); } - public static void AddPlayerLeftLine(string text) + public static void AddPlayerLeftLine(string text, Dictionary arguments = null) { - AddTextNotification(TextNotificationPool.Leave, SystemClientId, SystemMessageLabel, text); + AddTextNotification(TextNotificationPool.Leave, SystemClientId, SystemMessageLabel, TranslationProvider.GetString(text, arguments)); } - public static void AddSystemLine(string text) + public static void AddSystemLine(string text, Dictionary arguments = null) { - AddSystemLine(SystemMessageLabel, text); + AddSystemLine(SystemMessageLabel, TranslationProvider.GetString(text, arguments)); } public static void AddSystemLine(string prefix, string text) diff --git a/OpenRA.Mods.Cnc/Activities/Infiltrate.cs b/OpenRA.Mods.Cnc/Activities/Infiltrate.cs index 724998b3f1..d0302a4fc8 100644 --- a/OpenRA.Mods.Cnc/Activities/Infiltrate.cs +++ b/OpenRA.Mods.Cnc/Activities/Infiltrate.cs @@ -68,7 +68,7 @@ namespace OpenRA.Mods.Cnc.Activities Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", infiltrates.Info.Notification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(infiltrates.Info.TextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, infiltrates.Info.TextNotification); if (infiltrates.Info.EnterBehaviour == EnterBehaviour.Dispose) self.Dispose(); diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs index 30d7e9d5e3..0b93c6b3e7 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs @@ -88,8 +88,8 @@ namespace OpenRA.Mods.Cnc.Traits if (info.InfiltrationNotification != null) Game.Sound.PlayNotification(self.World.Map.Rules, infiltrator.Owner, "Speech", info.InfiltrationNotification, infiltrator.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.InfiltratedTextNotification, self.Owner); - TextNotificationsManager.AddTransientLine(info.InfiltrationTextNotification, infiltrator.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.InfiltratedTextNotification); + TextNotificationsManager.AddTransientLine(infiltrator.Owner, info.InfiltrationTextNotification); if (info.ShowTicks) self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, infiltrator.Owner.Color, FloatingText.FormatCashTick(toGive), 30))); diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs index 23e8037bcc..d74e005bfb 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs @@ -62,8 +62,8 @@ namespace OpenRA.Mods.Cnc.Traits if (info.InfiltrationNotification != null) Game.Sound.PlayNotification(self.World.Map.Rules, infiltrator.Owner, "Speech", info.InfiltrationNotification, infiltrator.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.InfiltratedTextNotification, self.Owner); - TextNotificationsManager.AddTransientLine(info.InfiltrationTextNotification, infiltrator.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.InfiltratedTextNotification); + TextNotificationsManager.AddTransientLine(infiltrator.Owner, info.InfiltrationTextNotification); infiltrator.Owner.PlayerActor.TraitOrDefault()?.GiveExperience(info.PlayerExperience); diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs index 90f42e5c58..a6257bda86 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs @@ -65,8 +65,8 @@ namespace OpenRA.Mods.Cnc.Traits if (info.InfiltrationNotification != null) Game.Sound.PlayNotification(self.World.Map.Rules, infiltrator.Owner, "Speech", info.InfiltrationNotification, infiltrator.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.InfiltratedTextNotification, self.Owner); - TextNotificationsManager.AddTransientLine(info.InfiltrationTextNotification, infiltrator.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.InfiltratedTextNotification); + TextNotificationsManager.AddTransientLine(infiltrator.Owner, info.InfiltrationTextNotification); infiltrator.Owner.PlayerActor.TraitOrDefault()?.GiveExperience(info.PlayerExperience); diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs index db51bbd950..e850f7fd42 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs @@ -64,8 +64,8 @@ namespace OpenRA.Mods.Cnc.Traits if (info.InfiltrationNotification != null) Game.Sound.PlayNotification(self.World.Map.Rules, infiltrator.Owner, "Speech", info.InfiltrationNotification, infiltrator.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.InfiltratedTextNotification, self.Owner); - TextNotificationsManager.AddTransientLine(info.InfiltrationTextNotification, infiltrator.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.InfiltratedTextNotification); + TextNotificationsManager.AddTransientLine(infiltrator.Owner, info.InfiltrationTextNotification); infiltrator.Owner.PlayerActor.TraitOrDefault()?.GiveExperience(info.PlayerExperience); diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPowerReset.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPowerReset.cs index 14d21e3ad9..7003d73bd4 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPowerReset.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPowerReset.cs @@ -61,8 +61,8 @@ namespace OpenRA.Mods.Cnc.Traits if (info.InfiltrationNotification != null) Game.Sound.PlayNotification(self.World.Map.Rules, infiltrator.Owner, "Speech", info.InfiltrationNotification, infiltrator.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.InfiltratedTextNotification, self.Owner); - TextNotificationsManager.AddTransientLine(info.InfiltrationTextNotification, infiltrator.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.InfiltratedTextNotification); + TextNotificationsManager.AddTransientLine(infiltrator.Owner, info.InfiltrationTextNotification); infiltrator.Owner.PlayerActor.TraitOrDefault()?.GiveExperience(info.PlayerExperience); diff --git a/OpenRA.Mods.Common/Activities/RepairBridge.cs b/OpenRA.Mods.Common/Activities/RepairBridge.cs index d5348a6c6b..eb84369c98 100644 --- a/OpenRA.Mods.Common/Activities/RepairBridge.cs +++ b/OpenRA.Mods.Common/Activities/RepairBridge.cs @@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Activities enterHut?.Repair(self); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", speechNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(textNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, textNotification); if (enterBehaviour == EnterBehaviour.Dispose) self.Dispose(); diff --git a/OpenRA.Mods.Common/Activities/Resupply.cs b/OpenRA.Mods.Common/Activities/Resupply.cs index 18f223d966..f8316f08ed 100644 --- a/OpenRA.Mods.Common/Activities/Resupply.cs +++ b/OpenRA.Mods.Common/Activities/Resupply.cs @@ -271,7 +271,7 @@ namespace OpenRA.Mods.Common.Activities host.Actor.Owner.PlayerActor.TraitOrDefault()?.GiveExperience(repairsUnits.Info.PlayerExperience); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.Info.FinishRepairingNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(repairsUnits.Info.FinishRepairingTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, repairsUnits.Info.FinishRepairingTextNotification); activeResupplyTypes &= ~ResupplyType.Repair; return; @@ -289,7 +289,7 @@ namespace OpenRA.Mods.Common.Activities { played = true; Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.Info.StartRepairingNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(repairsUnits.Info.StartRepairingTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, repairsUnits.Info.StartRepairingTextNotification); } if (!playerResources.TakeCash(cost, true)) diff --git a/OpenRA.Mods.Common/Activities/Sell.cs b/OpenRA.Mods.Common/Activities/Sell.cs index ed718a0fde..825aabebc0 100644 --- a/OpenRA.Mods.Common/Activities/Sell.cs +++ b/OpenRA.Mods.Common/Activities/Sell.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Activities self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, self.Owner.Color, FloatingText.FormatCashTick(refund), 30))); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", sellableInfo.Notification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(sellableInfo.TextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, sellableInfo.TextNotification); self.Dispose(); return false; diff --git a/OpenRA.Mods.Common/Activities/Transform.cs b/OpenRA.Mods.Common/Activities/Transform.cs index 4fc833df4c..dd78143d3a 100644 --- a/OpenRA.Mods.Common/Activities/Transform.cs +++ b/OpenRA.Mods.Common/Activities/Transform.cs @@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Activities Game.Sound.PlayToPlayer(SoundType.World, self.Owner, s, self.CenterPosition); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Notification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(TextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, TextNotification); var init = new TypeDictionary { diff --git a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs index 1cb4d5fefc..dea3ee3526 100644 --- a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs @@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Orders if (!AcceptsPlug(topLeft, plugInfo)) { Game.Sound.PlayNotification(world.Map.Rules, owner, "Speech", notification, owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(placeBuildingInfo.CannotPlaceTextNotification, owner); + TextNotificationsManager.AddTransientLine(owner, placeBuildingInfo.CannotPlaceTextNotification); yield break; } @@ -196,7 +196,7 @@ namespace OpenRA.Mods.Common.Orders yield return order; Game.Sound.PlayNotification(world.Map.Rules, owner, "Speech", notification, owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(placeBuildingInfo.CannotPlaceTextNotification, owner); + TextNotificationsManager.AddTransientLine(owner, placeBuildingInfo.CannotPlaceTextNotification); yield break; } diff --git a/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs index 5cd40b1790..e5a46f193d 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/PrimaryBuilding.cs @@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Traits primaryToken = self.GrantCondition(Info.PrimaryCondition); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.SelectionNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.SelectionTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.SelectionTextNotification); } else if (primaryToken != Actor.InvalidConditionToken) primaryToken = self.RevokeCondition(primaryToken); diff --git a/OpenRA.Mods.Common/Traits/Buildings/ProductionAirdrop.cs b/OpenRA.Mods.Common/Traits/Buildings/ProductionAirdrop.cs index 3139c09bf3..eac0cceb68 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/ProductionAirdrop.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/ProductionAirdrop.cs @@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Traits self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit, productionType, inits)); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.ReadyTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.ReadyTextNotification); })); actor.QueueActivity(new FlyOffMap(actor, Target.FromCell(w, endPos))); diff --git a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs index 90c50377e5..d4fbb43f1e 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs @@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits if (order.OrderID == OrderID) { Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.Notification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.TextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.TextNotification); return new Order(order.OrderID, self, target, queued) { diff --git a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs index b678ecfbd0..60635315f9 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs @@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits if (!Repairers.Any()) { Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", Info.RepairingStoppedNotification, player.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.RepairingStoppedTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.RepairingStoppedTextNotification); } return; @@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits Repairers.Add(player); Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", Info.RepairingNotification, player.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.RepairingTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.RepairingTextNotification); UpdateCondition(self); } diff --git a/OpenRA.Mods.Common/Traits/Conditions/ToggleConditionOnOrder.cs b/OpenRA.Mods.Common/Traits/Conditions/ToggleConditionOnOrder.cs index 488923c048..eaeaab0904 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ToggleConditionOnOrder.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ToggleConditionOnOrder.cs @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits if (Info.EnabledSpeech != null) Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.EnabledSpeech, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.EnabledTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.EnabledTextNotification); } else if (!granted && conditionToken != Actor.InvalidConditionToken) { @@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits if (Info.DisabledSpeech != null) Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.DisabledSpeech, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.DisabledTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.DisabledTextNotification); } } diff --git a/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs index de6e38bb6f..f0f1d01666 100644 --- a/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs @@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits Game.Sound.PlayNotification(self.World.Map.Rules, collector.Owner, "Speech", Info.Notification, collector.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.TextNotification, collector.Owner); + TextNotificationsManager.AddTransientLine(collector.Owner, Info.TextNotification); if (Info.Image != null && Info.Sequence != null) collector.World.AddFrameEndTask(w => w.Add(new SpriteEffect(collector, w, Info.Image, Info.Sequence, Info.Palette))); diff --git a/OpenRA.Mods.Common/Traits/GainsExperience.cs b/OpenRA.Mods.Common/Traits/GainsExperience.cs index 4f3a8cbd8f..1ec2c35485 100644 --- a/OpenRA.Mods.Common/Traits/GainsExperience.cs +++ b/OpenRA.Mods.Common/Traits/GainsExperience.cs @@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Traits if (!silent) { Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", info.LevelUpNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.LevelUpTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.LevelUpTextNotification); if (info.LevelUpImage != null && info.LevelUpSequence != null) self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(self, w, info.LevelUpImage, info.LevelUpSequence, info.LevelUpPalette))); diff --git a/OpenRA.Mods.Common/Traits/Player/BaseAttackNotifier.cs b/OpenRA.Mods.Common/Traits/Player/BaseAttackNotifier.cs index 4c61c0e451..c9c5342f6a 100644 --- a/OpenRA.Mods.Common/Traits/Player/BaseAttackNotifier.cs +++ b/OpenRA.Mods.Common/Traits/Player/BaseAttackNotifier.cs @@ -89,12 +89,12 @@ namespace OpenRA.Mods.Common.Traits if (self.Owner == localPlayer) { Game.Sound.PlayNotification(rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.TextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.TextNotification); } else if (localPlayer.IsAlliedWith(self.Owner) && localPlayer != e.Attacker.Owner) { Game.Sound.PlayNotification(rules, localPlayer, "Speech", info.AllyNotification, localPlayer.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.AllyTextNotification, localPlayer); + TextNotificationsManager.AddTransientLine(localPlayer, info.AllyTextNotification); } radarPings?.Add(() => self.Owner.IsAlliedWith(self.World.RenderPlayer), self.CenterPosition, info.RadarPingColor, info.RadarPingDuration); diff --git a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs index d28785dd29..51811a7f7e 100644 --- a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs @@ -32,6 +32,12 @@ namespace OpenRA.Mods.Common.Traits public class ConquestVictoryConditions : ITick, INotifyWinStateChanged, INotifyTimeLimit { + [TranslationReference("player")] + const string PlayerIsVictorious = "notification-player-is-victorious"; + + [TranslationReference("player")] + const string PlayerIsDefeated = "notification-player-is-defeated"; + readonly ConquestVictoryConditionsInfo info; readonly MissionObjectives mo; readonly bool shortGame; @@ -98,13 +104,13 @@ namespace OpenRA.Mods.Common.Traits if (info.SuppressNotifications) return; - TextNotificationsManager.AddSystemLine(player.PlayerName + " is defeated."); + TextNotificationsManager.AddSystemLine(PlayerIsDefeated, Translation.Arguments("player", player.PlayerName)); Game.RunAfterDelay(info.NotificationDelay, () => { if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer) { Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", mo.Info.LoseNotification, player.Faction.InternalName); - TextNotificationsManager.AddTransientLine(mo.Info.LoseTextNotification, player); + TextNotificationsManager.AddTransientLine(player, mo.Info.LoseTextNotification); } }); } @@ -114,13 +120,13 @@ namespace OpenRA.Mods.Common.Traits if (info.SuppressNotifications) return; - TextNotificationsManager.AddSystemLine(player.PlayerName + " is victorious."); + TextNotificationsManager.AddSystemLine(PlayerIsVictorious, Translation.Arguments("player", player.PlayerName)); Game.RunAfterDelay(info.NotificationDelay, () => { if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer) { Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", mo.Info.WinNotification, player.Faction.InternalName); - TextNotificationsManager.AddTransientLine(mo.Info.WinTextNotification, player); + TextNotificationsManager.AddTransientLine(player, mo.Info.WinTextNotification); } }); } diff --git a/OpenRA.Mods.Common/Traits/Player/HarvesterAttackNotifier.cs b/OpenRA.Mods.Common/Traits/Player/HarvesterAttackNotifier.cs index ccd2d4c753..ab46a32f83 100644 --- a/OpenRA.Mods.Common/Traits/Player/HarvesterAttackNotifier.cs +++ b/OpenRA.Mods.Common/Traits/Player/HarvesterAttackNotifier.cs @@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits if (Game.RunTime > lastAttackTime + info.NotifyInterval) { Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.TextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.TextNotification); radarPings?.Add(() => self.Owner.IsAlliedWith(self.World.RenderPlayer), self.CenterPosition, info.RadarPingColor, info.RadarPingDuration); diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index f4b60d2b14..e38127394f 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -230,7 +230,7 @@ namespace OpenRA.Mods.Common.Traits void PlayNotification(Actor self) { Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.NewOptionsNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.NewOptionsTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.NewOptionsTextNotification); triggerNotification = false; tick = 0; diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs index cd5052bd64..5f454d82fa 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs @@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Traits { lastNotificationTime = Game.RunTime; Game.Sound.PlayNotification(owner.World.Map.Rules, owner, "Speech", Info.InsufficientFundsNotification, owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.InsufficientFundsTextNotification, owner); + TextNotificationsManager.AddTransientLine(owner, Info.InsufficientFundsTextNotification); } return false; diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index 08e8820f7e..063260b5f7 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -449,19 +449,19 @@ namespace OpenRA.Mods.Common.Traits if (isBuilding && !hasPlayedSound) { hasPlayedSound = Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.ReadyTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.ReadyTextNotification); } else if (!isBuilding) { if (BuildUnit(unit)) { Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.ReadyTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.ReadyTextNotification); } else if (!hasPlayedSound && time > 0) { hasPlayedSound = Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.BlockedTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.BlockedTextNotification); } } })), !order.Queued); diff --git a/OpenRA.Mods.Common/Traits/Player/ResourceStorageWarning.cs b/OpenRA.Mods.Common/Traits/Player/ResourceStorageWarning.cs index 625b9f8f49..d1f658165c 100644 --- a/OpenRA.Mods.Common/Traits/Player/ResourceStorageWarning.cs +++ b/OpenRA.Mods.Common/Traits/Player/ResourceStorageWarning.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits if (resources.Resources > info.Threshold * resources.ResourceCapacity / 100) { Game.Sound.PlayNotification(self.World.Map.Rules, owner, "Speech", info.Notification, owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.TextNotification, owner); + TextNotificationsManager.AddTransientLine(owner, info.TextNotification); } lastSiloAdviceTime = Game.RunTime; diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index 1894e6fe4f..ab89be038d 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -46,6 +46,12 @@ namespace OpenRA.Mods.Common.Traits public class StrategicVictoryConditions : ITick, ISync, INotifyWinStateChanged, INotifyTimeLimit { + [TranslationReference("player")] + const string PlayerIsVictorious = "notification-player-is-victorious"; + + [TranslationReference("player")] + const string PlayerIsDefeated = "notification-player-is-defeated"; + readonly StrategicVictoryConditionsInfo info; [Sync] @@ -136,13 +142,13 @@ namespace OpenRA.Mods.Common.Traits if (info.SuppressNotifications) return; - TextNotificationsManager.AddSystemLine(player.PlayerName + " is defeated."); + TextNotificationsManager.AddSystemLine(PlayerIsDefeated, Translation.Arguments("player", player.PlayerName)); Game.RunAfterDelay(info.NotificationDelay, () => { if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer) { Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", mo.Info.LoseNotification, player.Faction.InternalName); - TextNotificationsManager.AddTransientLine(mo.Info.LoseTextNotification, player); + TextNotificationsManager.AddTransientLine(player, mo.Info.LoseTextNotification); } }); } @@ -152,13 +158,13 @@ namespace OpenRA.Mods.Common.Traits if (info.SuppressNotifications) return; - TextNotificationsManager.AddSystemLine(player.PlayerName + " is victorious."); + TextNotificationsManager.AddSystemLine(PlayerIsVictorious, Translation.Arguments("player", player.PlayerName)); Game.RunAfterDelay(info.NotificationDelay, () => { if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer) { Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", mo.Info.WinNotification, player.Faction.InternalName); - TextNotificationsManager.AddTransientLine(mo.Info.WinTextNotification, player); + TextNotificationsManager.AddTransientLine(player, mo.Info.WinTextNotification); } }); } diff --git a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs index 6e95ffcea0..60f5d69a13 100644 --- a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs +++ b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs @@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Traits if (PlayLowPowerNotification && isLowPower && Game.RunTime > lastPowerAdviceTime + info.AdviceInterval) { Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.SpeechNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.TextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.TextNotification); lastPowerAdviceTime = Game.RunTime; } diff --git a/OpenRA.Mods.Common/Traits/ProductionParadrop.cs b/OpenRA.Mods.Common/Traits/ProductionParadrop.cs index 2905c49e9b..9d0767fbd0 100644 --- a/OpenRA.Mods.Common/Traits/ProductionParadrop.cs +++ b/OpenRA.Mods.Common/Traits/ProductionParadrop.cs @@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit?.Info, productionType, inits)); Game.Sound.Play(SoundType.World, info.ChuteSound, self.CenterPosition); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.ReadyTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.ReadyTextNotification); })); actor.QueueActivity(new Fly(actor, Target.FromCell(w, endPos))); diff --git a/OpenRA.Mods.Common/Traits/Sound/ActorLostNotification.cs b/OpenRA.Mods.Common/Traits/Sound/ActorLostNotification.cs index c8b1e9da9f..ba81e2a5c5 100644 --- a/OpenRA.Mods.Common/Traits/Sound/ActorLostNotification.cs +++ b/OpenRA.Mods.Common/Traits/Sound/ActorLostNotification.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits.Sound var player = Info.NotifyAll ? localPlayer : self.Owner; Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", Info.Notification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.TextNotification, player); + TextNotificationsManager.AddTransientLine(player, Info.TextNotification); } } } diff --git a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnSeen.cs b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnSeen.cs index af0fb39322..cc96127851 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnSeen.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnSeen.cs @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits.Sound Game.Sound.PlayNotification(self.World.Map.Rules, discoverer, "Speech", Info.Notification, discoverer.Faction.InternalName); if (discoverer != null) - TextNotificationsManager.AddTransientLine(Info.TextNotification, discoverer); + TextNotificationsManager.AddTransientLine(discoverer, Info.TextNotification); // Radar notification if (Info.PingRadar) diff --git a/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs b/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs index e3d9de40f1..dff1364a72 100644 --- a/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs +++ b/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs @@ -51,11 +51,11 @@ namespace OpenRA.Mods.Common.Traits.Sound { var faction = info.NewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName; Game.Sound.PlayNotification(self.World.Map.Rules, newOwner, "Speech", info.Notification, faction); - TextNotificationsManager.AddTransientLine(info.TextNotification, newOwner); + TextNotificationsManager.AddTransientLine(newOwner, info.TextNotification); var loseFaction = info.LoseNewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName; Game.Sound.PlayNotification(self.World.Map.Rules, oldOwner, "Speech", info.LoseNotification, loseFaction); - TextNotificationsManager.AddTransientLine(info.LoseTextNotification, oldOwner); + TextNotificationsManager.AddTransientLine(oldOwner, info.LoseTextNotification); } } } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs index 76ceac8a00..3ece219667 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs @@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.Traits Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReinforcementsArrivedSpeechNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.ReinforcementsArrivedTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, info.ReinforcementsArrivedTextNotification); } aircraftInRange[a] = true; diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/ProduceActorPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/ProduceActorPower.cs index 49d949d14d..4108f22dc4 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/ProduceActorPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/ProduceActorPower.cs @@ -99,12 +99,12 @@ namespace OpenRA.Mods.Common.Traits if (activated) { Game.Sound.PlayNotification(self.World.Map.Rules, manager.Self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.ReadyTextNotification, manager.Self.Owner); + TextNotificationsManager.AddTransientLine(manager.Self.Owner, info.ReadyTextNotification); } else { Game.Sound.PlayNotification(self.World.Map.Rules, manager.Self.Owner, "Speech", info.BlockedAudio, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.BlockedTextNotification, manager.Self.Owner); + TextNotificationsManager.AddTransientLine(manager.Self.Owner, info.BlockedTextNotification); } } } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs index a1906aa28b..737f1fbada 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs @@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Traits Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.SelectTargetSpeechNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.SelectTargetTextNotification, manager.Self.Owner); + TextNotificationsManager.AddTransientLine(manager.Self.Owner, Info.SelectTargetTextNotification); self.World.OrderGenerator = new SelectSpawnActorPowerTarget(order, manager, this, MouseButton.Left); } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index a5ca13b3ea..3868d066a0 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -166,7 +166,7 @@ namespace OpenRA.Mods.Common.Traits { Game.Sound.Play(SoundType.UI, Info.DetectedSound); Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.DetectedSpeechNotification, player.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.DetectedTextNotification, player); + TextNotificationsManager.AddTransientLine(player, info.DetectedTextNotification); } } @@ -181,7 +181,7 @@ namespace OpenRA.Mods.Common.Traits Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BeginChargeSpeechNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.BeginChargeTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.BeginChargeTextNotification); } public virtual void Charged(Actor self, string key) @@ -190,7 +190,7 @@ namespace OpenRA.Mods.Common.Traits Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.EndChargeSpeechNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.EndChargeTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.EndChargeTextNotification); foreach (var notify in self.TraitsImplementing()) notify.Charged(self); @@ -228,7 +228,8 @@ namespace OpenRA.Mods.Common.Traits var speech = isAllied ? Info.LaunchSpeechNotification : Info.IncomingSpeechNotification; Game.Sound.PlayNotification(Self.World.Map.Rules, localPlayer, "Speech", speech, localPlayer.Faction.InternalName); - TextNotificationsManager.AddTransientLine(isAllied ? Info.LaunchTextNotification : Info.IncomingTextNotification, localPlayer); + var text = isAllied ? Info.LaunchTextNotification : Info.IncomingTextNotification; + TextNotificationsManager.AddTransientLine(localPlayer, text); } public IEnumerable CellsMatching(CPos location, char[] footprint, CVec dimensions) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index 09bed55e25..987200a515 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -231,7 +231,7 @@ namespace OpenRA.Mods.Common.Traits Game.Sound.PlayNotification(power.Self.World.Map.Rules, power.Self.Owner, "Speech", Info.SelectTargetSpeechNotification, power.Self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.SelectTargetTextNotification, power.Self.Owner); + TextNotificationsManager.AddTransientLine(power.Self.Owner, Info.SelectTargetTextNotification); power.SelectTarget(power.Self, Key, Manager); } diff --git a/OpenRA.Mods.Common/Traits/Transforms.cs b/OpenRA.Mods.Common/Traits/Transforms.cs index a4ea0e661b..102475942d 100644 --- a/OpenRA.Mods.Common/Traits/Transforms.cs +++ b/OpenRA.Mods.Common/Traits/Transforms.cs @@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Traits Game.Sound.PlayToPlayer(SoundType.World, self.Owner, s); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.NoTransformNotification, self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(Info.NoTransformTextNotification, self.Owner); + TextNotificationsManager.AddTransientLine(self.Owner, Info.NoTransformTextNotification); return; } diff --git a/OpenRA.Mods.Common/Traits/World/StartGameNotification.cs b/OpenRA.Mods.Common/Traits/World/StartGameNotification.cs index 23aa00495d..006275bb08 100644 --- a/OpenRA.Mods.Common/Traits/World/StartGameNotification.cs +++ b/OpenRA.Mods.Common/Traits/World/StartGameNotification.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits if (!world.IsLoadingGameSave) { Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.Notification, world.RenderPlayer?.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.TextNotification, null); + TextNotificationsManager.AddTransientLine(null, info.TextNotification); } } @@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits if (!world.IsReplay) { Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.LoadedNotification, world.RenderPlayer?.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.LoadedTextNotification, null); + TextNotificationsManager.AddTransientLine(null, info.LoadedTextNotification); } } @@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits if (!world.IsReplay) { Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.SavedNotification, world.RenderPlayer?.Faction.InternalName); - TextNotificationsManager.AddTransientLine(info.SavedTextNotification, null); + TextNotificationsManager.AddTransientLine(null, info.SavedTextNotification); } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs index ee589fbb36..e6987344d1 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs @@ -316,7 +316,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (actionManager != null) actionManager.Modified = false; - TextNotificationsManager.AddTransientLine(TranslationProvider.GetString(SaveCurrentMap), world.LocalPlayer); + TextNotificationsManager.AddTransientLine(world.LocalPlayer, TranslationProvider.GetString(SaveCurrentMap)); } catch (Exception e) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs index 3c22f8f10b..6e441d8cf5 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs @@ -217,7 +217,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var faction = world.LocalPlayer?.Faction.InternalName; Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", moi.LeaveNotification, faction); - TextNotificationsManager.AddTransientLine(moi.LeaveTextNotification, null); + TextNotificationsManager.AddTransientLine(null, moi.LeaveTextNotification); } } diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index f16d644337..de6e84d3c6 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -324,7 +324,7 @@ namespace OpenRA.Mods.Common.Widgets // Resume a paused item Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null); Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Faction.InternalName); - TextNotificationsManager.AddTransientLine(CurrentQueue.Info.QueuedTextNotification, World.LocalPlayer); + TextNotificationsManager.AddTransientLine(World.LocalPlayer, CurrentQueue.Info.QueuedTextNotification); World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, false)); return true; @@ -341,7 +341,7 @@ namespace OpenRA.Mods.Common.Widgets if (!CurrentQueue.AllQueued().Any()) { Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", notification, World.LocalPlayer.Faction.InternalName); - TextNotificationsManager.AddTransientLine(textNotification, World.LocalPlayer); + TextNotificationsManager.AddTransientLine(World.LocalPlayer, textNotification); } if (canQueue) @@ -366,7 +366,7 @@ namespace OpenRA.Mods.Common.Widgets { // Instantly cancel items that haven't started, have finished, or if the queue doesn't support pausing Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Faction.InternalName); - TextNotificationsManager.AddTransientLine(CurrentQueue.Info.CancelledTextNotification, World.LocalPlayer); + TextNotificationsManager.AddTransientLine(World.LocalPlayer, CurrentQueue.Info.CancelledTextNotification); World.IssueOrder(Order.CancelProduction(CurrentQueue.Actor, icon.Name, handleCount)); } @@ -374,7 +374,7 @@ namespace OpenRA.Mods.Common.Widgets { // Pause an existing item Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.OnHoldAudio, World.LocalPlayer.Faction.InternalName); - TextNotificationsManager.AddTransientLine(CurrentQueue.Info.OnHoldTextNotification, World.LocalPlayer); + TextNotificationsManager.AddTransientLine(World.LocalPlayer, CurrentQueue.Info.OnHoldTextNotification); World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, true)); } @@ -390,7 +390,7 @@ namespace OpenRA.Mods.Common.Widgets // Directly cancel, skipping "on-hold" Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null); Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Faction.InternalName); - TextNotificationsManager.AddTransientLine(CurrentQueue.Info.CancelledTextNotification, World.LocalPlayer); + TextNotificationsManager.AddTransientLine(World.LocalPlayer, CurrentQueue.Info.CancelledTextNotification); World.IssueOrder(Order.CancelProduction(CurrentQueue.Actor, icon.Name, handleCount)); diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs index eefe286546..f44c1869dd 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs @@ -174,7 +174,7 @@ namespace OpenRA.Mods.Common.Widgets Game.Sound.PlayNotification(spm.Self.World.Map.Rules, spm.Self.Owner, "Speech", clicked.Power.Info.InsufficientPowerSpeechNotification, spm.Self.Owner.Faction.InternalName); - TextNotificationsManager.AddTransientLine(clicked.Power.Info.InsufficientPowerTextNotification, spm.Self.Owner); + TextNotificationsManager.AddTransientLine(spm.Self.Owner, clicked.Power.Info.InsufficientPowerTextNotification); } else clicked.Power.Target(); diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index 57325f920b..9ab4ef94df 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -83,7 +83,7 @@ namespace OpenRA.Mods.D2k.Activities self.World.AddFrameEndTask(w => w.Add(new MapNotificationEffect(player, "Speech", swallow.Info.WormAttackNotification, 25, true, attackPosition, Color.Red))); if (affectedPlayers.Contains(self.World.LocalPlayer)) - TextNotificationsManager.AddTransientLine(swallow.Info.WormAttackTextNotification, self.World.LocalPlayer); + TextNotificationsManager.AddTransientLine(self.World.LocalPlayer, swallow.Info.WormAttackTextNotification); var barrel = armament.CheckFire(self, facing, target); if (barrel == null)