mirror of
https://github.com/ppy/osu.git
synced 2025-01-08 02:03:51 +08:00
Merge pull request #8151 from peppy/tourney-simplify-video-spec
Simplify tournament video construction
This commit is contained in:
commit
09bd5ad185
@ -1,12 +1,13 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// 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;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
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.Graphics.Video;
|
||||||
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
@ -14,21 +15,24 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
public class TourneyVideo : CompositeDrawable
|
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)
|
this.filename = filename;
|
||||||
{
|
this.drawFallbackGradient = drawFallbackGradient;
|
||||||
InternalChild = new Box
|
}
|
||||||
{
|
|
||||||
Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)),
|
[BackgroundDependencyLoader]
|
||||||
RelativeSizeAxes = Axes.Both,
|
private void load(Storage storage)
|
||||||
};
|
{
|
||||||
}
|
var stream = storage.GetStream($@"videos/{filename}.m4v");
|
||||||
else
|
|
||||||
|
if (stream != null)
|
||||||
{
|
{
|
||||||
InternalChild = video = new VideoSprite(stream)
|
InternalChild = video = new VideoSprite(stream)
|
||||||
{
|
{
|
||||||
@ -37,6 +41,14 @@ namespace osu.Game.Tournament.Components
|
|||||||
Clock = new FramedClock(manualClock = new ManualClock())
|
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
|
public bool Loop
|
||||||
|
@ -6,6 +6,7 @@ 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.Platform;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
@ -19,7 +20,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Gameplay
|
namespace osu.Game.Tournament.Screens.Gameplay
|
||||||
{
|
{
|
||||||
public class GameplayScreen : BeatmapInfoScreen
|
public class GameplayScreen : BeatmapInfoScreen, IProvideVideo
|
||||||
{
|
{
|
||||||
private readonly BindableBool warmup = new BindableBool();
|
private readonly BindableBool warmup = new BindableBool();
|
||||||
|
|
||||||
@ -39,12 +40,17 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
|||||||
private TournamentMatchChatDisplay chat { get; set; }
|
private TournamentMatchChatDisplay chat { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LadderInfo ladder, MatchIPCInfo ipc)
|
private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
|
||||||
{
|
{
|
||||||
this.ipc = ipc;
|
this.ipc = ipc;
|
||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
|
new TourneyVideo("gameplay")
|
||||||
|
{
|
||||||
|
Loop = true,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
new MatchHeader(),
|
new MatchHeader(),
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Tournament.Screens.Ladder
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new TourneyVideo(storage.GetStream(@"videos/ladder.m4v"))
|
new TourneyVideo("ladder")
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Loop = true,
|
Loop = true,
|
||||||
|
@ -18,7 +18,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Schedule
|
namespace osu.Game.Tournament.Screens.Schedule
|
||||||
{
|
{
|
||||||
public class ScheduleScreen : TournamentScreen, IProvideVideo
|
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;
|
||||||
@ -33,7 +33,7 @@ namespace osu.Game.Tournament.Screens.Schedule
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new TourneyVideo(storage.GetStream(@"videos/schedule.m4v"))
|
new TourneyVideo("schedule")
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Loop = true,
|
Loop = true,
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new TourneyVideo(storage.GetStream(@"videos/seeding.m4v"))
|
new TourneyVideo("seeding")
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Loop = true,
|
Loop = true,
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new TourneyVideo(storage.GetStream(@"videos/teamintro.m4v"))
|
new TourneyVideo("teamintro")
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Loop = true,
|
Loop = true,
|
||||||
|
@ -31,13 +31,13 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
blueWinVideo = new TourneyVideo(storage.GetStream(@"videos/teamwin-blue.m4v"))
|
blueWinVideo = new TourneyVideo("teamwin-blue")
|
||||||
{
|
{
|
||||||
Alpha = 1,
|
Alpha = 1,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Loop = true,
|
Loop = true,
|
||||||
},
|
},
|
||||||
redWinVideo = new TourneyVideo(storage.GetStream(@"videos/teamwin-red.m4v"))
|
redWinVideo = new TourneyVideo("teamwin-red")
|
||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Tournament
|
|||||||
//Masking = true,
|
//Masking = true,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
video = new TourneyVideo(storage.GetStream("videos/main.m4v"))
|
video = new TourneyVideo("main", true)
|
||||||
{
|
{
|
||||||
Loop = true,
|
Loop = true,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Loading…
Reference in New Issue
Block a user