Add localisation support to transient lines.

This commit is contained in:
Matthias Mailänder
2023-08-19 12:57:21 +02:00
committed by Gustas
parent 43d1a20d8c
commit 1899eed839
44 changed files with 95 additions and 82 deletions

View File

@@ -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();

View File

@@ -271,7 +271,7 @@ namespace OpenRA.Mods.Common.Activities
host.Actor.Owner.PlayerActor.TraitOrDefault<PlayerExperience>()?.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))

View File

@@ -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;

View File

@@ -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
{

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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)));

View File

@@ -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)
{

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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)));

View File

@@ -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)));

View File

@@ -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);

View File

@@ -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);
}
});
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}
});
}

View File

@@ -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;
}

View File

@@ -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)));

View File

@@ -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);
}
}
}

View File

@@ -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)

View File

@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -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);
}
}
}

View File

@@ -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);
}

View File

@@ -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<INotifySupportPower>())
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<CPos> CellsMatching(CPos location, char[] footprint, CVec dimensions)

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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);
}
}
}

View File

@@ -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)
{

View File

@@ -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);
}
}

View File

@@ -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));

View File

@@ -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();