Implement "Game Saved" / "Game Loaded" notifications in RA and D2k.

This commit is contained in:
Paul Chote
2019-04-20 10:35:20 +00:00
committed by reaperrr
parent 492b5aec82
commit d5588c51ed
5 changed files with 27 additions and 4 deletions

View File

@@ -19,10 +19,16 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string Notification = "StartGame";
[NotificationReference("Speech")]
public readonly string LoadedNotification = "GameLoaded";
[NotificationReference("Speech")]
public readonly string SavedNotification = "GameSaved";
public object Create(ActorInitializer init) { return new StartGameNotification(this); }
}
class StartGameNotification : IWorldLoaded
class StartGameNotification : IWorldLoaded, INotifyGameLoaded, INotifyGameSaved
{
StartGameNotificationInfo info;
public StartGameNotification(StartGameNotificationInfo info)
@@ -35,5 +41,17 @@ namespace OpenRA.Mods.Common.Traits
if (!world.IsLoadingGameSave)
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.Notification, world.RenderPlayer == null ? null : world.RenderPlayer.Faction.InternalName);
}
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);
}
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);
}
}
}

View File

@@ -40,6 +40,8 @@ Speech:
SelectTarget: select1
SilosNeeded: silos1
StartGame:
GameLoaded:
GameSaved: scold1
Training: bldging1
UnitDestroyed: dead1
UnitLost: unitlost

View File

@@ -233,6 +233,7 @@ World:
PanelName: SKIRMISH_STATS
LoadWidgetAtGameStart:
ScriptTriggers:
StartGameNotification:
EditorWorld:
Inherits: ^BaseWorld

View File

@@ -53,8 +53,6 @@ Speech:
MercenaryRescued: mercr1
MissionAccomplished: misnwon1
MissionFailed: misnlst1
MissionLoaded: load1
MissionSaved: save1
MissionTimerInitialised: mtimein1
NavalUnitLost: navylst1
NewOptions: newopt1
@@ -85,6 +83,8 @@ Speech:
SovietReinforcementsArrived: sovrein1
SpyPlaneReady: spypln1
StartGame: bctrinit
GameLoaded: load1
GameSaved: save1
StructureDestroyed: strckil1
StructureSold: strusld1
TanyaFreed: tanyaf1

View File

@@ -64,6 +64,8 @@ Speech:
SpyKilledMissionFailed: 01-n284
SpyLostMissionFailed: 01-n210
StartGame: 00-i200
GameLoaded: 00-i200
GameSaved:
StructureSold: 00-i228
SubterraneanUnitDetected: 00-i174
TertiaryObjectiveAchieved: 00-i104