Fix crash on fmv completion
This commit is contained in:
@@ -31,6 +31,14 @@ namespace OpenRA.Widgets
|
||||
|
||||
public bool Paused { get { return paused; } }
|
||||
|
||||
|
||||
readonly World world;
|
||||
[ObjectCreator.UseCtor]
|
||||
public VqaPlayerWidget( [ObjectCreator.Param] World world )
|
||||
{
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public bool DrawOverlay = true;
|
||||
public void Load(string filename)
|
||||
{
|
||||
@@ -148,7 +156,7 @@ namespace OpenRA.Widgets
|
||||
Sound.StopVideo();
|
||||
video.Reset();
|
||||
videoSprite.sheet.Texture.SetData(video.FrameData);
|
||||
OnComplete();
|
||||
world.AddFrameEndTask(_ => OnComplete());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,9 +119,9 @@ namespace OpenRA
|
||||
}
|
||||
|
||||
// Hacky workaround for orderManager visibility
|
||||
public void OpenWindow(string widget)
|
||||
public Widget OpenWindow(string widget)
|
||||
{
|
||||
Widget.OpenWindow(widget, new Dictionary<string,object>{{"world", this}, { "orderManager", orderManager }});
|
||||
return Widget.OpenWindow(widget, new Dictionary<string,object>{{"world", this}, { "orderManager", orderManager }});
|
||||
}
|
||||
|
||||
public Actor CreateActor( string name, TypeDictionary initDict )
|
||||
@@ -163,9 +163,9 @@ namespace OpenRA
|
||||
public bool DisableTick = false;
|
||||
public void Tick()
|
||||
{
|
||||
if (DisableTick)
|
||||
return;
|
||||
|
||||
// Todo: Expose this as an order so it can be synced
|
||||
if (!DisableTick)
|
||||
{
|
||||
actors.Do( x => x.Tick() );
|
||||
Queries.WithTraitMultiple<ITick>().DoTimed( x =>
|
||||
{
|
||||
@@ -173,6 +173,8 @@ namespace OpenRA
|
||||
}, "[{2}] Trait: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
|
||||
|
||||
effects.DoTimed( e => e.Tick( this ), "[{2}] Effect: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
|
||||
}
|
||||
|
||||
while (frameEndActions.Count != 0)
|
||||
frameEndActions.Dequeue()(this);
|
||||
Game.viewport.Tick();
|
||||
|
||||
@@ -23,15 +23,14 @@ namespace OpenRA.Scripting
|
||||
{
|
||||
public static void PlayFMVFullscreen(World w, string movie, Action onComplete)
|
||||
{
|
||||
var playerRoot = Widget.OpenWindow("FMVPLAYER");
|
||||
var playerRoot = w.OpenWindow("FMVPLAYER");
|
||||
var player = playerRoot.GetWidget<VqaPlayerWidget>("PLAYER");
|
||||
w.DisableTick = true;
|
||||
|
||||
Console.WriteLine("PlayFMV {0}",movie);
|
||||
player.Load(movie);
|
||||
|
||||
// Mute world sounds
|
||||
var oldModifier = Sound.SoundVolumeModifier;
|
||||
// Todo: this also modifies vqa audio
|
||||
//Sound.SoundVolumeModifier = 0f;
|
||||
|
||||
// Stop music while fmv plays
|
||||
|
||||
Reference in New Issue
Block a user