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

View File

@@ -149,8 +149,13 @@ namespace OpenRA
public event Action<Actor> ActorAdded = _ => { }; public event Action<Actor> ActorAdded = _ => { };
public event Action<Actor> ActorRemoved = _ => { }; public event Action<Actor> ActorRemoved = _ => { };
// Will do bad things in multiplayer games
public bool DisableTick = false;
public void Tick() public void Tick()
{ {
if (DisableTick)
return;
Timer.Time("----World Tick"); Timer.Time("----World Tick");
actors.DoTimed( x => x.Tick(), "expensive actor tick: {0} ({1:0.000})", 0.001 ); actors.DoTimed( x => x.Tick(), "expensive actor tick: {0} ({1:0.000})", 0.001 );

View File

@@ -256,4 +256,16 @@ Container@ROOT:
Y:200 Y:200
Width:PARENT_RIGHT - 30 Width:PARENT_RIGHT - 30
Height:20 Height:20
Text:Instant Charge Time (Special Powers) Text:Instant Charge Time (Special Powers)
Background@FMVPLAYER:
Id:FMVPLAYER
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM
Visible: false
Children:
VqaPlayer:
Id:PLAYER
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:640
Height:400