Add a generic video player widget.
This commit is contained in:
committed by
abcdefg30
parent
514652bb6a
commit
7bc17b59f5
@@ -15,10 +15,10 @@ using Eluant;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.Common.FileFormats;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Video;
|
||||
|
||||
namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
@@ -175,12 +175,12 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
return false;
|
||||
}
|
||||
|
||||
AsyncLoader l = new AsyncLoader(Media.LoadVqa);
|
||||
AsyncLoader l = new AsyncLoader(Media.LoadVideo);
|
||||
IAsyncResult ar = l.BeginInvoke(s, null, null);
|
||||
Action onLoadComplete = () =>
|
||||
{
|
||||
Media.StopFMVInRadar();
|
||||
world.AddFrameEndTask(_ => Media.PlayFMVInRadar(world, l.EndInvoke(ar), onCompleteRadar));
|
||||
world.AddFrameEndTask(_ => Media.PlayFMVInRadar(l.EndInvoke(ar), onCompleteRadar));
|
||||
};
|
||||
|
||||
world.AddFrameEndTask(w => w.Add(new AsyncAction(ar, onLoadComplete)));
|
||||
@@ -228,6 +228,6 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
world.AddFrameEndTask(w => w.Add(new FloatingText(position, c, text, duration)));
|
||||
}
|
||||
|
||||
public delegate VqaReader AsyncLoader(Stream s);
|
||||
public delegate IVideo AsyncLoader(Stream s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using OpenRA.Mods.Common.FileFormats;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Video;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Scripting
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public static void PlayFMVFullscreen(World w, string movie, Action onComplete)
|
||||
{
|
||||
var playerRoot = Game.OpenWindow(w, "FMVPLAYER");
|
||||
var player = playerRoot.Get<VqaPlayerWidget>("PLAYER");
|
||||
var player = playerRoot.Get<VideoPlayerWidget>("PLAYER");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -60,9 +60,9 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
});
|
||||
}
|
||||
|
||||
public static void PlayFMVInRadar(World w, VqaReader movie, Action onComplete)
|
||||
public static void PlayFMVInRadar(IVideo movie, Action onComplete)
|
||||
{
|
||||
var player = Ui.Root.Get<VqaPlayerWidget>("PLAYER");
|
||||
var player = Ui.Root.Get<VideoPlayerWidget>("PLAYER");
|
||||
player.Open(movie);
|
||||
|
||||
player.PlayThen(() =>
|
||||
@@ -74,13 +74,13 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
public static void StopFMVInRadar()
|
||||
{
|
||||
var player = Ui.Root.Get<VqaPlayerWidget>("PLAYER");
|
||||
var player = Ui.Root.Get<VideoPlayerWidget>("PLAYER");
|
||||
player.Stop();
|
||||
}
|
||||
|
||||
public static VqaReader LoadVqa(Stream s)
|
||||
public static IVideo LoadVideo(Stream s)
|
||||
{
|
||||
return new VqaReader(s);
|
||||
return VideoLoader.GetVideo(s, Game.ModData.VideoLoaders);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user