1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 18:53:21 +08:00

Fix start failure if videos are missing

This commit is contained in:
Dean Herbert 2019-06-17 21:07:30 +09:00
parent 5911105298
commit 1e2f9d1ba1
7 changed files with 56 additions and 16 deletions

View File

@ -0,0 +1,45 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.IO;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Video;
using osu.Game.Graphics;
namespace osu.Game.Tournament.Components
{
public class TourneyVideo : CompositeDrawable
{
private readonly VideoSprite video;
public TourneyVideo(Stream stream)
{
if (stream == null)
{
InternalChild = new Box
{
Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)),
RelativeSizeAxes = Axes.Both,
};
}
else
InternalChild = video = new VideoSprite(stream)
{
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
};
}
public bool Loop
{
set
{
if (video != null)
video.Loop = value;
}
}
}
}

View File

@ -8,9 +8,9 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Lines; using osu.Framework.Graphics.Lines;
using osu.Framework.Graphics.Video;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.Ladder.Components;
using osuTK.Graphics; using osuTK.Graphics;
@ -39,7 +39,7 @@ namespace osu.Game.Tournament.Screens.Ladder
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new VideoSprite(storage.GetStream(@"BG Side Logo - OWC.m4v")) new TourneyVideo(storage.GetStream(@"BG Side Logo - OWC.m4v"))
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,

View File

@ -8,10 +8,10 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Video;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.Ladder.Components;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -33,7 +33,7 @@ namespace osu.Game.Tournament.Screens.Schedule
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new VideoSprite(storage.GetStream(@"BG Side Logo - OWC.m4v")) new TourneyVideo(storage.GetStream(@"BG Side Logo - OWC.m4v"))
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Video;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -30,7 +29,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new VideoSprite(storage.GetStream(@"BG Team - Both OWC.m4v")) new TourneyVideo(storage.GetStream(@"BG Team - Both OWC.m4v"))
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Video;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -24,8 +23,8 @@ namespace osu.Game.Tournament.Screens.TeamWin
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>();
private readonly Bindable<bool> currentCompleted = new Bindable<bool>(); private readonly Bindable<bool> currentCompleted = new Bindable<bool>();
private VideoSprite blueWinVideo; private TourneyVideo blueWinVideo;
private VideoSprite redWinVideo; private TourneyVideo redWinVideo;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(LadderInfo ladder, Storage storage) private void load(LadderInfo ladder, Storage storage)
@ -34,13 +33,13 @@ namespace osu.Game.Tournament.Screens.TeamWin
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
blueWinVideo = new VideoSprite(storage.GetStream(@"BG Team - Win Blue.m4v")) blueWinVideo = new TourneyVideo(storage.GetStream(@"BG Team - Win Blue.m4v"))
{ {
Alpha = 1, Alpha = 1,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
redWinVideo = new VideoSprite(storage.GetStream(@"BG Team - Win Red.m4v")) redWinVideo = new TourneyVideo(storage.GetStream(@"BG Team - Win Red.m4v"))
{ {
Alpha = 0, Alpha = 0,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -16,7 +16,6 @@ using osu.Game.Overlays.Settings;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Teams namespace osu.Game.Tournament.Screens.Teams
{ {

View File

@ -7,7 +7,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Video;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
@ -30,7 +29,7 @@ namespace osu.Game.Tournament.Screens
public class TournamentSceneManager : CompositeDrawable public class TournamentSceneManager : CompositeDrawable
{ {
private Container screens; private Container screens;
private VideoSprite video; private TourneyVideo video;
[Cached] [Cached]
private MatchChatDisplay chat = new MatchChatDisplay(); private MatchChatDisplay chat = new MatchChatDisplay();
@ -59,11 +58,10 @@ namespace osu.Game.Tournament.Screens
//Masking = true, //Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
video = new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v")) video = new TourneyVideo(storage.GetStream("BG Logoless - OWC.m4v"))
{ {
Loop = true, Loop = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
}, },
screens = new Container screens = new Container
{ {