Extracted Win and Lose and Leave notifications MissionObjectives.
This commit is contained in:
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", mo.Info.LoseNotification, player.Faction.InternalName);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", mo.Info.WinNotification, player.Faction.InternalName);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Delay between the game over condition being met, and the game actually ending, in milliseconds.")]
|
||||
public readonly int GameOverDelay = 1500;
|
||||
|
||||
public readonly string WinNotification = null;
|
||||
public readonly string LoseNotification = null;
|
||||
public readonly string LeaveNotification = null;
|
||||
|
||||
public object Create(ActorInitializer init) { return new MissionObjectives(init.World, this); }
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", mo.Info.LoseNotification, player.Faction.InternalName);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Faction.InternalName);
|
||||
Game.Sound.PlayNotification(player.World.Map.Rules, player, "Speech", mo.Info.WinNotification, player.Faction.InternalName);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Action onQuit = () =>
|
||||
{
|
||||
if (world.Type == WorldType.Regular)
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", "Leave", world.LocalPlayer == null ? null : world.LocalPlayer.Faction.InternalName);
|
||||
{
|
||||
var moi = world.Map.Rules.Actors["player"].TraitInfoOrDefault<MissionObjectivesInfo>();
|
||||
if (moi != null)
|
||||
{
|
||||
var faction = world.LocalPlayer == null ? null : world.LocalPlayer.Faction.InternalName;
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", moi.LeaveNotification, faction);
|
||||
}
|
||||
}
|
||||
|
||||
leaving = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user