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

@@ -20,12 +20,18 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string Notification = "StartGame";
public readonly string TextNotification = null;
[NotificationReference("Speech")]
public readonly string LoadedNotification = "GameLoaded";
public readonly string LoadedTextNotification = null;
[NotificationReference("Speech")]
public readonly string SavedNotification = "GameSaved";
public readonly string SavedTextNotification = null;
public override object Create(ActorInitializer init) { return new StartGameNotification(this); }
}
@@ -40,19 +46,28 @@ namespace OpenRA.Mods.Common.Traits
void IWorldLoaded.WorldLoaded(World world, WorldRenderer wr)
{
if (!world.IsLoadingGameSave)
{
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.Notification, world.RenderPlayer == null ? null : world.RenderPlayer.Faction.InternalName);
TextNotificationsManager.AddTransientLine(info.TextNotification, null);
}
}
void INotifyGameLoaded.GameLoaded(World world)
{
if (!world.IsReplay)
{
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.LoadedNotification, world.RenderPlayer == null ? null : world.RenderPlayer.Faction.InternalName);
TextNotificationsManager.AddTransientLine(info.LoadedTextNotification, null);
}
}
void INotifyGameSaved.GameSaved(World world)
{
if (!world.IsReplay)
{
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.SavedNotification, world.RenderPlayer == null ? null : world.RenderPlayer.Faction.InternalName);
TextNotificationsManager.AddTransientLine(info.SavedTextNotification, null);
}
}
}
}