Find video by recursive check rather than marker interface

Seems a lot more reliable, and allows falling back to the "main" video
in cases which didn't support this previously.

A next step may be to allow every screen to support a video based on its
screen name, rather than specifying the local `TourneyVideo` every time.
This commit is contained in:
Dean Herbert
2022-07-11 20:42:04 +09:00
parent 00c7101f54
commit 73e924479f
13 changed files with 14 additions and 25 deletions

View File

@ -22,6 +22,8 @@ namespace osu.Game.Tournament.Components
private Video video; private Video video;
private ManualClock manualClock; private ManualClock manualClock;
public bool VideoAvailable => video != null;
public TourneyVideo(string filename, bool drawFallbackGradient = false) public TourneyVideo(string filename, bool drawFallbackGradient = false)
{ {
this.filename = filename; this.filename = filename;

View File

@ -24,7 +24,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Drawings namespace osu.Game.Tournament.Screens.Drawings
{ {
public class DrawingsScreen : TournamentScreen, IProvideVideo public class DrawingsScreen : TournamentScreen
{ {
private const string results_filename = "drawings_results.txt"; private const string results_filename = "drawings_results.txt";

View File

@ -20,7 +20,7 @@ using osuTK;
namespace osu.Game.Tournament.Screens.Editors namespace osu.Game.Tournament.Screens.Editors
{ {
public abstract class TournamentEditorScreen<TDrawable, TModel> : TournamentScreen, IProvideVideo public abstract class TournamentEditorScreen<TDrawable, TModel> : TournamentScreen
where TDrawable : Drawable, IModelBacked<TModel> where TDrawable : Drawable, IModelBacked<TModel>
where TModel : class, new() where TModel : class, new()
{ {

View File

@ -21,7 +21,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Gameplay namespace osu.Game.Tournament.Screens.Gameplay
{ {
public class GameplayScreen : BeatmapInfoScreen, IProvideVideo public class GameplayScreen : BeatmapInfoScreen
{ {
private readonly BindableBool warmup = new BindableBool(); private readonly BindableBool warmup = new BindableBool();

View File

@ -1,14 +0,0 @@
// 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.
#nullable disable
namespace osu.Game.Tournament.Screens
{
/// <summary>
/// Marker interface for a screen which provides its own local video background.
/// </summary>
public interface IProvideVideo
{
}
}

View File

@ -19,7 +19,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Ladder namespace osu.Game.Tournament.Screens.Ladder
{ {
public class LadderScreen : TournamentScreen, IProvideVideo public class LadderScreen : TournamentScreen
{ {
protected Container<DrawableTournamentMatch> MatchesContainer; protected Container<DrawableTournamentMatch> MatchesContainer;
private Container<Path> paths; private Container<Path> paths;

View File

@ -19,7 +19,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Schedule namespace osu.Game.Tournament.Screens.Schedule
{ {
public class ScheduleScreen : TournamentScreen // IProvidesVideo public class ScheduleScreen : TournamentScreen
{ {
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private Container mainContainer; private Container mainContainer;

View File

@ -19,7 +19,7 @@ using osuTK;
namespace osu.Game.Tournament.Screens.Setup namespace osu.Game.Tournament.Screens.Setup
{ {
public class SetupScreen : TournamentScreen, IProvideVideo public class SetupScreen : TournamentScreen
{ {
private FillFlowContainer fillFlow; private FillFlowContainer fillFlow;

View File

@ -14,7 +14,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Showcase namespace osu.Game.Tournament.Screens.Showcase
{ {
public class ShowcaseScreen : BeatmapInfoScreen // IProvideVideo public class ShowcaseScreen : BeatmapInfoScreen
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()

View File

@ -19,7 +19,7 @@ using osuTK;
namespace osu.Game.Tournament.Screens.TeamIntro namespace osu.Game.Tournament.Screens.TeamIntro
{ {
public class SeedingScreen : TournamentMatchScreen, IProvideVideo public class SeedingScreen : TournamentMatchScreen
{ {
private Container mainContainer; private Container mainContainer;

View File

@ -13,7 +13,7 @@ using osuTK;
namespace osu.Game.Tournament.Screens.TeamIntro namespace osu.Game.Tournament.Screens.TeamIntro
{ {
public class TeamIntroScreen : TournamentMatchScreen, IProvideVideo public class TeamIntroScreen : TournamentMatchScreen
{ {
private Container mainContainer; private Container mainContainer;

View File

@ -14,7 +14,7 @@ using osuTK;
namespace osu.Game.Tournament.Screens.TeamWin namespace osu.Game.Tournament.Screens.TeamWin
{ {
public class TeamWinScreen : TournamentMatchScreen, IProvideVideo public class TeamWinScreen : TournamentMatchScreen
{ {
private Container mainContainer; private Container mainContainer;

View File

@ -10,6 +10,7 @@ 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.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Testing;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -186,7 +187,7 @@ namespace osu.Game.Tournament
var lastScreen = currentScreen; var lastScreen = currentScreen;
currentScreen = target; currentScreen = target;
if (currentScreen is IProvideVideo) if (currentScreen.ChildrenOfType<TourneyVideo>().FirstOrDefault()?.VideoAvailable == true)
{ {
video.FadeOut(200); video.FadeOut(200);