Ingame briefing support

This commit is contained in:
Paul Chote
2010-08-16 16:35:50 +12:00
parent 56b0da0b13
commit 38e5f70cbe
3 changed files with 29 additions and 2 deletions

View File

@@ -27,6 +27,8 @@ namespace OpenRA.Widgets
bool stopped;
bool paused;
Action OnComplete;
public bool Paused { get { return paused; } }
public bool DrawOverlay = true;
@@ -38,7 +40,8 @@ namespace OpenRA.Widgets
stopped = true;
paused = true;
Sound.StopVideo();
OnComplete = () => {};
cachedVideo = filename;
video = new VqaReader(FileSystem.Open(filename));
@@ -95,10 +98,16 @@ namespace OpenRA.Widgets
}
public void Play()
{
PlayThen(() => {});
}
public void PlayThen(Action after)
{
if (video == null)
return;
OnComplete = after;
if (stopped)
Sound.PlayVideo(video.AudioData);
else
@@ -126,6 +135,7 @@ namespace OpenRA.Widgets
Sound.StopVideo();
video.Reset();
videoSprite.sheet.Texture.SetData(video.FrameData);
OnComplete();
}
}
}