Merge branch 'master' into hud_visibility

This commit is contained in:
Dean Herbert
2017-04-03 11:51:11 +09:00
committed by GitHub
27 changed files with 325 additions and 220 deletions

View File

@ -1,12 +1,11 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
@ -24,7 +23,7 @@ namespace osu.Desktop.VisualTests.Tests
AddToggleStep("Kiai", b => AddToggleStep("Kiai", b =>
{ {
kiai = !kiai; kiai = !kiai;
Reset(); updateKiaiState();
}); });
Add(new CirclePiece Add(new CirclePiece
@ -87,37 +86,27 @@ namespace osu.Desktop.VisualTests.Tests
} }
}); });
Add(new DrumRollCircle(new CirclePiece Add(new CirclePiece
{ {
KiaiMode = kiai Position = new Vector2(575, 100),
}) Width = 0.25f,
{ AccentColour = Color4.Orange,
Width = 250, KiaiMode = kiai,
Position = new Vector2(575, 100)
}); });
Add(new DrumRollCircle(new StrongCirclePiece Add(new StrongCirclePiece
{ {
Position = new Vector2(575, 300),
Width = 0.25f,
AccentColour = Color4.Orange,
KiaiMode = kiai KiaiMode = kiai
})
{
Width = 250,
Position = new Vector2(575, 300)
}); });
} }
private class DrumRollCircle : BaseCircle private void updateKiaiState()
{ {
public DrumRollCircle(CirclePiece piece) foreach (var c in Children.OfType<CirclePiece>())
: base(piece) c.KiaiMode = kiai;
{
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Piece.AccentColour = colours.YellowDark;
}
} }
private abstract class BaseCircle : Container private abstract class BaseCircle : Container

View File

@ -3,7 +3,6 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
@ -26,6 +25,8 @@ namespace osu.Desktop.VisualTests.Tests
AddStep("Hit!", addHitJudgement); AddStep("Hit!", addHitJudgement);
AddStep("Miss :(", addMissJudgement); AddStep("Miss :(", addMissJudgement);
AddStep("DrumRoll", () => addDrumRoll(false));
AddStep("Strong DrumRoll", () => addDrumRoll(true));
AddStep("Swell", addSwell); AddStep("Swell", addSwell);
AddStep("Centre", () => addCentreHit(false)); AddStep("Centre", () => addCentreHit(false));
AddStep("Strong Centre", () => addCentreHit(true)); AddStep("Strong Centre", () => addCentreHit(true));
@ -36,7 +37,6 @@ namespace osu.Desktop.VisualTests.Tests
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Y = 200, Y = 200,
Padding = new MarginPadding { Left = 200 },
Children = new[] Children = new[]
{ {
playfield = new TaikoPlayfield() playfield = new TaikoPlayfield()
@ -73,6 +73,18 @@ namespace osu.Desktop.VisualTests.Tests
}); });
} }
private void addDrumRoll(bool strong)
{
var d = new DrumRoll
{
StartTime = Time.Current + 1000,
Distance = 20000,
PreEmpt = 1000,
};
playfield.Add(strong ? new DrawableStrongDrumRoll(d) : new DrawableDrumRoll(d));
}
private void addSwell() private void addSwell()
{ {
playfield.Add(new DrawableSwell(new Swell playfield.Add(new DrawableSwell(new Swell

View File

@ -14,7 +14,7 @@ namespace osu.Desktop.VisualTests
{ {
base.LoadComplete(); base.LoadComplete();
new BackgroundScreenDefault { Depth = 10 }.LoadAsync(this, AddInternal); LoadComponentAsync(new BackgroundScreenDefault { Depth = 10 }, AddInternal);
// Have to construct this here, rather than in the constructor, because // Have to construct this here, rather than in the constructor, because
// we depend on some dependencies to be loaded within OsuGameBase.load(). // we depend on some dependencies to be loaded within OsuGameBase.load().

View File

@ -29,7 +29,7 @@ namespace osu.Desktop
{ {
base.LoadComplete(); base.LoadComplete();
versionManager.LoadAsync(this); LoadComponentAsync(versionManager);
ScreenChanged += s => ScreenChanged += s =>
{ {
if (!versionManager.IsAlive && s is Intro) if (!versionManager.IsAlive && s is Intro)

View File

@ -1,38 +1,90 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Graphics;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
using System.Linq; using System.Linq;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawable
{ {
public class DrawableDrumRoll : DrawableTaikoHitObject public class DrawableDrumRoll : DrawableTaikoHitObject
{ {
/// <summary>
/// Number of rolling hits required to reach the dark/final accent colour.
/// </summary>
private const int rolling_hits_for_dark_accent = 5;
private readonly DrumRoll drumRoll; private readonly DrumRoll drumRoll;
private readonly CirclePiece circle;
private Color4 accentDarkColour;
/// <summary>
/// Rolling number of tick hits. This increases for hits and decreases for misses.
/// </summary>
private int rollingHits;
public DrawableDrumRoll(DrumRoll drumRoll) public DrawableDrumRoll(DrumRoll drumRoll)
: base(drumRoll) : base(drumRoll)
{ {
this.drumRoll = drumRoll; this.drumRoll = drumRoll;
int tickIndex = 0; RelativeSizeAxes = Axes.X;
Width = (float)(drumRoll.Duration / drumRoll.PreEmpt);
Add(circle = CreateCirclePiece());
foreach (var tick in drumRoll.Ticks) foreach (var tick in drumRoll.Ticks)
{ {
var newTick = new DrawableDrumRollTick(tick) var newTick = new DrawableDrumRollTick(tick)
{ {
Depth = tickIndex,
X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration) X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration)
}; };
AddNested(newTick); newTick.OnJudgement += onTickJudgement;
tickIndex++; AddNested(newTick);
Add(newTick);
} }
} }
protected override void UpdateState(ArmedState state) [BackgroundDependencyLoader]
private void load(OsuColour colours)
{ {
circle.AccentColour = AccentColour = colours.YellowDark;
accentDarkColour = colours.YellowDarker;
}
protected override void LoadComplete()
{
base.LoadComplete();
// This is naive, however it's based on the reasoning that the hit target
// is further than mid point of the play field, so the time taken to scroll in should always
// be greater than the time taken to scroll out to the left of the screen.
// Thus, using PreEmpt here is enough for the drum roll to completely scroll out.
LifetimeEnd = drumRoll.EndTime + drumRoll.PreEmpt;
}
private void onTickJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> obj)
{
if (obj.Judgement.Result == HitResult.Hit)
rollingHits++;
else
rollingHits--;
rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_dark_accent);
Color4 newAccent = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1);
circle.FadeAccent(newAccent, 100);
} }
protected override void CheckJudgement(bool userTriggered) protected override void CheckJudgement(bool userTriggered)
@ -53,5 +105,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
else else
Judgement.Result = HitResult.Miss; Judgement.Result = HitResult.Miss;
} }
protected override void UpdateState(ArmedState state)
{
}
protected virtual CirclePiece CreateCirclePiece() => new CirclePiece();
} }
} }

View File

@ -5,20 +5,66 @@ using OpenTK.Input;
using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Judgements;
using System; using System;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawable
{ {
public class DrawableDrumRollTick : DrawableTaikoHitObject public class DrawableDrumRollTick : DrawableTaikoHitObject
{ {
/// <summary>
/// The size of a tick.
/// </summary>
private const float tick_size = TaikoHitObject.CIRCLE_RADIUS / 2;
/// <summary>
/// Any tick that is not the first for a drumroll is not filled, but is instead displayed
/// as a hollow circle. This is what controls the border width of that circle.
/// </summary>
private const float tick_border_width = tick_size / 4;
private readonly DrumRollTick tick; private readonly DrumRollTick tick;
private readonly CircularContainer bodyContainer;
public DrawableDrumRollTick(DrumRollTick tick) public DrawableDrumRollTick(DrumRollTick tick)
: base(tick) : base(tick)
{ {
this.tick = tick; this.tick = tick;
Anchor = Anchor.CentreLeft;
Origin = Anchor.Centre;
RelativePositionAxes = Axes.X;
Size = new Vector2(tick_size);
Children = new[]
{
bodyContainer = new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderThickness = tick_border_width,
BorderColour = Color4.White,
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = tick.FirstTick ? 1 : 0,
AlwaysPresent = true
}
}
}
};
} }
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement(); protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement { SecondHit = tick.IsStrong };
protected override void CheckJudgement(bool userTriggered) protected override void CheckJudgement(bool userTriggered)
{ {
@ -38,11 +84,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
protected override void UpdateState(ArmedState state) protected override void UpdateState(ArmedState state)
{ {
switch (state)
{
case ArmedState.Hit:
bodyContainer.ScaleTo(0, 100, EasingTypes.OutQuint);
break;
}
} }
protected override void UpdateScrollPosition(double time) protected override void UpdateScrollPosition(double time)
{ {
// Drum roll ticks shouldn't move // Ticks don't move
} }
protected override bool HandleKeyPress(Key key) protected override bool HandleKeyPress(Key key)

View File

@ -0,0 +1,20 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
namespace osu.Game.Modes.Taiko.Objects.Drawable
{
public class DrawableStrongDrumRoll : DrawableDrumRoll
{
public DrawableStrongDrumRoll(DrumRoll drumRoll)
: base(drumRoll)
{
}
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement { SecondHit = true };
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece();
}
}

View File

@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
: base(hitObject) : base(hitObject)
{ {
Anchor = Anchor.CentreLeft; Anchor = Anchor.CentreLeft;
Origin = Anchor.Centre; Origin = Anchor.CentreLeft;
RelativePositionAxes = Axes.X; RelativePositionAxes = Axes.X;
} }

View File

@ -36,10 +36,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
{ {
accentColour = value; accentColour = value;
innerBackground.Colour = AccentColour; background.Colour = AccentColour;
triangles.ColourLight = AccentColour;
triangles.ColourDark = AccentColour.Darken(0.1f);
resetEdgeEffects(); resetEdgeEffects();
} }
@ -69,10 +66,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
protected override Container<Framework.Graphics.Drawable> Content => SymbolContainer; protected override Container<Framework.Graphics.Drawable> Content => SymbolContainer;
protected readonly Container SymbolContainer; protected readonly Container SymbolContainer;
private readonly Container background;
private readonly Container innerLayer; private readonly Container innerLayer;
private readonly Container innerCircleContainer;
private readonly Box innerBackground;
private readonly Triangles triangles;
public CirclePiece() public CirclePiece()
{ {
@ -88,26 +83,28 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Children = new Framework.Graphics.Drawable[] Children = new Framework.Graphics.Drawable[]
{ {
innerCircleContainer = new CircularContainer background = new CircularContainer
{ {
Name = "Inner Circle", Name = "Background",
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Masking = true, Masking = true,
Children = new Framework.Graphics.Drawable[] Children = new Framework.Graphics.Drawable[]
{ {
innerBackground = new Box new Box
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
triangles = new Triangles new Triangles
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ColourLight = Color4.White,
ColourDark = Color4.White.Darken(0.1f)
} }
} }
}, },
@ -150,7 +147,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
private void resetEdgeEffects() private void resetEdgeEffects()
{ {
innerCircleContainer.EdgeEffect = new EdgeEffect background.EdgeEffect = new EdgeEffect
{ {
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
Colour = AccentColour, Colour = AccentColour,

View File

@ -25,13 +25,13 @@ namespace osu.Game.Modes.Taiko.Objects
/// <summary> /// <summary>
/// Velocity of the drum roll in positional length units per millisecond. /// Velocity of the drum roll in positional length units per millisecond.
/// </summary> /// </summary>
public double Velocity { get; protected set; } public double Velocity { get; protected set; } = 5;
/// <summary> /// <summary>
/// The distance between ticks of this drumroll. /// The distance between ticks of this drumroll.
/// <para>Half of this value is the hit window of the ticks.</para> /// <para>Half of this value is the hit window of the ticks.</para>
/// </summary> /// </summary>
public double TickTimeDistance { get; protected set; } public double TickTimeDistance { get; protected set; } = 100;
/// <summary> /// <summary>
/// Number of drum roll ticks required for a "Good" hit. /// Number of drum roll ticks required for a "Good" hit.
@ -88,6 +88,7 @@ namespace osu.Game.Modes.Taiko.Objects
PreEmpt = PreEmpt, PreEmpt = PreEmpt,
TickTimeDistance = TickTimeDistance, TickTimeDistance = TickTimeDistance,
StartTime = t, StartTime = t,
IsStrong = IsStrong,
Sample = new HitSampleInfo Sample = new HitSampleInfo
{ {
Type = SampleType.None, Type = SampleType.None,

View File

@ -58,6 +58,7 @@
<Compile Include="Objects\Drawable\DrawableStrongRimHit.cs" /> <Compile Include="Objects\Drawable\DrawableStrongRimHit.cs" />
<Compile Include="Objects\Drawable\DrawableCentreHit.cs" /> <Compile Include="Objects\Drawable\DrawableCentreHit.cs" />
<Compile Include="Objects\Drawable\DrawableHit.cs" /> <Compile Include="Objects\Drawable\DrawableHit.cs" />
<Compile Include="Objects\Drawable\DrawableStrongDrumRoll.cs" />
<Compile Include="Objects\Drawable\DrawableStrongCentreHit.cs" /> <Compile Include="Objects\Drawable\DrawableStrongCentreHit.cs" />
<Compile Include="Objects\Drawable\DrawableStrongHit.cs" /> <Compile Include="Objects\Drawable\DrawableStrongHit.cs" />
<Compile Include="Objects\Drawable\Pieces\CentreHitSymbolPiece.cs" /> <Compile Include="Objects\Drawable\Pieces\CentreHitSymbolPiece.cs" />

View File

@ -33,19 +33,15 @@ namespace osu.Game.Beatmaps.Drawables
Children = new Drawable[] Children = new Drawable[]
{ {
new DelayedLoadContainer new DelayedLoadWrapper(
{ new PanelBackground(beatmap)
RelativeSizeAxes = Axes.Both,
TimeBeforeLoad = 300,
FinishedLoading = d => d.FadeInFromZero(400, EasingTypes.Out),
Children = new[]
{ {
new PanelBackground(beatmap) RelativeSizeAxes = Axes.Both,
{ OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
RelativeSizeAxes = Axes.Both,
Depth = 1,
}
} }
)
{
TimeBeforeLoad = 300,
}, },
new FillFlowContainer new FillFlowContainer
{ {

View File

@ -150,7 +150,7 @@ namespace osu.Game
} }
}); });
(screenStack = new Loader()).LoadAsync(this, d => LoadComponentAsync(screenStack = new Loader(), d =>
{ {
screenStack.ModePushed += screenAdded; screenStack.ModePushed += screenAdded;
screenStack.Exited += screenRemoved; screenStack.Exited += screenRemoved;
@ -158,27 +158,27 @@ namespace osu.Game
}); });
//overlay elements //overlay elements
(chat = new ChatOverlay { Depth = 0 }).LoadAsync(this, overlayContent.Add); LoadComponentAsync(chat = new ChatOverlay { Depth = 0 }, overlayContent.Add);
(options = new OptionsOverlay { Depth = -1 }).LoadAsync(this, overlayContent.Add); LoadComponentAsync(options = new OptionsOverlay { Depth = -1 }, overlayContent.Add);
(musicController = new MusicController LoadComponentAsync(musicController = new MusicController
{ {
Depth = -2, Depth = -2,
Position = new Vector2(0, Toolbar.HEIGHT), Position = new Vector2(0, Toolbar.HEIGHT),
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
}).LoadAsync(this, overlayContent.Add); }, overlayContent.Add);
(notificationManager = new NotificationManager LoadComponentAsync(notificationManager = new NotificationManager
{ {
Depth = -2, Depth = -2,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
}).LoadAsync(this, overlayContent.Add); }, overlayContent.Add);
(dialogOverlay = new DialogOverlay LoadComponentAsync(dialogOverlay = new DialogOverlay
{ {
Depth = -4, Depth = -4,
}).LoadAsync(this, overlayContent.Add); }, overlayContent.Add);
Logger.NewEntry += entry => Logger.NewEntry += entry =>
{ {
@ -195,12 +195,12 @@ namespace osu.Game
Dependencies.Cache(notificationManager); Dependencies.Cache(notificationManager);
Dependencies.Cache(dialogOverlay); Dependencies.Cache(dialogOverlay);
(Toolbar = new Toolbar LoadComponentAsync(Toolbar = new Toolbar
{ {
Depth = -3, Depth = -3,
OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); }, OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); },
OnPlayModeChange = m => PlayMode.Value = m, OnPlayModeChange = m => PlayMode.Value = m,
}).LoadAsync(this, t => }, t =>
{ {
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); }; PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
PlayMode.TriggerChange(); PlayMode.TriggerChange();

View File

@ -347,12 +347,9 @@ namespace osu.Game.Overlays
} }
}); });
dragContainer.Add(new AsyncLoadContainer dragContainer.Add(new AsyncLoadWrapper(new MusicControllerBackground(beatmap)
{ {
RelativeSizeAxes = Axes.Both, OnLoadComplete = d =>
Depth = float.MaxValue,
Children = new[] { new MusicControllerBackground(beatmap) },
FinishedLoading = d =>
{ {
switch (direction) switch (direction)
{ {
@ -370,6 +367,9 @@ namespace osu.Game.Overlays
currentBackground.Expire(); currentBackground.Expire();
currentBackground = d; currentBackground = d;
} }
})
{
Depth = float.MaxValue,
}); });
}; };
} }

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Threading; using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input; using osu.Framework.Input;
@ -27,21 +26,13 @@ namespace osu.Game.Screens
return false; return false;
} }
private Framework.Game game;
[BackgroundDependencyLoader]
private void load(Framework.Game game)
{
this.game = game;
}
public override bool Push(Screen screen) public override bool Push(Screen screen)
{ {
// When trying to push a non-loaded GameMode, load it asynchronously and re-invoke Push // When trying to push a non-loaded GameMode, load it asynchronously and re-invoke Push
// once it's done. // once it's done.
if (screen.LoadState == LoadState.NotLoaded) if (screen.LoadState == LoadState.NotLoaded)
{ {
screen.LoadAsync(game, d => Push((BackgroundScreen)d)); LoadComponentAsync(screen, d => Push((BackgroundScreen)d));
return true; return true;
} }

View File

@ -32,7 +32,7 @@ namespace osu.Game.Screens.Backgrounds
{ {
var newBackground = beatmap == null ? new Background(@"Backgrounds/bg1") : new BeatmapBackground(beatmap); var newBackground = beatmap == null ? new Background(@"Backgrounds/bg1") : new BeatmapBackground(beatmap);
newBackground.LoadAsync(Game, delegate LoadComponentAsync(newBackground, delegate
{ {
float newDepth = 0; float newDepth = 0;
if (background != null) if (background != null)

View File

@ -20,9 +20,9 @@ namespace osu.Game.Screens
private void load(OsuGame game) private void load(OsuGame game)
{ {
if (game.IsDeployedBuild) if (game.IsDeployedBuild)
new Disclaimer().LoadAsync(game, d => Push((Screen)d)); LoadComponentAsync(new Disclaimer(), d => Push((Screen)d));
else else
new Intro().LoadAsync(game, d => Push((Screen)d)); LoadComponentAsync(new Intro(), d => Push((Screen)d));
} }
} }
} }

View File

@ -88,9 +88,9 @@ namespace osu.Game.Screens.Menu
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGame game, OsuColour colours) private void load(OsuColour colours)
{ {
(intro = new Intro()).LoadAsync(game); LoadComponentAsync(intro = new Intro());
iconColour = colours.Yellow; iconColour = colours.Yellow;
} }

View File

@ -76,7 +76,7 @@ namespace osu.Game.Screens.Menu
{ {
bgm.Start(); bgm.Start();
(mainMenu = new MainMenu()).LoadAsync(Game); LoadComponentAsync(mainMenu = new MainMenu());
Scheduler.AddDelayed(delegate Scheduler.AddDelayed(delegate
{ {

View File

@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGame game) private void load(OsuGame game)
{ {
background.LoadAsync(game); LoadComponentAsync(background);
buttons.OnSettings = game.ToggleOptions; buttons.OnSettings = game.ToggleOptions;
@ -67,10 +67,7 @@ namespace osu.Game.Screens.Menu
private void preloadSongSelect() private void preloadSongSelect()
{ {
if (songSelect == null) if (songSelect == null)
{ LoadComponentAsync(songSelect = new PlaySongSelect());
songSelect = new PlaySongSelect();
songSelect.LoadAsync(Game);
}
} }
private Screen consumeSongSelect() private Screen consumeSongSelect()

View File

@ -225,7 +225,7 @@ namespace osu.Game.Screens.Play
var newPlayer = new Player(); var newPlayer = new Player();
newPlayer.LoadAsync(Game, delegate LoadComponentAsync(newPlayer, delegate
{ {
newPlayer.RestartCount = RestartCount + 1; newPlayer.RestartCount = RestartCount + 1;
ValidForResume = false; ValidForResume = false;

View File

@ -50,7 +50,7 @@ namespace osu.Game.Screens.Play
Origin = Anchor.Centre, Origin = Anchor.Centre,
}); });
player.LoadAsync(Game); LoadComponentAsync(player);
} }
protected override void OnEntering(Screen last) protected override void OnEntering(Screen last)

View File

@ -103,111 +103,109 @@ namespace osu.Game.Screens.Select
labels.AddRange(Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); labels.AddRange(Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
} }
Add(beatmapInfoContainer = new AsyncLoadContainer AlwaysPresent = true;
{
FinishedLoading = d =>
{
FadeIn(250);
lastContainer?.FadeOut(250); Add(beatmapInfoContainer = new AsyncLoadWrapper(
lastContainer?.Expire(); new BufferedContainer
},
Depth = newDepth,
RelativeSizeAxes = Axes.Both,
Children = new[]
{ {
new BufferedContainer OnLoadComplete = d =>
{ {
PixelSnapping = true, FadeIn(250);
CacheDrawnFrameBuffer = true,
Shear = -Shear, lastContainer?.FadeOut(250);
RelativeSizeAxes = Axes.Both, lastContainer?.Expire();
Children = new Drawable[] },
PixelSnapping = true,
CacheDrawnFrameBuffer = true,
Shear = -Shear,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
// We will create the white-to-black gradient by modulating transparency and having
// a black backdrop. This results in an sRGB-space gradient and not linear space,
// transitioning from white to black more perceptually uniformly.
new Box
{ {
// We will create the white-to-black gradient by modulating transparency and having RelativeSizeAxes = Axes.Both,
// a black backdrop. This results in an sRGB-space gradient and not linear space, Colour = Color4.Black,
// transitioning from white to black more perceptually uniformly. },
new Box // We use a container, such that we can set the colour gradient to go across the
// vertices of the masked container instead of the vertices of the (larger) sprite.
new Container
{
RelativeSizeAxes = Axes.Both,
ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
Children = new[]
{ {
RelativeSizeAxes = Axes.Both, // Zoomed-in and cropped beatmap background
Colour = Color4.Black, new BeatmapBackgroundSprite(beatmap)
},
// We use a container, such that we can set the colour gradient to go across the
// vertices of the masked container instead of the vertices of the (larger) sprite.
new Container
{
RelativeSizeAxes = Axes.Both,
ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
Children = new[]
{ {
// Zoomed-in and cropped beatmap background Anchor = Anchor.Centre,
new BeatmapBackgroundSprite(beatmap) Origin = Anchor.Centre,
{ FillMode = FillMode.Fill,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
},
}, },
}, },
// Text for beatmap info },
new FillFlowContainer // Text for beatmap info
new FillFlowContainer
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
Anchor = Anchor.BottomLeft, new OsuSpriteText
Origin = Anchor.BottomLeft,
Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
new OsuSpriteText Font = @"Exo2.0-MediumItalic",
Text = metadata.Artist + " -- " + metadata.Title,
TextSize = 28,
Shadow = true,
},
new OsuSpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = beatmapInfo.Version,
TextSize = 17,
Shadow = true,
},
new FillFlowContainer
{
Margin = new MarginPadding { Top = 10 },
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Children = new[]
{ {
Font = @"Exo2.0-MediumItalic", new OsuSpriteText
Text = metadata.Artist + " -- " + metadata.Title,
TextSize = 28,
Shadow = true,
},
new OsuSpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = beatmapInfo.Version,
TextSize = 17,
Shadow = true,
},
new FillFlowContainer
{
Margin = new MarginPadding { Top = 10 },
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Children = new[]
{ {
new OsuSpriteText Font = @"Exo2.0-Medium",
{ Text = "mapped by ",
Font = @"Exo2.0-Medium", TextSize = 15,
Text = "mapped by ", Shadow = true,
TextSize = 15, },
Shadow = true, new OsuSpriteText
}, {
new OsuSpriteText Font = @"Exo2.0-Bold",
{ Text = metadata.Author,
Font = @"Exo2.0-Bold", TextSize = 15,
Text = metadata.Author, Shadow = true,
TextSize = 15, },
Shadow = true, }
}, },
} new FillFlowContainer
}, {
new FillFlowContainer Margin = new MarginPadding { Top = 20 },
{ Spacing = new Vector2(40, 0),
Margin = new MarginPadding { Top = 20 }, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(40, 0), Children = labels
AutoSizeAxes = Axes.Both, },
Children = labels }
}, },
}
},
}
} }
} })
{
Depth = newDepth,
}); });
} }

View File

@ -141,26 +141,23 @@ namespace osu.Game.Screens.Select.Leaderboards
Padding = new MarginPadding(edge_margin), Padding = new MarginPadding(edge_margin),
Children = new Drawable[] Children = new Drawable[]
{ {
avatar = new DelayedLoadContainer avatar = new DelayedLoadWrapper(
new Avatar(Score.User ?? new User { Id = Score.UserID })
{
RelativeSizeAxes = Axes.Both,
CornerRadius = corner_radius,
Masking = true,
OnLoadComplete = d => d.FadeInFromZero(200),
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Radius = 1,
Colour = Color4.Black.Opacity(0.2f),
},
})
{ {
TimeBeforeLoad = 500, TimeBeforeLoad = 500,
FinishedLoading = d => d.FadeInFromZero(200),
Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2),
Children = new Drawable[]
{
new Avatar(Score.User ?? new User { Id = Score.UserID })
{
RelativeSizeAxes = Axes.Both,
CornerRadius = corner_radius,
Masking = true,
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Radius = 1,
Colour = Color4.Black.Opacity(0.2f),
},
},
}
}, },
new Container new Container
{ {

View File

@ -81,10 +81,10 @@ namespace osu.Game.Screens.Select
{ {
if (player != null) return; if (player != null) return;
(player = new PlayerLoader(new Player LoadComponentAsync(player = new PlayerLoader(new Player
{ {
Beatmap = Beatmap, //eagerly set this so it's present before push. Beatmap = Beatmap, //eagerly set this so it's present before push.
})).LoadAsync(Game, l => Push(player)); }), l => Push(player));
} }
} }
} }

View File

@ -40,15 +40,11 @@ namespace osu.Game.Users
{ {
displayedAvatar?.FadeOut(300); displayedAvatar?.FadeOut(300);
displayedAvatar?.Expire(); displayedAvatar?.Expire();
Add(displayedAvatar = new AsyncLoadContainer Add(displayedAvatar = new AsyncLoadWrapper(new Avatar(user)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FinishedLoading = d => d.FadeInFromZero(200), OnLoadComplete = d => d.FadeInFromZero(200),
Children = new[] }));
{
new Avatar(user) { RelativeSizeAxes = Axes.Both }
}
});
} }
} }
} }