1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-15 03:02:36 +08:00

Compare commits

...

65 Commits

83 changed files with 518 additions and 368 deletions
+3 -2
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -31,7 +32,7 @@ namespace osu.Desktop.Overlays
public override bool HandleMouseInput => false;
[BackgroundDependencyLoader]
private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host)
private async Task load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host)
{
notificationOverlay = notification;
this.config = config;
@@ -86,7 +87,7 @@ namespace osu.Desktop.Overlays
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Texture = textures.Get(@"Menu/dev-build-footer"),
Texture = await textures.GetAsync(@"Menu/dev-build-footer"),
},
}
}
+2 -2
View File
@@ -28,8 +28,8 @@
<ItemGroup Label="Package References">
<PackageReference Include="System.IO.Packaging" Version="4.5.0" />
<PackageReference Include="ppy.squirrel.windows" Version="1.8.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.2" />
</ItemGroup>
<ItemGroup Label="Resources">
<EmbeddedResource Include="lazer.ico" />
+3 -2
View File
@@ -3,6 +3,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -448,9 +449,9 @@ namespace osu.Game.Rulesets.Catch.UI
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
Texture = textures.Get(@"Play/Catch/fruit-catcher-idle");
Texture = await textures.GetAsync(@"Play/Catch/fruit-catcher-idle");
}
}
}
@@ -173,26 +173,18 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
var pattern = new Pattern();
int usableColumns = TotalColumns - RandomStart - PreviousPattern.ColumnWithObjects;
int nextColumn = Random.Next(RandomStart, TotalColumns);
int nextColumn = GetRandomColumn();
for (int i = 0; i < Math.Min(usableColumns, noteCount); i++)
{
// Find available column
RunWhile(() => pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn), () =>
{
nextColumn = Random.Next(RandomStart, TotalColumns);
});
nextColumn = FindAvailableColumn(nextColumn, pattern, PreviousPattern);
addToPattern(pattern, nextColumn, startTime, EndTime);
}
// This is can't be combined with the above loop due to RNG
for (int i = 0; i < noteCount - usableColumns; i++)
{
RunWhile(() => pattern.ColumnHasObject(nextColumn), () =>
{
nextColumn = Random.Next(RandomStart, TotalColumns);
});
nextColumn = FindAvailableColumn(nextColumn, pattern);
addToPattern(pattern, nextColumn, startTime, EndTime);
}
@@ -217,23 +209,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns)
{
RunWhile(() => PreviousPattern.ColumnHasObject(nextColumn), () =>
{
nextColumn = Random.Next(RandomStart, TotalColumns);
});
}
nextColumn = FindAvailableColumn(nextColumn, PreviousPattern);
int lastColumn = nextColumn;
for (int i = 0; i < noteCount; i++)
{
addToPattern(pattern, nextColumn, startTime, startTime);
RunWhile(() => nextColumn == lastColumn, () =>
{
nextColumn = Random.Next(RandomStart, TotalColumns);
});
nextColumn = FindAvailableColumn(nextColumn, validation: c => c != lastColumn);
lastColumn = nextColumn;
startTime += SegmentDuration;
}
@@ -325,7 +307,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
if (TotalColumns > 2)
addToPattern(pattern, nextColumn, startTime, startTime);
nextColumn = Random.Next(RandomStart, TotalColumns);
nextColumn = GetRandomColumn();
startTime += SegmentDuration;
}
@@ -404,20 +386,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns)
{
RunWhile(() => PreviousPattern.ColumnHasObject(nextColumn), () =>
{
nextColumn = Random.Next(RandomStart, TotalColumns);
});
}
nextColumn = FindAvailableColumn(nextColumn, PreviousPattern);
for (int i = 0; i < columnRepeat; i++)
{
RunWhile(() => pattern.ColumnHasObject(nextColumn), () =>
{
nextColumn = Random.Next(RandomStart, TotalColumns);
});
nextColumn = FindAvailableColumn(nextColumn, pattern);
addToPattern(pattern, nextColumn, startTime, EndTime);
startTime += SegmentDuration;
}
@@ -442,17 +415,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int holdColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns)
{
RunWhile(() => PreviousPattern.ColumnHasObject(holdColumn), () =>
{
holdColumn = Random.Next(RandomStart, TotalColumns);
});
}
holdColumn = FindAvailableColumn(holdColumn, PreviousPattern);
// Create the hold note
addToPattern(pattern, holdColumn, startTime, EndTime);
int nextColumn = Random.Next(RandomStart, TotalColumns);
int nextColumn = GetRandomColumn();
int noteCount;
if (ConversionDifficulty > 6.5)
noteCount = GetRandomNoteCount(0.63, 0);
@@ -473,11 +441,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
for (int j = 0; j < noteCount; j++)
{
RunWhile(() => rowPattern.ColumnHasObject(nextColumn) || nextColumn == holdColumn, () =>
{
nextColumn = Random.Next(RandomStart, TotalColumns);
});
nextColumn = FindAvailableColumn(nextColumn, validation: c => c != holdColumn, patterns: rowPattern);
addToPattern(rowPattern, nextColumn, startTime, startTime);
}
}
@@ -39,34 +39,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
addToPattern(pattern, 0, generateHold);
break;
case 8:
addToPattern(pattern, getNextRandomColumn(RandomStart), generateHold);
addToPattern(pattern, FindAvailableColumn(GetRandomColumn(), PreviousPattern), generateHold);
break;
default:
if (TotalColumns > 0)
addToPattern(pattern, getNextRandomColumn(0), generateHold);
addToPattern(pattern, GetRandomColumn(), generateHold);
break;
}
return pattern;
}
/// <summary>
/// Picks a random column after a column.
/// </summary>
/// <param name="start">The starting column.</param>
/// <returns>A random column after <paramref name="start"/>.</returns>
private int getNextRandomColumn(int start)
{
int nextColumn = Random.Next(start, TotalColumns);
RunWhile(() => PreviousPattern.ColumnHasObject(nextColumn), () =>
{
nextColumn = Random.Next(start, TotalColumns);
});
return nextColumn;
}
/// <summary>
/// Constructs and adds a note to a pattern.
/// </summary>
@@ -25,9 +25,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
PatternType lastStair, IBeatmap originalBeatmap)
: base(random, hitObject, beatmap, previousPattern, originalBeatmap)
{
if (previousTime > hitObject.StartTime) throw new ArgumentOutOfRangeException(nameof(previousTime));
if (density < 0) throw new ArgumentOutOfRangeException(nameof(density));
StairType = lastStair;
TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime);
@@ -234,22 +231,27 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
for (int i = 0; i < noteCount; i++)
{
RunWhile(() => pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn) && !allowStacking, () =>
{
if (convertType.HasFlag(PatternType.Gathered))
{
nextColumn++;
if (nextColumn == TotalColumns)
nextColumn = RandomStart;
}
else
nextColumn = Random.Next(RandomStart, TotalColumns);
});
nextColumn = allowStacking
? FindAvailableColumn(nextColumn, nextColumn: getNextColumn, patterns: pattern)
: FindAvailableColumn(nextColumn, nextColumn: getNextColumn, patterns: new[] { pattern, PreviousPattern });
addToPattern(pattern, nextColumn);
}
return pattern;
int getNextColumn(int last)
{
if (convertType.HasFlag(PatternType.Gathered))
{
last++;
if (last == TotalColumns)
last = RandomStart;
}
else
last = GetRandomColumn();
return last;
}
}
/// <summary>
@@ -295,13 +297,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int noteCount = getRandomNoteCountMirrored(centreProbability, p2, p3, out addToCentre);
int columnLimit = (TotalColumns % 2 == 0 ? TotalColumns : TotalColumns - 1) / 2;
int nextColumn = Random.Next(RandomStart, columnLimit);
int nextColumn = GetRandomColumn(upperBound: columnLimit);
for (int i = 0; i < noteCount; i++)
{
RunWhile(() => pattern.ColumnHasObject(nextColumn), () =>
{
nextColumn = Random.Next(RandomStart, columnLimit);
});
nextColumn = FindAvailableColumn(nextColumn, upperBound: columnLimit, patterns: pattern);
// Add normal note
addToPattern(pattern, nextColumn);
@@ -3,6 +3,7 @@
using System;
using System.Linq;
using JetBrains.Annotations;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.MathUtils;
using osu.Game.Rulesets.Objects;
@@ -90,6 +91,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
}
private double? conversionDifficulty;
/// <summary>
/// A difficulty factor used for various conversion methods from osu!stable.
/// </summary>
@@ -116,5 +118,82 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
return conversionDifficulty.Value;
}
}
/// <summary>
/// Finds a new column in which a <see cref="HitObject"/> can be placed.
/// This uses <see cref="GetRandomColumn"/> to pick the next candidate column.
/// </summary>
/// <param name="initialColumn">The initial column to test. This may be returned if it is already a valid column.</param>
/// <param name="patterns">A list of patterns for which the validity of a column should be checked against.
/// A column is not a valid candidate if a <see cref="HitObject"/> occupies the same column in any of the patterns.</param>
/// <returns>A column for which there are no <see cref="HitObject"/>s in any of <paramref name="patterns"/> occupying the same column.</returns>
/// <exception cref="NotEnoughColumnsException">If there are no valid candidate columns.</exception>
protected int FindAvailableColumn(int initialColumn, params Pattern[] patterns)
=> FindAvailableColumn(initialColumn, null, patterns: patterns);
/// <summary>
/// Finds a new column in which a <see cref="HitObject"/> can be placed.
/// </summary>
/// <param name="initialColumn">The initial column to test. This may be returned if it is already a valid column.</param>
/// <param name="nextColumn">A function to retrieve the next column. If null, a randomisation scheme will be used.</param>
/// <param name="validation">A function to perform additional validation checks to determine if a column is a valid candidate for a <see cref="HitObject"/>.</param>
/// <param name="lowerBound">The minimum column index. If null, <see cref="RandomStart"/> is used.</param>
/// <param name="upperBound">The maximum column index. If null, <see cref="PatternGenerator.TotalColumns"/> is used.</param>
/// <param name="patterns">A list of patterns for which the validity of a column should be checked against.
/// A column is not a valid candidate if a <see cref="HitObject"/> occupies the same column in any of the patterns.</param>
/// <returns>A column which has passed the <paramref name="validation"/> check and for which there are no
/// <see cref="HitObject"/>s in any of <paramref name="patterns"/> occupying the same column.</returns>
/// <exception cref="NotEnoughColumnsException">If there are no valid candidate columns.</exception>
protected int FindAvailableColumn(int initialColumn, int? lowerBound = null, int? upperBound = null, Func<int, int> nextColumn = null, [InstantHandle] Func<int, bool> validation = null,
params Pattern[] patterns)
{
lowerBound = lowerBound ?? RandomStart;
upperBound = upperBound ?? TotalColumns;
nextColumn = nextColumn ?? (_ => GetRandomColumn(lowerBound, upperBound));
// Check for the initial column
if (isValid(initialColumn))
return initialColumn;
// Ensure that we have at least one free column, so that an endless loop is avoided
bool hasValidColumns = false;
for (int i = lowerBound.Value; i < upperBound.Value; i++)
{
hasValidColumns = isValid(i);
if (hasValidColumns)
break;
}
if (!hasValidColumns)
throw new NotEnoughColumnsException();
// Iterate until a valid column is found. This is a random iteration in the default case.
do
{
initialColumn = nextColumn(initialColumn);
} while (!isValid(initialColumn));
return initialColumn;
bool isValid(int column) => validation?.Invoke(column) != false && !patterns.Any(p => p.ColumnHasObject(column));
}
/// <summary>
/// Returns a random column index in the range [<paramref name="lowerBound"/>, <paramref name="upperBound"/>).
/// </summary>
/// <param name="lowerBound">The minimum column index. If null, <see cref="RandomStart"/> is used.</param>
/// <param name="upperBound">The maximum column index. If null, <see cref="PatternGenerator.TotalColumns"/> is used.</param>
protected int GetRandomColumn(int? lowerBound = null, int? upperBound = null) => Random.Next(lowerBound ?? RandomStart, upperBound ?? TotalColumns);
/// <summary>
/// Occurs when mania conversion is stuck in an infinite loop unable to find columns to place new hitobjects in.
/// </summary>
public class NotEnoughColumnsException : Exception
{
public NotEnoughColumnsException()
: base("There were not enough columns to complete conversion.")
{
}
}
}
}
@@ -3,9 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using JetBrains.Annotations;
using osu.Framework.Logging;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
@@ -15,14 +12,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
/// </summary>
internal abstract class PatternGenerator
{
/// <summary>
/// An arbitrary maximum amount of iterations to perform in <see cref="RunWhile"/>.
/// The specific value is not super important - enough such that no false-positives occur.
///
/// /b/933228 requires at least 23 iterations.
/// </summary>
private const int max_rng_iterations = 30;
/// <summary>
/// The last pattern.
/// </summary>
@@ -53,44 +42,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
TotalColumns = Beatmap.TotalColumns;
}
protected void RunWhile([InstantHandle] Func<bool> condition, Action action)
{
int iterations = 0;
while (condition())
{
if (iterations++ >= max_rng_iterations)
{
// log an error but don't throw. we want to continue execution.
Logger.Error(new ExceededAllowedIterationsException(new StackTrace(0)),
"Conversion encountered errors. The beatmap may not be correctly converted.");
return;
}
action();
}
}
/// <summary>
/// Generates the patterns for <see cref="HitObject"/>, each filled with hit objects.
/// </summary>
/// <returns>The <see cref="Pattern"/>s containing the hit objects.</returns>
public abstract IEnumerable<Pattern> Generate();
/// <summary>
/// Denotes when a single conversion operation is in an infinitely looping state.
/// </summary>
public class ExceededAllowedIterationsException : Exception
{
private readonly string stackTrace;
public ExceededAllowedIterationsException(StackTrace stackTrace)
{
this.stackTrace = stackTrace.ToString();
}
public override string StackTrace => stackTrace;
public override string ToString() => $"{GetType().Name}: {Message}\r\n{StackTrace}";
}
}
}
+2 -2
View File
@@ -26,11 +26,11 @@ namespace osu.Game.Rulesets.Mania.UI
throw new ArgumentException("Can't have zero or fewer stages.");
GridContainer playfieldGrid;
InternalChild = playfieldGrid = new GridContainer
AddInternal(playfieldGrid = new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[] { new Drawable[stageDefinitions.Count] }
};
});
var normalColumnAction = ManiaAction.Key1;
var specialColumnAction = ManiaAction.Special1;
@@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Osu.Tests
}
}
private class TestDrawableHitCircle : DrawableHitCircle
protected class TestDrawableHitCircle : DrawableHitCircle
{
private readonly bool auto;
@@ -94,6 +94,8 @@ namespace osu.Game.Rulesets.Osu.Tests
this.auto = auto;
}
public void TriggerJudgement() => UpdateResult(true);
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (auto && !userTriggered && timeOffset > 0)
@@ -0,0 +1,23 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestCaseShaking : TestCaseHitCircle
{
public override void Add(Drawable drawable)
{
base.Add(drawable);
if (drawable is TestDrawableHitCircle hitObject)
{
Scheduler.AddDelayed(() => hitObject.TriggerJudgement(),
hitObject.HitObject.StartTime - (hitObject.HitObject.HitWindows.HalfWindowFor(HitResult.Miss) + RNG.Next(0, 300)) - Time.Current);
}
}
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Mods
const float relax_leniency = 3;
foreach (var drawable in playfield.HitObjects.AliveObjects)
foreach (var drawable in playfield.HitObjectContainer.AliveObjects)
{
if (!(drawable is DrawableOsuHitObject osuHit))
continue;
@@ -88,7 +88,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
var result = HitObject.HitWindows.ResultFor(timeOffset);
if (result == HitResult.None)
{
Shake(Math.Abs(timeOffset) - HitObject.HitWindows.HalfWindowFor(HitResult.Miss));
return;
}
ApplyResult(r => r.Type = result);
}
@@ -10,6 +10,7 @@ using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
using OpenTK.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
@@ -17,12 +18,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public override bool IsPresent => base.IsPresent || State.Value == ArmedState.Idle && Time.Current >= HitObject.StartTime - HitObject.TimePreempt;
private readonly ShakeContainer shakeContainer;
protected DrawableOsuHitObject(OsuHitObject hitObject)
: base(hitObject)
{
base.AddInternal(shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both });
Alpha = 0;
}
// Forward all internal management to shakeContainer.
// This is a bit ugly but we don't have the concept of InternalContent so it'll have to do for now. (https://github.com/ppy/osu-framework/issues/1690)
protected override void AddInternal(Drawable drawable) => shakeContainer.Add(drawable);
protected override void ClearInternal(bool disposeChildren = true) => shakeContainer.Clear(disposeChildren);
protected override bool RemoveInternal(Drawable drawable) => shakeContainer.Remove(drawable);
protected sealed override void UpdateState(ArmedState state)
{
double transformTime = HitObject.StartTime - HitObject.TimePreempt;
@@ -68,6 +78,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private OsuInputManager osuActionInputManager;
internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager);
protected virtual void Shake(double maximumLength) => shakeContainer.Shake(maximumLength);
protected override JudgementResult CreateResult(Judgement judgement) => new OsuJudgementResult(judgement);
}
}
@@ -44,14 +44,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
},
ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
Ball = new SliderBall(s)
Ball = new SliderBall(s, this)
{
BypassAutoSizeAxes = Axes.Both,
Scale = new Vector2(s.Scale),
AlwaysPresent = true,
Alpha = 0
},
HeadCircle = new DrawableSliderHead(s, s.HeadCircle),
HeadCircle = new DrawableSliderHead(s, s.HeadCircle)
{
OnShake = Shake
},
TailCircle = new DrawableSliderTail(s, s.TailCircle)
};
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Rulesets.Objects.Types;
using OpenTK;
@@ -28,5 +29,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
if (!IsHit)
Position = slider.CurvePositionAt(completionProgress);
}
public Action<double> OnShake;
protected override void Shake(double maximumLength) => OnShake?.Invoke(maximumLength);
}
}
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -12,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
public class DefaultCirclePiece : Container
{
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
@@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = textures.Get(@"Play/osu/disc"),
Texture = await textures.GetAsync(@"Play/osu/disc"),
},
new TrianglesPiece
{
@@ -36,9 +36,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
private readonly Slider slider;
public readonly Drawable FollowCircle;
private Drawable drawableBall;
private readonly DrawableSlider drawableSlider;
public SliderBall(Slider slider)
public SliderBall(Slider slider, DrawableSlider drawableSlider = null)
{
this.drawableSlider = drawableSlider;
this.slider = slider;
Masking = true;
AutoSizeAxes = Axes.Both;
@@ -155,7 +157,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Tracking = canCurrentlyTrack
&& lastState != null
&& ReceiveMouseInputAt(lastState.Mouse.NativeState.Position)
&& ((Parent as DrawableSlider)?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false);
&& (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false);
}
}
@@ -4,6 +4,7 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.OpenGL.Buffers;
@@ -79,10 +80,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
[BackgroundDependencyLoader]
private void load(ShaderManager shaders, TextureStore textures)
private async Task load(ShaderManager shaders, TextureStore textures)
{
shader = shaders?.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE);
texture = textures.Get(@"Cursor/cursortrail");
texture = await textures.GetAsync(@"Cursor/cursortrail");
Scale = new Vector2(1 / texture.ScaleAdjust);
}
+1 -1
View File
@@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Osu.UI
public override void PostProcess()
{
connectionLayer.HitObjects = HitObjects.Objects.Select(d => d.HitObject).OfType<OsuHitObject>();
connectionLayer.HitObjects = HitObjectContainer.Objects.Select(d => d.HitObject).OfType<OsuHitObject>();
}
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
+6 -5
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@@ -130,12 +131,12 @@ namespace osu.Game.Rulesets.Taiko.UI
}
[BackgroundDependencyLoader]
private void load(TextureStore textures, OsuColour colours)
private async Task load(TextureStore textures, OsuColour colours)
{
rim.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer");
rimHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer-hit");
centre.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner");
centreHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner-hit");
rim.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-outer");
rimHit.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-outer-hit");
centre.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-inner");
centreHit.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-inner-hit");
rimHit.Colour = colours.Blue;
centreHit.Colour = colours.Pink;
@@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual
[BackgroundDependencyLoader]
private void load()
{
AddInternal(trackManager);
Add(trackManager);
}
[Test]
@@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual
TestTrackOwner owner = null;
PreviewTrack track = null;
AddStep("get track", () => AddInternal(owner = new TestTrackOwner(track = getTrack())));
AddStep("get track", () => Add(owner = new TestTrackOwner(track = getTrack())));
AddStep("start", () => track.Start());
AddStep("attempt stop", () => trackManager.StopAnyPlaying(this));
AddAssert("not stopped", () => track.IsRunning);
@@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual
{
var track = getTrack();
AddInternal(track);
Add(track);
return track;
}
+7 -4
View File
@@ -319,17 +319,17 @@ namespace osu.Game.Beatmaps
/// <summary>
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
/// </summary>
public async Task ImportFromStable()
public Task ImportFromStable()
{
var stable = GetStableStorage?.Invoke();
if (stable == null)
{
Logger.Log("No osu!stable installation available!", LoggingTarget.Information, LogLevel.Error);
return;
return Task.CompletedTask;
}
await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs").Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning);
return Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs").Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning);
}
/// <summary>
@@ -351,7 +351,10 @@ namespace osu.Game.Beatmaps
// let's make sure there are actually .osu files to import.
string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu"));
if (string.IsNullOrEmpty(mapName))
throw new InvalidOperationException($"No beatmap files found in this beatmap archive ({reader.Name}).");
{
Logger.Log($"No beatmap files found in the beatmap archive ({reader.Name}).", LoggingTarget.Database);
return null;
}
Beatmap beatmap;
using (var stream = new StreamReader(reader.GetStream(mapName)))
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
@@ -23,7 +24,7 @@ namespace osu.Game.Beatmaps.Drawables
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
string resource = null;
@@ -41,7 +42,7 @@ namespace osu.Game.Beatmaps.Drawables
}
if (resource != null)
Texture = textures.Get(resource);
Texture = await textures.GetAsync(resource);
}
}
+3 -3
View File
@@ -55,11 +55,11 @@ namespace osu.Game.Beatmaps.Formats
} while (line != null && line.Length == 0);
if (line == null)
throw new IOException(@"Unknown file format");
throw new IOException(@"Unknown file format (null)");
var decoder = typedDecoders.Select(d => line.StartsWith(d.Key) ? d.Value : null).FirstOrDefault();
var decoder = typedDecoders.Select(d => line.StartsWith(d.Key, StringComparison.InvariantCulture) ? d.Value : null).FirstOrDefault();
if (decoder == null)
throw new IOException(@"Unknown file format");
throw new IOException($@"Unknown file format ({line})");
return (Decoder<T>)decoder.Invoke(line);
}
+6 -6
View File
@@ -67,7 +67,7 @@ namespace osu.Game.Beatmaps
public bool BeatmapLoaded => beatmap.IsResultAvailable;
public IBeatmap Beatmap => beatmap.Value.Result;
public async Task<IBeatmap> GetBeatmapAsync() => await beatmap.Value;
public Task<IBeatmap> GetBeatmapAsync() => beatmap.Value;
private readonly AsyncLazy<IBeatmap> beatmap;
private IBeatmap populateBeatmap()
@@ -138,14 +138,14 @@ namespace osu.Game.Beatmaps
public bool BackgroundLoaded => background.IsResultAvailable;
public Texture Background => background.Value.Result;
public async Task<Texture> GetBackgroundAsync() => await background.Value;
public Task<Texture> GetBackgroundAsync() => background.Value;
private AsyncLazy<Texture> background;
private Texture populateBackground() => GetBackground();
public bool TrackLoaded => track.IsResultAvailable;
public Track Track => track.Value.Result;
public async Task<Track> GetTrackAsync() => await track.Value;
public Task<Track> GetTrackAsync() => track.Value;
private AsyncLazy<Track> track;
private Track populateTrack()
@@ -158,21 +158,21 @@ namespace osu.Game.Beatmaps
public bool WaveformLoaded => waveform.IsResultAvailable;
public Waveform Waveform => waveform.Value.Result;
public async Task<Waveform> GetWaveformAsync() => await waveform.Value;
public Task<Waveform> GetWaveformAsync() => waveform.Value;
private readonly AsyncLazy<Waveform> waveform;
private Waveform populateWaveform() => GetWaveform();
public bool StoryboardLoaded => storyboard.IsResultAvailable;
public Storyboard Storyboard => storyboard.Value.Result;
public async Task<Storyboard> GetStoryboardAsync() => await storyboard.Value;
public Task<Storyboard> GetStoryboardAsync() => storyboard.Value;
private readonly AsyncLazy<Storyboard> storyboard;
private Storyboard populateStoryboard() => GetStoryboard();
public bool SkinLoaded => skin.IsResultAvailable;
public Skin Skin => skin.Value.Result;
public async Task<Skin> GetSkinAsync() => await skin.Value;
public Task<Skin> GetSkinAsync() => skin.Value;
private readonly AsyncLazy<Skin> skin;
private Skin populateSkin() => GetSkin();
+3 -2
View File
@@ -178,7 +178,8 @@ namespace osu.Game.Database
{
try
{
return Import(CreateModel(archive), archive);
var model = CreateModel(archive);
return model == null ? null : Import(model, archive);
}
catch (Exception e)
{
@@ -389,7 +390,7 @@ namespace osu.Game.Database
/// Actual expensive population should be done in <see cref="Populate"/>; this should just prepare for duplicate checking.
/// </summary>
/// <param name="archive">The archive to create the model for.</param>
/// <returns>A model populated with minimal information.</returns>
/// <returns>A model populated with minimal information. Returning a null will abort importing silently.</returns>
protected abstract TModel CreateModel(ArchiveReader archive);
/// <summary>
+3 -2
View File
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -34,10 +35,10 @@ namespace osu.Game.Graphics.Backgrounds
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures)
private async Task load(LargeTextureStore textures)
{
if (!string.IsNullOrEmpty(textureName))
Sprite.Texture = textures.Get(textureName);
Sprite.Texture = await textures.GetAsync(textureName);
}
}
}
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@@ -37,15 +38,15 @@ namespace osu.Game.Graphics.Containers
}
[BackgroundDependencyLoader(true)]
private void load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager)
private async Task load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager)
{
this.previewTrackManager = previewTrackManager;
if (osuGame != null)
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
samplePopIn = await audio.Sample.GetAsync(@"UI/overlay-pop-in");
samplePopOut = await audio.Sample.GetAsync(@"UI/overlay-pop-out");
StateChanged += onStateChanged;
}
@@ -0,0 +1,39 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Graphics.Containers
{
/// <summary>
/// A container that adds the ability to shake its contents.
/// </summary>
public class ShakeContainer : Container
{
/// <summary>
/// Shake the contents of this container.
/// </summary>
/// <param name="maximumLength">The maximum length the shake should last.</param>
public void Shake(double maximumLength)
{
const float shake_amount = 8;
const float shake_duration = 30;
// if we don't have enough time, don't bother shaking.
if (maximumLength < shake_duration * 2)
return;
var sequence = this.MoveToX(shake_amount, shake_duration / 2, Easing.OutSine).Then()
.MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then();
// if we don't have enough time for the second shake, skip it.
if (maximumLength > shake_duration * 4)
sequence = sequence
.MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then()
.MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then();
sequence.MoveToX(0, shake_duration / 2, Easing.InSine);
}
}
}
+4 -3
View File
@@ -10,6 +10,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;
using System;
using System.Threading.Tasks;
using JetBrains.Annotations;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.EventArgs;
@@ -132,7 +133,7 @@ namespace osu.Game.Graphics.Cursor
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config, TextureStore textures, OsuColour colour)
private async Task load(OsuConfigManager config, TextureStore textures, OsuColour colour)
{
Children = new Drawable[]
{
@@ -143,14 +144,14 @@ namespace osu.Game.Graphics.Cursor
{
new Sprite
{
Texture = textures.Get(@"Cursor/menu-cursor"),
Texture = await textures.GetAsync(@"Cursor/menu-cursor"),
},
AdditiveLayer = new Sprite
{
Blending = BlendingMode.Additive,
Colour = colour.Pink,
Alpha = 0,
Texture = textures.Get(@"Cursor/menu-cursor-additive"),
Texture = await textures.GetAsync(@"Cursor/menu-cursor-additive"),
},
}
}
+3 -3
View File
@@ -42,7 +42,7 @@ namespace osu.Game.Graphics
private SampleChannel shutter;
[BackgroundDependencyLoader]
private void load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio)
private async Task load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio)
{
this.host = host;
this.storage = storage.GetStorageForDirectory(@"screenshots");
@@ -51,7 +51,7 @@ namespace osu.Game.Graphics
screenshotFormat = config.GetBindable<ScreenshotFormat>(OsuSetting.ScreenshotFormat);
captureMenuCursor = config.GetBindable<bool>(OsuSetting.ScreenshotCaptureMenuCursor);
shutter = audio.Sample.Get("UI/shutter");
shutter = await audio.Sample.GetAsync("UI/shutter");
}
public bool OnPressed(GlobalAction action)
@@ -71,7 +71,7 @@ namespace osu.Game.Graphics
private volatile int screenShotTasks;
public async Task TakeScreenshotAsync() => await Task.Run(async () =>
public Task TakeScreenshotAsync() => Task.Run(async () =>
{
Interlocked.Increment(ref screenShotTasks);
+8 -7
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@@ -24,7 +25,7 @@ namespace osu.Game.Graphics
private FontStore store;
[BackgroundDependencyLoader]
private void load(FontStore store)
private async Task load(FontStore store)
{
this.store = store;
@@ -55,23 +56,23 @@ namespace osu.Game.Graphics
},
};
updateTexture();
await updateTexture();
}
protected override void LoadComplete()
{
base.LoadComplete();
updateTexture();
updateTexture().Wait();
}
private FontAwesome loadedIcon;
private void updateTexture()
private async Task updateTexture()
{
var loadableIcon = icon;
if (loadableIcon == loadedIcon) return;
var texture = store?.Get(((char)loadableIcon).ToString());
var texture = await store.GetAsync(((char)loadableIcon).ToString());
spriteMain.Texture = texture;
spriteShadow.Texture = texture;
@@ -129,8 +130,8 @@ namespace osu.Game.Graphics
if (icon == value) return;
icon = value;
if (IsLoaded)
updateTexture();
if (LoadState == LoadState.Loaded)
updateTexture().Wait();
}
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace osu.Game.Graphics.Sprites
protected override Drawable CreateFallbackCharacterDrawable()
{
var tex = GetTextureForCharacter('?');
var tex = GetTextureForCharacter('?').Result;
if (tex != null)
{
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@@ -28,9 +29,9 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
private async Task load(AudioManager audio)
{
sampleClick = audio.Sample.Get($@"UI/generic-select{SampleSet.GetDescription()}");
sampleClick = await audio.Sample.GetAsync($@"UI/generic-select{SampleSet.GetDescription()}");
}
}
}
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@@ -35,9 +36,9 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
private async Task load(AudioManager audio)
{
sampleHover = audio.Sample.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
sampleHover = await audio.Sample.GetAsync($@"UI/generic-hover{SampleSet.GetDescription()}");
}
}
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@@ -110,10 +111,10 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
private async Task load(AudioManager audio)
{
sampleChecked = audio.Sample.Get(@"UI/check-on");
sampleUnchecked = audio.Sample.Get(@"UI/check-off");
sampleChecked = await audio.Sample.GetAsync(@"UI/check-on");
sampleUnchecked = await audio.Sample.GetAsync(@"UI/check-off");
}
}
}
+4 -3
View File
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@@ -69,10 +70,10 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
private async Task load(AudioManager audio)
{
sampleHover = audio.Sample.Get(@"UI/generic-hover");
sampleClick = audio.Sample.Get(@"UI/generic-select");
sampleHover = await audio.Sample.GetAsync(@"UI/generic-hover");
sampleClick = await audio.Sample.GetAsync(@"UI/generic-select");
BackgroundColour = Color4.Transparent;
BackgroundColourHover = OsuColour.FromHex(@"172023");
@@ -3,6 +3,7 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
@@ -119,9 +120,9 @@ namespace osu.Game.Graphics.UserInterface
}
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours)
private async Task load(AudioManager audio, OsuColour colours)
{
sample = audio.Sample.Get(@"UI/sliderbar-notch");
sample = await audio.Sample.GetAsync(@"UI/sliderbar-notch");
AccentColour = colours.Pink;
}
+5 -2
View File
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using osu.Framework.IO.Stores;
namespace osu.Game.IO.Archives
@@ -28,7 +29,9 @@ namespace osu.Game.IO.Archives
public abstract IEnumerable<string> Filenames { get; }
public virtual byte[] Get(string name)
public virtual byte[] Get(string name) => GetAsync(name).Result;
public async Task<byte[]> GetAsync(string name)
{
using (Stream input = GetStream(name))
{
@@ -36,7 +39,7 @@ namespace osu.Game.IO.Archives
return null;
byte[] buffer = new byte[input.Length];
input.Read(buffer, 0, buffer.Length);
await input.ReadAsync(buffer, 0, buffer.Length);
return buffer;
}
}
+16 -14
View File
@@ -506,22 +506,24 @@ namespace osu.Game
// we could avoid the need for scheduling altogether.
Schedule(() =>
{
if (asyncLoadStream != null)
var previousLoadStream = asyncLoadStream;
//chain with existing load stream
asyncLoadStream = Task.Run(async () =>
{
//chain with existing load stream
asyncLoadStream = asyncLoadStream.ContinueWith(async t =>
if (previousLoadStream != null)
await previousLoadStream;
try
{
try
{
await LoadComponentAsync(d, add);
}
catch (OperationCanceledException)
{
}
});
}
else
asyncLoadStream = LoadComponentAsync(d, add);
Logger.Log($"Loading {d}...", LoggingTarget.Debug);
await LoadComponentAsync(d, add);
Logger.Log($"Loaded {d}!", LoggingTarget.Debug);
}
catch (OperationCanceledException)
{
}
});
});
}
+18 -3
View File
@@ -240,6 +240,15 @@ namespace osu.Game.Overlays
});
}
protected override void PopIn()
{
base.PopIn();
// Queries are allowed to be run only on the first pop-in
if (getSetsRequest == null)
Scheduler.AddOnce(updateSearch);
}
private SearchBeatmapSetsRequest getSetsRequest;
private readonly Bindable<string> currentQuery = new Bindable<string>();
@@ -251,16 +260,22 @@ namespace osu.Game.Overlays
{
queryChangedDebounce?.Cancel();
if (!IsLoaded) return;
if (!IsLoaded)
return;
if (State == Visibility.Hidden)
return;
BeatmapSets = null;
ResultAmounts = null;
getSetsRequest?.Cancel();
if (api == null) return;
if (api == null)
return;
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) return;
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty))
return;
previewTrackManager.StopAnyPlaying(this);
+4 -3
View File
@@ -20,6 +20,7 @@ using OpenTK.Input;
using osu.Framework.Graphics.Shapes;
using System;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Input.States;
using osu.Framework.MathUtils;
@@ -143,10 +144,10 @@ namespace osu.Game.Overlays
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, TextureStore textures, AudioManager audio)
private async Task load(OsuColour colours, TextureStore textures, AudioManager audio)
{
getSample = audio.Sample.Get(@"MedalSplash/medal-get");
innerSpin.Texture = outerSpin.Texture = textures.Get(@"MedalSplash/disc-spin");
getSample = await audio.Sample.GetAsync(@"MedalSplash/medal-get");
innerSpin.Texture = outerSpin.Texture = await textures.GetAsync(@"MedalSplash/disc-spin");
disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffectParameters
{
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework;
using OpenTK;
using osu.Framework.Allocation;
@@ -118,10 +119,10 @@ namespace osu.Game.Overlays.MedalSplash
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, TextureStore textures)
private async Task load(OsuColour colours, TextureStore textures)
{
medalSprite.Texture = textures.Get(medal.ImageUrl);
medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow");
medalSprite.Texture = await textures.GetAsync(medal.ImageUrl);
medalGlow.Texture = await textures.GetAsync(@"MedalSplash/medal-glow");
description.Colour = colours.BlueLight;
}
+4 -3
View File
@@ -15,6 +15,7 @@ using osu.Game.Rulesets.Mods;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics.Shapes;
@@ -49,7 +50,7 @@ namespace osu.Game.Overlays.Mods
protected readonly IBindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, IBindable<RulesetInfo> ruleset, AudioManager audio, Bindable<IEnumerable<Mod>> selectedMods)
private async Task load(OsuColour colours, IBindable<RulesetInfo> ruleset, AudioManager audio, Bindable<IEnumerable<Mod>> selectedMods)
{
LowMultiplierColour = colours.Red;
HighMultiplierColour = colours.Green;
@@ -58,8 +59,8 @@ namespace osu.Game.Overlays.Mods
Ruleset.BindTo(ruleset);
if (selectedMods != null) SelectedMods.BindTo(selectedMods);
sampleOn = audio.Sample.Get(@"UI/check-on");
sampleOff = audio.Sample.Get(@"UI/check-off");
sampleOn = await audio.Sample.GetAsync(@"UI/check-on");
sampleOff = await audio.Sample.GetAsync(@"UI/check-off");
}
protected override void LoadComplete()
+2 -2
View File
@@ -454,9 +454,9 @@ namespace osu.Game.Overlays
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg4");
sprite.Texture = beatmap?.Background ?? await textures.GetAsync(@"Backgrounds/bg4");
}
}
+1 -2
View File
@@ -96,8 +96,7 @@ namespace osu.Game.Overlays
base.LoadComplete();
StateChanged += _ => updateProcessingMode();
OverlayActivationMode.ValueChanged += _ => updateProcessingMode();
OverlayActivationMode.TriggerChange();
OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true);
}
private int totalCount => sections.Select(c => c.DisplayedCount).Sum();
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -42,9 +43,9 @@ namespace osu.Game.Overlays.Profile.Components
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
badge.Texture = textures.Get($"Grades/{grade}");
badge.Texture = await textures.GetAsync($"Grades/{grade}");
}
}
}
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -176,13 +177,13 @@ namespace osu.Game.Overlays.Profile.Header
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
Child = new Sprite
{
FillMode = FillMode.Fit,
RelativeSizeAxes = Axes.Both,
Texture = textures.Get(badge.ImageUrl),
Texture = await textures.GetAsync(badge.ImageUrl),
};
}
+3 -2
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
@@ -311,9 +312,9 @@ namespace osu.Game.Overlays.Profile
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
levelBadge.Texture = textures.Get(@"Profile/levelbadge");
levelBadge.Texture = await textures.GetAsync(@"Profile/levelbadge");
}
private User user;
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
@@ -30,9 +31,9 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
sprite.Texture = textures.Get(url);
sprite.Texture = await textures.GetAsync(url);
}
}
}
+7 -7
View File
@@ -19,12 +19,12 @@ namespace osu.Game.Rulesets.UI
/// <summary>
/// The <see cref="DrawableHitObject"/> contained in this Playfield.
/// </summary>
public HitObjectContainer HitObjects { get; private set; }
public HitObjectContainer HitObjectContainer { get; private set; }
/// <summary>
/// All the <see cref="DrawableHitObject"/>s contained in this <see cref="Playfield"/> and all <see cref="NestedPlayfields"/>.
/// </summary>
public IEnumerable<DrawableHitObject> AllHitObjects => HitObjects?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty<DrawableHitObject>();
public IEnumerable<DrawableHitObject> AllHitObjects => HitObjectContainer?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty<DrawableHitObject>();
/// <summary>
/// All <see cref="Playfield"/>s nested inside this <see cref="Playfield"/>.
@@ -60,10 +60,10 @@ namespace osu.Game.Rulesets.UI
{
this.beatmap = beatmap.Value;
HitObjects = CreateHitObjectContainer();
HitObjects.RelativeSizeAxes = Axes.Both;
HitObjectContainer = CreateHitObjectContainer();
HitObjectContainer.RelativeSizeAxes = Axes.Both;
Add(HitObjects);
Add(HitObjectContainer);
}
/// <summary>
@@ -75,13 +75,13 @@ namespace osu.Game.Rulesets.UI
/// Adds a DrawableHitObject to this Playfield.
/// </summary>
/// <param name="h">The DrawableHitObject to add.</param>
public virtual void Add(DrawableHitObject h) => HitObjects.Add(h);
public virtual void Add(DrawableHitObject h) => HitObjectContainer.Add(h);
/// <summary>
/// Remove a DrawableHitObject from this Playfield.
/// </summary>
/// <param name="h">The DrawableHitObject to remove.</param>
public virtual void Remove(DrawableHitObject h) => HitObjects.Remove(h);
public virtual void Remove(DrawableHitObject h) => HitObjectContainer.Remove(h);
/// <summary>
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
+1 -1
View File
@@ -306,7 +306,7 @@ namespace osu.Game.Rulesets.UI
Playfield.PostProcess();
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>())
mod.ApplyToDrawableHitObjects(Playfield.HitObjects.Objects);
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
}
protected override void Update()
@@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
/// <summary>
/// The container that contains the <see cref="DrawableHitObject"/>s.
/// </summary>
public new ScrollingHitObjectContainer HitObjects => (ScrollingHitObjectContainer)base.HitObjects;
public new ScrollingHitObjectContainer HitObjects => (ScrollingHitObjectContainer)HitObjectContainer;
/// <summary>
/// The direction in which <see cref="DrawableHitObject"/>s in this <see cref="ScrollingPlayfield"/> should scroll.
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
@@ -75,9 +76,9 @@ namespace osu.Game.Screens.Backgrounds
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
Sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg1");
Sprite.Texture = beatmap?.Background ?? await textures.GetAsync(@"Backgrounds/bg1");
}
}
}
+3
View File
@@ -9,6 +9,7 @@ using osu.Framework.Graphics.Shaders;
using osu.Game.Screens.Menu;
using OpenTK;
using osu.Framework.Screens;
using osu.Game.Overlays;
namespace osu.Game.Screens
{
@@ -18,6 +19,8 @@ namespace osu.Game.Screens
protected override bool HideOverlaysOnEnter => true;
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
protected override bool AllowBackButton => false;
public Loader()
+4 -3
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
@@ -179,11 +180,11 @@ namespace osu.Game.Screens.Menu
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
private async Task load(AudioManager audio)
{
sampleHover = audio.Sample.Get(@"Menu/button-hover");
sampleHover = await audio.Sample.GetAsync(@"Menu/button-hover");
if (!string.IsNullOrEmpty(sampleName))
sampleClick = audio.Sample.Get($@"Menu/{sampleName}");
sampleClick = await audio.Sample.GetAsync($@"Menu/{sampleName}");
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
+8 -12
View File
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
@@ -102,10 +103,10 @@ namespace osu.Game.Screens.Menu
private OsuGame game;
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio, OsuGame game)
private async Task load(AudioManager audio, OsuGame game)
{
this.game = game;
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
sampleBack = await audio.Sample.GetAsync(@"Menu/button-back-select");
}
public bool OnPressed(GlobalAction action)
@@ -174,6 +175,9 @@ namespace osu.Game.Screens.Menu
ButtonSystemState lastState = state;
state = value;
if (game != null)
game.OverlayActivationMode.Value = state == ButtonSystemState.Exit ? OverlayActivation.Disabled : OverlayActivation.All;
updateLogoState(lastState);
Logger.Log($"{nameof(ButtonSystem)}'s state changed from {lastState} to {state}");
@@ -205,11 +209,7 @@ namespace osu.Game.Screens.Menu
{
logoTracking = false;
if (game != null)
{
game.OverlayActivationMode.Value = state == ButtonSystemState.Exit ? OverlayActivation.Disabled : OverlayActivation.All;
game.Toolbar.Hide();
}
game?.Toolbar.Hide();
logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.Both;
@@ -243,11 +243,7 @@ namespace osu.Game.Screens.Menu
if (impact)
logo.Impact();
if (game != null)
{
game.OverlayActivationMode.Value = OverlayActivation.All;
game.Toolbar.State = Visibility.Visible;
}
game?.Toolbar.Show();
}, 200);
break;
default:
+4 -3
View File
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@@ -47,7 +48,7 @@ namespace osu.Game.Screens.Menu
private WorkingBeatmap introBeatmap;
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap)
private async Task load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap)
{
this.beatmap.BindTo(beatmap);
@@ -80,8 +81,8 @@ namespace osu.Game.Screens.Menu
introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
track = introBeatmap.Track;
welcome = audio.Sample.Get(@"welcome");
seeya = audio.Sample.Get(@"seeya");
welcome = await audio.Sample.GetAsync(@"welcome");
seeya = await audio.Sample.GetAsync(@"seeya");
}
private const double delay_step_one = 2300;
+6 -5
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@@ -253,13 +254,13 @@ namespace osu.Game.Screens.Menu
}
[BackgroundDependencyLoader]
private void load(TextureStore textures, AudioManager audio)
private async Task load(TextureStore textures, AudioManager audio)
{
sampleClick = audio.Sample.Get(@"Menu/osu-logo-select");
sampleBeat = audio.Sample.Get(@"Menu/osu-logo-heartbeat");
sampleClick = await audio.Sample.GetAsync(@"Menu/osu-logo-select");
sampleBeat = await audio.Sample.GetAsync(@"Menu/osu-logo-heartbeat");
logo.Texture = textures.Get(@"Menu/logo");
ripple.Texture = textures.Get(@"Menu/logo");
logo.Texture = await textures.GetAsync(@"Menu/logo");
ripple.Texture = await textures.GetAsync(@"Menu/logo");
}
private int lastBeatIndex;
+3 -2
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Internal;
using osu.Framework.Allocation;
using osu.Framework.Audio;
@@ -80,7 +81,7 @@ namespace osu.Game.Screens
private SampleChannel sampleExit;
[BackgroundDependencyLoader(true)]
private void load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable<RulesetInfo> ruleset)
private async Task load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable<RulesetInfo> ruleset)
{
Beatmap.BindTo(beatmap);
Ruleset.BindTo(ruleset);
@@ -98,7 +99,7 @@ namespace osu.Game.Screens
};
}
sampleExit = audio.Sample.Get(@"UI/screen-back");
sampleExit = await audio.Sample.GetAsync(@"UI/screen-back");
}
public virtual bool OnPressed(GlobalAction action)
+23 -16
View File
@@ -31,23 +31,30 @@ namespace osu.Game.Screens.Play.Break
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
leftGlowIcon = new GlowIcon
new ParallaxContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight,
X = -glow_icon_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_right,
BlurSigma = new Vector2(glow_icon_blur_sigma),
Size = new Vector2(glow_icon_size),
},
rightGlowIcon = new GlowIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
X = glow_icon_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_left,
BlurSigma = new Vector2(glow_icon_blur_sigma),
Size = new Vector2(glow_icon_size),
ParallaxAmount = -0.01f,
Children = new Drawable[]
{
leftGlowIcon = new GlowIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight,
X = -glow_icon_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_right,
BlurSigma = new Vector2(glow_icon_blur_sigma),
Size = new Vector2(glow_icon_size),
},
rightGlowIcon = new GlowIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
X = glow_icon_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_left,
BlurSigma = new Vector2(glow_icon_blur_sigma),
Size = new Vector2(glow_icon_size),
},
}
},
new ParallaxContainer
{
+4 -3
View File
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -61,19 +62,19 @@ namespace osu.Game.Screens.Play
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
Children = new Drawable[]
{
buttonSprite = new Sprite
{
Texture = textures.Get(@"KeyCounter/key-up"),
Texture = await textures.GetAsync(@"KeyCounter/key-up"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
glowSprite = new Sprite
{
Texture = textures.Get(@"KeyCounter/key-glow"),
Texture = await textures.GetAsync(@"KeyCounter/key-glow"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0
+2 -2
View File
@@ -84,7 +84,7 @@ namespace osu.Game.Screens.Play
public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true;
[BackgroundDependencyLoader]
private void load(AudioManager audio, APIAccess api, OsuConfigManager config)
private async Task load(AudioManager audio, APIAccess api, OsuConfigManager config)
{
this.api = api;
@@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play
if (working is DummyWorkingBeatmap)
return;
sampleRestart = audio.Sample.Get(@"Gameplay/restart");
sampleRestart = await audio.Sample.GetAsync(@"Gameplay/restart");
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
+3 -2
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
@@ -224,12 +225,12 @@ namespace osu.Game.Screens.Play
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio)
private async Task load(OsuColour colours, AudioManager audio)
{
colourNormal = colours.Yellow;
colourHover = colours.YellowDark;
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
sampleConfirm = await audio.Sample.GetAsync(@"SongSelect/confirm-selection");
Children = new Drawable[]
{
+3 -2
View File
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
@@ -368,10 +369,10 @@ namespace osu.Game.Screens.Ranking
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
if (!string.IsNullOrEmpty(user.CoverUrl))
cover.Texture = textures.Get(user.CoverUrl);
cover.Texture = await textures.GetAsync(user.CoverUrl);
}
}
+27 -23
View File
@@ -64,32 +64,36 @@ namespace osu.Game.Screens.Select
public IEnumerable<BeatmapSetInfo> BeatmapSets
{
get { return beatmapSets.Select(g => g.BeatmapSet); }
set
get => beatmapSets.Select(g => g.BeatmapSet);
set => loadBeatmapSets(() => value);
}
public void LoadBeatmapSetsFromManager(BeatmapManager manager) => loadBeatmapSets(manager.GetAllUsableBeatmapSetsEnumerable);
private void loadBeatmapSets(Func<IEnumerable<BeatmapSetInfo>> beatmapSets)
{
CarouselRoot newRoot = new CarouselRoot(this);
Task.Run(() =>
{
CarouselRoot newRoot = new CarouselRoot(this);
beatmapSets().Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild);
newRoot.Filter(activeCriteria);
Task.Run(() =>
// preload drawables as the ctor overhead is quite high currently.
var _ = newRoot.Drawables;
}).ContinueWith(_ => Schedule(() =>
{
root = newRoot;
scrollableContent.Clear(false);
itemsCache.Invalidate();
scrollPositionCache.Invalidate();
Schedule(() =>
{
value.Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild);
newRoot.Filter(activeCriteria);
// preload drawables as the ctor overhead is quite high currently.
var _ = newRoot.Drawables;
}).ContinueWith(_ => Schedule(() =>
{
root = newRoot;
scrollableContent.Clear(false);
itemsCache.Invalidate();
scrollPositionCache.Invalidate();
Schedule(() =>
{
BeatmapSetsChanged?.Invoke();
initialLoadComplete = true;
});
}));
}
BeatmapSetsChanged?.Invoke();
initialLoadComplete = true;
});
}));
}
private readonly List<float> yPositions = new List<float>();
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@@ -45,7 +46,7 @@ namespace osu.Game.Screens.Select.Carousel
private SampleChannel sampleHover;
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours)
private async Task load(AudioManager audio, OsuColour colours)
{
InternalChild = borderContainer = new Container
{
@@ -68,7 +69,7 @@ namespace osu.Game.Screens.Select.Carousel
}
};
sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
sampleHover = await audio.Sample.GetAsync($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
hoverLayer.Colour = colours.Blue.Opacity(0.1f);
}
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -35,20 +36,20 @@ namespace osu.Game.Screens.Select.Leaderboards
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
this.textures = textures;
updateTexture();
await updateTexture();
}
private void updateTexture() => rankSprite.Texture = textures.Get($@"Grades/{Rank.GetDescription()}");
private async Task updateTexture() => rankSprite.Texture = await textures.GetAsync($@"Grades/{Rank.GetDescription()}");
public void UpdateRank(ScoreRank newRank)
{
Rank = newRank;
if (LoadState >= LoadState.Ready)
updateTexture();
updateTexture().Wait();
}
}
}
+2 -2
View File
@@ -55,11 +55,11 @@ namespace osu.Game.Screens.Select
private readonly Bindable<IEnumerable<Mod>> selectedMods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable<IEnumerable<Mod>> selectedMods)
private async Task load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable<IEnumerable<Mod>> selectedMods)
{
if (selectedMods != null) this.selectedMods.BindTo(selectedMods);
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
sampleConfirm = await audio.Sample.GetAsync(@"SongSelect/confirm-selection");
Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);
+5 -4
View File
@@ -3,6 +3,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using OpenTK;
using OpenTK.Input;
using osu.Framework.Allocation;
@@ -198,7 +199,7 @@ namespace osu.Game.Screens.Select
}
[BackgroundDependencyLoader(true)]
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours)
private async Task load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours)
{
if (Footer != null)
{
@@ -218,10 +219,10 @@ namespace osu.Game.Screens.Select
dialogOverlay = dialog;
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand");
sampleChangeDifficulty = await audio.Sample.GetAsync(@"SongSelect/select-difficulty");
sampleChangeBeatmap = await audio.Sample.GetAsync(@"SongSelect/select-expand");
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable();
Carousel.LoadBeatmapSetsFromManager(this.beatmaps);
}
public void Edit(BeatmapInfo beatmap)
@@ -9,6 +9,7 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.MathUtils;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace osu.Game.Screens.Tournament.Components
{
@@ -75,9 +76,9 @@ namespace osu.Game.Screens.Tournament.Components
private int expiredCount;
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
texture = textures.Get("Drawings/visualiser-line");
texture = await textures.GetAsync("Drawings/visualiser-line");
}
protected override void UpdateAfterChildren()
+2 -2
View File
@@ -53,7 +53,7 @@ namespace osu.Game.Screens.Tournament
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
[BackgroundDependencyLoader]
private void load(TextureStore textures, Storage storage)
private async Task load(TextureStore textures, Storage storage)
{
this.storage = storage;
@@ -87,7 +87,7 @@ namespace osu.Game.Screens.Tournament
{
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
Texture = textures.Get(@"Backgrounds/Drawings/background.png")
Texture = await textures.GetAsync(@"Backgrounds/Drawings/background.png")
},
new FillFlowContainer
{
+3 -2
View File
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -178,9 +179,9 @@ namespace osu.Game.Screens.Tournament
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}");
flagSprite.Texture = await textures.GetAsync($@"Flags/{Team.FlagName}");
}
}
}
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
@@ -372,9 +373,9 @@ namespace osu.Game.Screens.Tournament
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}");
flagSprite.Texture = await textures.GetAsync($@"Flags/{Team.FlagName}");
}
}
}
+5 -2
View File
@@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
@@ -108,10 +109,12 @@ namespace osu.Game.Skinning
return path == null ? null : underlyingStore.GetStream(path);
}
byte[] IResourceStore<byte[]>.Get(string name)
byte[] IResourceStore<byte[]>.Get(string name) => GetAsync(name).Result;
public Task<byte[]> GetAsync(string name)
{
string path = getPathForFile(name);
return path == null ? null : underlyingStore.Get(path);
return path == null ? Task.FromResult<byte[]>(null) : underlyingStore.GetAsync(path);
}
#region IDisposable Support
@@ -85,12 +85,10 @@ namespace osu.Game.Skinning
private void load(OsuConfigManager config)
{
beatmapSkins = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
beatmapSkins.ValueChanged += val => onSourceChanged();
beatmapSkins.TriggerChange();
beatmapSkins.BindValueChanged(_ => onSourceChanged());
beatmapHitsounds = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
beatmapHitsounds.ValueChanged += val => onSourceChanged();
beatmapHitsounds.TriggerChange();
beatmapHitsounds.BindValueChanged(_ => onSourceChanged(), true);
}
protected override void LoadComplete()
@@ -52,5 +52,13 @@ namespace osu.Game.Skinning
protected virtual void SkinChanged(ISkinSource skin, bool allowFallback)
{
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (skin != null)
skin.SourceChanged -= onChange;
}
}
}
+4 -3
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -24,14 +25,14 @@ namespace osu.Game.Users
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
if (textures == null)
throw new ArgumentNullException(nameof(textures));
Texture texture = null;
if (user != null && user.Id > 1) texture = textures.Get($@"https://a.ppy.sh/{user.Id}");
if (texture == null) texture = textures.Get(@"Online/avatar-guest");
if (user != null && user.Id > 1) texture = await textures.GetAsync($@"https://a.ppy.sh/{user.Id}");
if (texture == null) texture = await textures.GetAsync(@"Online/avatar-guest");
Add(new Sprite
{
+5 -4
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@@ -44,7 +45,7 @@ namespace osu.Game.Users
country = value;
if (LoadState >= LoadState.Ready)
sprite.Texture = getFlagTexture();
sprite.Texture = getFlagTexture().Result;
}
}
@@ -64,15 +65,15 @@ namespace osu.Game.Users
}
[BackgroundDependencyLoader]
private void load(TextureStore ts)
private async Task load(TextureStore ts)
{
if (ts == null)
throw new ArgumentNullException(nameof(ts));
textures = ts;
sprite.Texture = getFlagTexture();
sprite.Texture = await getFlagTexture();
}
private Texture getFlagTexture() => textures.Get($@"Flags/{country?.FlagName ?? @"__"}");
private async Task<Texture> getFlagTexture() => await textures.GetAsync($@"Flags/{country?.FlagName ?? @"__"}");
}
}
+3 -2
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
@@ -18,13 +19,13 @@ namespace osu.Game.Users
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
private async Task load(TextureStore textures)
{
if (textures == null)
throw new ArgumentNullException(nameof(textures));
if (!string.IsNullOrEmpty(user.CoverUrl))
Texture = textures.Get(user.CoverUrl);
Texture = await textures.GetAsync(user.CoverUrl);
}
}
}
+3 -3
View File
@@ -15,10 +15,10 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Humanizer" Version="2.4.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ppy.osu.Framework" Version="2018.821.0" />
<PackageReference Include="ppy.osu.Framework" Version="2018.830.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="SharpRaven" Version="2.4.0" />
+1 -1
View File
@@ -11,7 +11,7 @@
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" />
<PackageReference Include="DeepEqual" Version="1.6.0" />
</ItemGroup>
<ItemGroup>