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