Move mission videos to rules.

This commit is contained in:
Paul Chote
2016-03-01 21:22:18 +00:00
parent 8017844a15
commit 668e13b849
6 changed files with 97 additions and 49 deletions

View File

@@ -63,10 +63,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (world.LocalPlayer != null)
{
var scriptContext = world.WorldActor.TraitOrDefault<LuaScript>();
var video = world.LocalPlayer.WinState == WinState.Won ? world.Map.Videos.GameWon : world.Map.Videos.GameLost;
if (!string.IsNullOrEmpty(video) && !(scriptContext != null && scriptContext.FatalErrorOccurred))
Media.PlayFMVFullscreen(world, video, () => { });
var missionData = world.WorldActor.Info.TraitInfoOrDefault<MissionDataInfo>();
if (missionData != null && !(scriptContext != null && scriptContext.FatalErrorOccurred))
{
var video = world.LocalPlayer.WinState == WinState.Won ? missionData.WinVideo : missionData.LossVideo;
if (!string.IsNullOrEmpty(video))
Media.PlayFMVFullscreen(world, video, () => { });
}
}
var optionsButton = playerRoot.GetOrNull<MenuButtonWidget>("OPTIONS_BUTTON");