1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 21:42:55 +08:00

Merge pull request #19069 from peppy/add-drawings-video

Add support for a drawings screen video background
This commit is contained in:
Dan Balasescu 2022-07-12 17:29:34 +09:00 committed by GitHub
commit 41c2263fa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 36 additions and 39 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

@ -12,8 +12,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.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -45,7 +43,7 @@ namespace osu.Game.Tournament.Screens.Drawings
public ITeamList TeamList; public ITeamList TeamList;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures, Storage storage) private void load(Storage storage)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
@ -91,11 +89,10 @@ namespace osu.Game.Tournament.Screens.Drawings
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new Sprite new TourneyVideo("drawings")
{ {
Loop = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
Texture = textures.Get(@"Backgrounds/Drawings/background.png")
}, },
// Visualiser // Visualiser
new VisualiserContainer new VisualiserContainer

View File

@ -298,10 +298,10 @@ namespace osu.Game.Tournament.Screens.Editors
}, true); }, true);
} }
private void updatePanel() private void updatePanel() => Scheduler.AddOnce(() =>
{ {
drawableContainer.Child = new UserGridPanel(user.ToAPIUser()) { Width = 300 }; drawableContainer.Child = new UserGridPanel(user.ToAPIUser()) { Width = 300 };
} });
} }
} }
} }

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

@ -9,6 +9,8 @@ using osu.Framework.Bindables;
using osu.Framework.Configuration; using osu.Framework.Configuration;
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.Game.Graphics;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -19,7 +21,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;
@ -48,13 +50,21 @@ namespace osu.Game.Tournament.Screens.Setup
{ {
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize); windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
InternalChild = fillFlow = new FillFlowContainer InternalChildren = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f),
},
fillFlow = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Padding = new MarginPadding(10), Padding = new MarginPadding(10),
Spacing = new Vector2(10), Spacing = new Vector2(10),
}
}; };
api.LocalUser.BindValueChanged(_ => Schedule(reload)); api.LocalUser.BindValueChanged(_ => Schedule(reload));
@ -74,7 +84,8 @@ namespace osu.Game.Tournament.Screens.Setup
Action = () => sceneManager?.SetScreen(new StablePathSelectScreen()), Action = () => sceneManager?.SetScreen(new StablePathSelectScreen()),
Value = fileBasedIpc?.IPCStorage?.GetFullPath(string.Empty) ?? "Not found", Value = fileBasedIpc?.IPCStorage?.GetFullPath(string.Empty) ?? "Not found",
Failing = fileBasedIpc?.IPCStorage == null, Failing = fileBasedIpc?.IPCStorage == null,
Description = "The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation." Description =
"The osu!stable installation which is currently being used as a data source. If a source is not found, make sure you have created an empty ipc.txt in your stable cutting-edge installation."
}, },
new ActionableInfo new ActionableInfo
{ {

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);