Add support for transient text notifications matching speech notifications

This commit is contained in:
Ivaylo Draganov
2022-01-08 18:28:25 +02:00
committed by Paul Chote
parent 9f723be65a
commit 24b9482cc1
50 changed files with 372 additions and 46 deletions

View File

@@ -28,15 +28,21 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Type = null;
[NotificationReference("Speech")]
[Desc("Notification played when production is activated.",
[Desc("Speech notification played when production is activated.",
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string ReadyAudio = null;
[Desc("Text notification displayed when production is activated.")]
public readonly string ReadyTextNotification = null;
[NotificationReference("Speech")]
[Desc("Notification played when the exit is jammed.",
[Desc("Speech notification played when the exit is jammed.",
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string BlockedAudio = null;
[Desc("Text notification displayed when the exit is jammed.")]
public readonly string BlockedTextNotification = null;
public override object Create(ActorInitializer init) { return new ProduceActorPower(init, this); }
}
@@ -91,9 +97,15 @@ 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);
}
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);
}
}
}
}