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();
}
}
}

View File

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

View File

@@ -256,4 +256,16 @@ Container@ROOT:
Y:200
Width:PARENT_RIGHT - 30
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