Add an "Install videos" prompt to the mission browser.
This commit is contained in:
@@ -200,11 +200,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var briefingVideo = "";
|
var briefingVideo = "";
|
||||||
var briefingVideoVisible = false;
|
var briefingVideoVisible = false;
|
||||||
var briefingVideoDisabled = true;
|
|
||||||
|
|
||||||
var infoVideo = "";
|
var infoVideo = "";
|
||||||
var infoVideoVisible = false;
|
var infoVideoVisible = false;
|
||||||
var infoVideoDisabled = true;
|
|
||||||
|
|
||||||
new Thread(() =>
|
new Thread(() =>
|
||||||
{
|
{
|
||||||
@@ -219,11 +217,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
briefingVideo = missionData.BriefingVideo;
|
briefingVideo = missionData.BriefingVideo;
|
||||||
briefingVideoVisible = briefingVideo != null;
|
briefingVideoVisible = briefingVideo != null;
|
||||||
briefingVideoDisabled = !(briefingVideoVisible && modData.DefaultFileSystem.Exists(briefingVideo));
|
|
||||||
|
|
||||||
infoVideo = missionData.BackgroundVideo;
|
infoVideo = missionData.BackgroundVideo;
|
||||||
infoVideoVisible = infoVideo != null;
|
infoVideoVisible = infoVideo != null;
|
||||||
infoVideoDisabled = !(infoVideoVisible && modData.DefaultFileSystem.Exists(infoVideo));
|
|
||||||
|
|
||||||
var briefing = WidgetUtils.WrapText(missionData.Briefing.Replace("\\n", "\n"), description.Bounds.Width, descriptionFont);
|
var briefing = WidgetUtils.WrapText(missionData.Briefing.Replace("\\n", "\n"), description.Bounds.Width, descriptionFont);
|
||||||
var height = descriptionFont.Measure(briefing).Y;
|
var height = descriptionFont.Measure(briefing).Y;
|
||||||
@@ -240,12 +236,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}).Start();
|
}).Start();
|
||||||
|
|
||||||
startBriefingVideoButton.IsVisible = () => briefingVideoVisible && playingVideo != PlayingVideo.Briefing;
|
startBriefingVideoButton.IsVisible = () => briefingVideoVisible && playingVideo != PlayingVideo.Briefing;
|
||||||
startBriefingVideoButton.IsDisabled = () => briefingVideoDisabled || playingVideo != PlayingVideo.None;
|
startBriefingVideoButton.OnClick = () => PlayVideo(videoPlayer, briefingVideo, PlayingVideo.Briefing);
|
||||||
startBriefingVideoButton.OnClick = () => PlayVideo(videoPlayer, briefingVideo, PlayingVideo.Briefing, () => StopVideo(videoPlayer));
|
|
||||||
|
|
||||||
startInfoVideoButton.IsVisible = () => infoVideoVisible && playingVideo != PlayingVideo.Info;
|
startInfoVideoButton.IsVisible = () => infoVideoVisible && playingVideo != PlayingVideo.Info;
|
||||||
startInfoVideoButton.IsDisabled = () => infoVideoDisabled || playingVideo != PlayingVideo.None;
|
startInfoVideoButton.OnClick = () => PlayVideo(videoPlayer, infoVideo, PlayingVideo.Info);
|
||||||
startInfoVideoButton.OnClick = () => PlayVideo(videoPlayer, infoVideo, PlayingVideo.Info, () => StopVideo(videoPlayer));
|
|
||||||
|
|
||||||
descriptionPanel.ScrollToTop();
|
descriptionPanel.ScrollToTop();
|
||||||
|
|
||||||
@@ -318,7 +312,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Game.Sound.MusicVolume = cachedMusicVolume;
|
Game.Sound.MusicVolume = cachedMusicVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayVideo(VqaPlayerWidget player, string video, PlayingVideo pv, Action onComplete)
|
void PlayVideo(VqaPlayerWidget player, string video, PlayingVideo pv, Action onComplete = null)
|
||||||
|
{
|
||||||
|
if (!modData.DefaultFileSystem.Exists(video))
|
||||||
|
{
|
||||||
|
ConfirmationDialogs.ButtonPrompt(
|
||||||
|
title: "Video not installed",
|
||||||
|
text: "The game videos can be installed from the\n\"Manage Content\" menu in the mod chooser.",
|
||||||
|
cancelText: "Back",
|
||||||
|
onCancel: () => { });
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
StopVideo(player);
|
StopVideo(player);
|
||||||
|
|
||||||
@@ -326,11 +330,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
player.Load(video);
|
player.Load(video);
|
||||||
|
|
||||||
// video playback runs asynchronously
|
// video playback runs asynchronously
|
||||||
player.PlayThen(onComplete);
|
player.PlayThen(() =>
|
||||||
|
{
|
||||||
|
StopVideo(player);
|
||||||
|
if (onComplete != null)
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
|
||||||
// Mute other distracting sounds
|
// Mute other distracting sounds
|
||||||
MuteSounds();
|
MuteSounds();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void StopVideo(VqaPlayerWidget player)
|
void StopVideo(VqaPlayerWidget player)
|
||||||
{
|
{
|
||||||
@@ -362,7 +372,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
fullscreenVideoPlayer.Visible = true;
|
fullscreenVideoPlayer.Visible = true;
|
||||||
PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart, () =>
|
PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart, () =>
|
||||||
{
|
{
|
||||||
StopVideo(fsPlayer);
|
|
||||||
Game.CreateAndStartLocalServer(selectedMap.Uid, orders);
|
Game.CreateAndStartLocalServer(selectedMap.Uid, orders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user