Add support for transient text notifications matching speech notifications
This commit is contained in:
committed by
Paul Chote
parent
9f723be65a
commit
24b9482cc1
@@ -34,9 +34,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string PrimaryCondition = null;
|
||||
|
||||
[NotificationReference("Speech")]
|
||||
[Desc("The speech notification to play when selecting a primary building.")]
|
||||
[Desc("Speech notification to play when selecting a primary building.")]
|
||||
public readonly string SelectionNotification = null;
|
||||
|
||||
[Desc("Text notification to display when selecting a primary building.")]
|
||||
public readonly string SelectionTextNotification = null;
|
||||
|
||||
[Desc("List of production queues for which the primary flag should be set.",
|
||||
"If empty, the list given in the `Produces` property of the `" + nameof(Production) + "` trait will be used.")]
|
||||
public readonly string[] ProductionQueues = Array.Empty<string>();
|
||||
@@ -113,6 +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);
|
||||
}
|
||||
else if (primaryToken != Actor.InvalidConditionToken)
|
||||
primaryToken = self.RevokeCondition(primaryToken);
|
||||
|
||||
@@ -21,8 +21,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class ProductionAirdropInfo : ProductionInfo
|
||||
{
|
||||
[NotificationReference("Speech")]
|
||||
[Desc("Speech notification to play when a unit is delivered.")]
|
||||
public readonly string ReadyAudio = "Reinforce";
|
||||
|
||||
[Desc("Text notification to display when a unit is delivered.")]
|
||||
public readonly string ReadyTextNotification = null;
|
||||
|
||||
[FieldLoader.Require]
|
||||
[ActorReference(typeof(AircraftInfo))]
|
||||
[Desc("Cargo aircraft used for delivery. Must have the `" + nameof(Aircraft) + "` trait.")]
|
||||
@@ -112,6 +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);
|
||||
}));
|
||||
|
||||
actor.QueueActivity(new FlyOffMap(actor, Target.FromCell(w, endPos)));
|
||||
|
||||
@@ -46,9 +46,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly CVec[] Path = Array.Empty<CVec>();
|
||||
|
||||
[NotificationReference("Speech")]
|
||||
[Desc("The speech notification to play when setting a new rallypoint.")]
|
||||
[Desc("Speech notification to play when setting a new rallypoint.")]
|
||||
public readonly string Notification = null;
|
||||
|
||||
[Desc("Text notification to display when setting a new rallypoint.")]
|
||||
public readonly string TextNotification = null;
|
||||
|
||||
[Desc("Used to group equivalent actors to allow force-setting a rallypoint (e.g. for Primary production).")]
|
||||
public readonly string ForceSetType = null;
|
||||
|
||||
@@ -101,6 +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);
|
||||
|
||||
return new Order(order.OrderID, self, target, queued)
|
||||
{
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[NotificationReference("Speech")]
|
||||
public readonly string RepairingNotification = null;
|
||||
|
||||
public readonly string RepairingTextNotification = null;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new RepairableBuilding(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -111,7 +113,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
Repairers.Add(player);
|
||||
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", Info.RepairingNotification, player.Faction.InternalName);
|
||||
TextNotificationsManager.AddTransientLine(Info.RepairingTextNotification, self.Owner);
|
||||
|
||||
UpdateCondition(self);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user