Rename some VideoPlayerWidget methods for clarity
This commit is contained in:
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
player.Load(videoFileName);
|
player.LoadAndPlay(videoFileName);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
player.Load(videoFileName);
|
player.LoadAndPlay(videoFileName);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (video != null)
|
if (video != null)
|
||||||
{
|
{
|
||||||
player = panel.Get<VideoPlayerWidget>("PLAYER");
|
player = panel.Get<VideoPlayerWidget>("PLAYER");
|
||||||
player.Load(prefix + filename);
|
player.LoadAndPlay(prefix + filename);
|
||||||
player.DrawOverlay = false;
|
player.DrawOverlay = false;
|
||||||
isVideoLoaded = true;
|
isVideoLoaded = true;
|
||||||
|
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
StopVideo(player);
|
StopVideo(player);
|
||||||
|
|
||||||
playingVideo = pv;
|
playingVideo = pv;
|
||||||
player.Load(video);
|
player.LoadAndPlay(video);
|
||||||
|
|
||||||
if (player.Video == null)
|
if (player.Video == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,19 +41,27 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
Action onComplete;
|
Action onComplete;
|
||||||
|
|
||||||
public void Load(string filename)
|
/// <summary>
|
||||||
|
/// Tries to load a video from the specified file and play it. Does nothing if the file name matches the already loaded video.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">Name of the file, including the extension.</param>
|
||||||
|
public void LoadAndPlay(string filename)
|
||||||
{
|
{
|
||||||
if (filename == cachedVideoFileName)
|
if (filename == cachedVideoFileName)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var stream = Game.ModData.DefaultFileSystem.Open(filename);
|
var stream = Game.ModData.DefaultFileSystem.Open(filename);
|
||||||
var video = VideoLoader.GetVideo(stream, true, Game.ModData.VideoLoaders);
|
var video = VideoLoader.GetVideo(stream, true, Game.ModData.VideoLoaders);
|
||||||
Open(video);
|
Play(video);
|
||||||
|
|
||||||
cachedVideoFileName = filename;
|
cachedVideoFileName = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Open(IVideo video)
|
/// <summary>
|
||||||
|
/// Plays the given <see cref="IVideo"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="video">An <see cref="IVideo"/> instance.</param>
|
||||||
|
public void Play(IVideo video)
|
||||||
{
|
{
|
||||||
this.video = video;
|
this.video = video;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user