1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 16:43:03 +08:00

Merge branch 'master' into fix-testscene-rate

This commit is contained in:
Dean Herbert 2020-03-06 23:21:24 +09:00 committed by GitHub
commit d39e9df27f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 41 additions and 23 deletions

View File

@ -1,12 +1,13 @@
// 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.Allocation;
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.Framework.Platform;
using osu.Framework.Timing;
using osu.Game.Graphics;
@ -14,21 +15,24 @@ namespace osu.Game.Tournament.Components
{
public class TourneyVideo : CompositeDrawable
{
private readonly VideoSprite video;
private readonly string filename;
private readonly bool drawFallbackGradient;
private VideoSprite video;
private readonly ManualClock manualClock;
private ManualClock manualClock;
public TourneyVideo(Stream stream)
public TourneyVideo(string filename, bool drawFallbackGradient = false)
{
if (stream == null)
{
InternalChild = new Box
{
Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)),
RelativeSizeAxes = Axes.Both,
};
}
else
this.filename = filename;
this.drawFallbackGradient = drawFallbackGradient;
}
[BackgroundDependencyLoader]
private void load(Storage storage)
{
var stream = storage.GetStream($@"videos/{filename}.m4v");
if (stream != null)
{
InternalChild = video = new VideoSprite(stream)
{
@ -37,6 +41,14 @@ namespace osu.Game.Tournament.Components
Clock = new FramedClock(manualClock = new ManualClock())
};
}
else if (drawFallbackGradient)
{
InternalChild = new Box
{
Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)),
RelativeSizeAxes = Axes.Both,
};
}
}
public bool Loop

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Platform;
using osu.Framework.Threading;
using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Components;
@ -19,7 +20,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Gameplay
{
public class GameplayScreen : BeatmapInfoScreen
public class GameplayScreen : BeatmapInfoScreen, IProvideVideo
{
private readonly BindableBool warmup = new BindableBool();
@ -39,12 +40,17 @@ namespace osu.Game.Tournament.Screens.Gameplay
private TournamentMatchChatDisplay chat { get; set; }
[BackgroundDependencyLoader]
private void load(LadderInfo ladder, MatchIPCInfo ipc)
private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
{
this.ipc = ipc;
AddRangeInternal(new Drawable[]
{
new TourneyVideo("gameplay")
{
Loop = true,
RelativeSizeAxes = Axes.Both,
},
new MatchHeader(),
new Container
{

View File

@ -42,7 +42,7 @@ namespace osu.Game.Tournament.Screens.Ladder
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new TourneyVideo(storage.GetStream(@"videos/ladder.m4v"))
new TourneyVideo("ladder")
{
RelativeSizeAxes = Axes.Both,
Loop = true,

View File

@ -18,7 +18,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Schedule
{
public class ScheduleScreen : TournamentScreen, IProvideVideo
public class ScheduleScreen : TournamentScreen
{
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private Container mainContainer;
@ -33,7 +33,7 @@ namespace osu.Game.Tournament.Screens.Schedule
InternalChildren = new Drawable[]
{
new TourneyVideo(storage.GetStream(@"videos/schedule.m4v"))
new TourneyVideo("schedule")
{
RelativeSizeAxes = Axes.Both,
Loop = true,

View File

@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
InternalChildren = new Drawable[]
{
new TourneyVideo(storage.GetStream(@"videos/seeding.m4v"))
new TourneyVideo("seeding")
{
RelativeSizeAxes = Axes.Both,
Loop = true,

View File

@ -26,7 +26,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
InternalChildren = new Drawable[]
{
new TourneyVideo(storage.GetStream(@"videos/teamintro.m4v"))
new TourneyVideo("teamintro")
{
RelativeSizeAxes = Axes.Both,
Loop = true,

View File

@ -31,13 +31,13 @@ namespace osu.Game.Tournament.Screens.TeamWin
InternalChildren = new Drawable[]
{
blueWinVideo = new TourneyVideo(storage.GetStream(@"videos/teamwin-blue.m4v"))
blueWinVideo = new TourneyVideo("teamwin-blue")
{
Alpha = 1,
RelativeSizeAxes = Axes.Both,
Loop = true,
},
redWinVideo = new TourneyVideo(storage.GetStream(@"videos/teamwin-red.m4v"))
redWinVideo = new TourneyVideo("teamwin-red")
{
Alpha = 0,
RelativeSizeAxes = Axes.Both,

View File

@ -61,7 +61,7 @@ namespace osu.Game.Tournament
//Masking = true,
Children = new Drawable[]
{
video = new TourneyVideo(storage.GetStream("videos/main.m4v"))
video = new TourneyVideo("main", true)
{
Loop = true,
RelativeSizeAxes = Axes.Both,