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

@@ -31,12 +31,16 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string EnabledSpeech = null;
public readonly string EnabledTextNotification = null;
[NotificationReference("Sounds")]
public readonly string DisabledSound = null;
[NotificationReference("Speech")]
public readonly string DisabledSpeech = null;
public readonly string DisabledTextNotification = null;
public override object Create(ActorInitializer init) { return new ToggleConditionOnOrder(this); }
}
@@ -62,6 +66,8 @@ 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);
}
else if (!granted && conditionToken != Actor.InvalidConditionToken)
{
@@ -72,6 +78,8 @@ 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);
}
}