diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index ce353d9b27..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-language: csharp
-solution: osu.sln
\ No newline at end of file
diff --git a/README.md b/README.md
index 52fc29cb98..c4d676f4be 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ If you are not interested in developing the game, you can still consume our [bin
| ------------- | ------------- |
- **Linux** users are recommended to self-compile until we have official deployment in place.
-- **iOS** users can join the [TestFlight beta program](https://t.co/PasE1zrHhw) (note that due to high demand this is regularly full).
+- **iOS** users can join the [TestFlight beta program](https://testflight.apple.com/join/2tLcjWlF) (note that due to high demand this is regularly full).
- **Android** users can self-compile, and expect a public beta soon.
If your platform is not listed above, there is still a chance you can manually build it by following the instructions below.
diff --git a/build/cakebuild.csproj b/build/cakebuild.csproj
index 8ccce35e26..d5a6d44740 100644
--- a/build/cakebuild.csproj
+++ b/build/cakebuild.csproj
@@ -5,7 +5,7 @@
netcoreapp2.0
-
-
+
+
\ No newline at end of file
diff --git a/osu.Android.props b/osu.Android.props
index 6744590f0d..3b2e6574ac 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -62,7 +62,7 @@
-
-
+
+
diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs
index 975b7f9f5a..761f52f961 100644
--- a/osu.Desktop/OsuGameDesktop.cs
+++ b/osu.Desktop/OsuGameDesktop.cs
@@ -1,4 +1,4 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
@@ -38,9 +38,9 @@ namespace osu.Desktop
if (Host is DesktopGameHost desktopHost)
return new StableStorage(desktopHost);
}
- catch (Exception e)
+ catch (Exception)
{
- Logger.Error(e, "Error while searching for stable install");
+ Logger.Log("Could not find a stable install", LoggingTarget.Runtime, LogLevel.Important);
}
return null;
@@ -52,11 +52,7 @@ namespace osu.Desktop
if (!noVersionOverlay)
{
- LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, v =>
- {
- Add(v);
- v.Show();
- });
+ LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, Add);
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
Add(new SquirrelUpdateManager());
@@ -71,7 +67,7 @@ namespace osu.Desktop
switch (newScreen)
{
- case Intro _:
+ case IntroScreen _:
case MainMenu _:
versionManager?.Show();
break;
diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs
index 78a1e680ec..fa41c061b5 100644
--- a/osu.Desktop/Updater/SquirrelUpdateManager.cs
+++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs
@@ -27,6 +27,8 @@ namespace osu.Desktop.Updater
public Task PrepareUpdateAsync() => UpdateManager.RestartAppWhenExited();
+ private static readonly Logger logger = Logger.GetLogger("updater");
+
[BackgroundDependencyLoader]
private void load(NotificationOverlay notification, OsuGameBase game)
{
@@ -77,7 +79,7 @@ namespace osu.Desktop.Updater
{
if (useDeltaPatching)
{
- Logger.Error(e, @"delta patching failed!");
+ logger.Add(@"delta patching failed; will attempt full download!");
//could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959)
//try again without deltas.
@@ -163,16 +165,11 @@ namespace osu.Desktop.Updater
{
public LogLevel Level { get; set; } = LogLevel.Info;
- private Logger logger;
-
public void Write(string message, LogLevel logLevel)
{
if (logLevel < Level)
return;
- if (logger == null)
- logger = Logger.GetLogger("updater");
-
logger.Add(message);
}
diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj
index 8c9e1f279f..538aaf2d7a 100644
--- a/osu.Desktop/osu.Desktop.csproj
+++ b/osu.Desktop/osu.Desktop.csproj
@@ -28,8 +28,8 @@
-
-
+
+
diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs
index e45ed8c6f4..493ac7ae39 100644
--- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs
+++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using Newtonsoft.Json;
using NUnit.Framework;
using osu.Framework.MathUtils;
+using osu.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects;
@@ -22,10 +23,10 @@ namespace osu.Game.Rulesets.Catch.Tests
[TestCase("spinner")]
[TestCase("spinner-and-circles")]
[TestCase("slider")]
- public new void Test(string name)
- {
- base.Test(name);
- }
+ [TestCase("hardrock-stream", new[] { typeof(CatchModHardRock) })]
+ [TestCase("hardrock-repeat-slider", new[] { typeof(CatchModHardRock) })]
+ [TestCase("hardrock-spinner", new[] { typeof(CatchModHardRock) })]
+ public new void Test(string name, params Type[] mods) => base.Test(name, mods);
protected override IEnumerable CreateConvertValue(HitObject hitObject)
{
diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj
index 9acf47a67c..4100404da6 100644
--- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj
+++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
index 645cb5701a..5ab47c1611 100644
--- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
+++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
@@ -10,6 +10,7 @@ using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects.Types;
using osuTK;
using osu.Game.Rulesets.Catch.MathUtils;
+using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Catch.Beatmaps
{
@@ -26,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
{
base.PostProcess();
- applyPositionOffsets();
+ ApplyPositionOffsets(Beatmap);
initialiseHyperDash((List)Beatmap.HitObjects);
@@ -40,19 +41,29 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
}
}
- private void applyPositionOffsets()
+ public static void ApplyPositionOffsets(IBeatmap beatmap, params Mod[] mods)
{
var rng = new FastRandom(RNG_SEED);
- // todo: HardRock displacement should be applied here
- foreach (var obj in Beatmap.HitObjects)
+ bool shouldApplyHardRockOffset = mods.Any(m => m is ModHardRock);
+ float? lastPosition = null;
+ double lastStartTime = 0;
+
+ foreach (var obj in beatmap.HitObjects.OfType())
{
+ obj.XOffset = 0;
+
switch (obj)
{
+ case Fruit fruit:
+ if (shouldApplyHardRockOffset)
+ applyHardRockOffset(fruit, ref lastPosition, ref lastStartTime, rng);
+ break;
+
case BananaShower bananaShower:
foreach (var banana in bananaShower.NestedHitObjects.OfType())
{
- banana.X = (float)rng.NextDouble();
+ banana.XOffset = (float)rng.NextDouble();
rng.Next(); // osu!stable retrieved a random banana type
rng.Next(); // osu!stable retrieved a random banana rotation
rng.Next(); // osu!stable retrieved a random banana colour
@@ -63,12 +74,13 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
case JuiceStream juiceStream:
foreach (var nested in juiceStream.NestedHitObjects)
{
- var hitObject = (CatchHitObject)nested;
- if (hitObject is TinyDroplet)
- hitObject.X += rng.Next(-20, 20) / CatchPlayfield.BASE_WIDTH;
- else if (hitObject is Droplet)
+ var catchObject = (CatchHitObject)nested;
+ catchObject.XOffset = 0;
+
+ if (catchObject is TinyDroplet)
+ catchObject.XOffset = MathHelper.Clamp(rng.Next(-20, 20) / CatchPlayfield.BASE_WIDTH, -catchObject.X, 1 - catchObject.X);
+ else if (catchObject is Droplet)
rng.Next(); // osu!stable retrieved a random droplet rotation
- hitObject.X = MathHelper.Clamp(hitObject.X, 0, 1);
}
break;
@@ -76,6 +88,105 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
}
}
+ private static void applyHardRockOffset(CatchHitObject hitObject, ref float? lastPosition, ref double lastStartTime, FastRandom rng)
+ {
+ if (hitObject is JuiceStream stream)
+ {
+ lastPosition = stream.EndX;
+ lastStartTime = stream.EndTime;
+ return;
+ }
+
+ if (!(hitObject is Fruit))
+ return;
+
+ float offsetPosition = hitObject.X;
+ double startTime = hitObject.StartTime;
+
+ if (lastPosition == null)
+ {
+ lastPosition = offsetPosition;
+ lastStartTime = startTime;
+
+ return;
+ }
+
+ float positionDiff = offsetPosition - lastPosition.Value;
+ double timeDiff = startTime - lastStartTime;
+
+ if (timeDiff > 1000)
+ {
+ lastPosition = offsetPosition;
+ lastStartTime = startTime;
+ return;
+ }
+
+ if (positionDiff == 0)
+ {
+ applyRandomOffset(ref offsetPosition, timeDiff / 4d, rng);
+ hitObject.XOffset = offsetPosition - hitObject.X;
+ return;
+ }
+
+ if (Math.Abs(positionDiff * CatchPlayfield.BASE_WIDTH) < timeDiff / 3d)
+ applyOffset(ref offsetPosition, positionDiff);
+
+ hitObject.XOffset = offsetPosition - hitObject.X;
+
+ lastPosition = offsetPosition;
+ lastStartTime = startTime;
+ }
+
+ ///
+ /// Applies a random offset in a random direction to a position, ensuring that the final position remains within the boundary of the playfield.
+ ///
+ /// The position which the offset should be applied to.
+ /// The maximum offset, cannot exceed 20px.
+ /// The random number generator.
+ private static void applyRandomOffset(ref float position, double maxOffset, FastRandom rng)
+ {
+ bool right = rng.NextBool();
+ float rand = Math.Min(20, (float)rng.Next(0, Math.Max(0, maxOffset))) / CatchPlayfield.BASE_WIDTH;
+
+ if (right)
+ {
+ // Clamp to the right bound
+ if (position + rand <= 1)
+ position += rand;
+ else
+ position -= rand;
+ }
+ else
+ {
+ // Clamp to the left bound
+ if (position - rand >= 0)
+ position -= rand;
+ else
+ position += rand;
+ }
+ }
+
+ ///
+ /// Applies an offset to a position, ensuring that the final position remains within the boundary of the playfield.
+ ///
+ /// The position which the offset should be applied to.
+ /// The amount to offset by.
+ private static void applyOffset(ref float position, float amount)
+ {
+ if (amount > 0)
+ {
+ // Clamp to the right bound
+ if (position + amount < 1)
+ position += amount;
+ }
+ else
+ {
+ // Clamp to the left bound
+ if (position + amount > 0)
+ position += amount;
+ }
+ }
+
private void initialiseHyperDash(List objects)
{
List objectWithDroplets = new List();
diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs
index ea9f225cc1..6f1a7873ec 100644
--- a/osu.Game.Rulesets.Catch/CatchRuleset.cs
+++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs
@@ -11,7 +11,6 @@ using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
-using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Replays;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Beatmaps.Legacy;
@@ -108,7 +107,7 @@ namespace osu.Game.Rulesets.Catch
case ModType.Fun:
return new Mod[]
{
- new MultiMod(new ModWindUp(), new ModWindDown())
+ new MultiMod(new ModWindUp(), new ModWindDown())
};
default:
diff --git a/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs b/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs
index b3605b013b..c721ff862a 100644
--- a/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs
+++ b/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs
@@ -61,6 +61,14 @@ namespace osu.Game.Rulesets.Catch.MathUtils
/// The random value.
public int Next(int lowerBound, int upperBound) => (int)(lowerBound + NextDouble() * (upperBound - lowerBound));
+ ///
+ /// Generates a random integer value within the range [, ).
+ ///
+ /// The lower bound of the range.
+ /// The upper bound of the range.
+ /// The random value.
+ public int Next(double lowerBound, double upperBound) => (int)(lowerBound + NextDouble() * (upperBound - lowerBound));
+
///
/// Generates a random double value within the range [0, 1).
///
diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs b/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs
index 060e51e31d..ced1900ba9 100644
--- a/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs
+++ b/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs
@@ -1,121 +1,17 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.MathUtils;
-using osu.Game.Rulesets.Catch.Objects;
-using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
-using System;
-using osu.Game.Rulesets.Objects;
+using osu.Game.Beatmaps;
+using osu.Game.Rulesets.Catch.Beatmaps;
namespace osu.Game.Rulesets.Catch.Mods
{
- public class CatchModHardRock : ModHardRock, IApplicableToHitObject
+ public class CatchModHardRock : ModHardRock, IApplicableToBeatmap
{
public override double ScoreMultiplier => 1.12;
public override bool Ranked => true;
- private float? lastPosition;
- private double lastStartTime;
-
- public void ApplyToHitObject(HitObject hitObject)
- {
- if (hitObject is JuiceStream stream)
- {
- lastPosition = stream.EndX;
- lastStartTime = stream.EndTime;
- return;
- }
-
- if (!(hitObject is Fruit))
- return;
-
- var catchObject = (CatchHitObject)hitObject;
-
- float position = catchObject.X;
- double startTime = hitObject.StartTime;
-
- if (lastPosition == null)
- {
- lastPosition = position;
- lastStartTime = startTime;
-
- return;
- }
-
- float positionDiff = position - lastPosition.Value;
- double timeDiff = startTime - lastStartTime;
-
- if (timeDiff > 1000)
- {
- lastPosition = position;
- lastStartTime = startTime;
- return;
- }
-
- if (positionDiff == 0)
- {
- applyRandomOffset(ref position, timeDiff / 4d);
- catchObject.X = position;
- return;
- }
-
- if (Math.Abs(positionDiff * CatchPlayfield.BASE_WIDTH) < timeDiff / 3d)
- applyOffset(ref position, positionDiff);
-
- catchObject.X = position;
-
- lastPosition = position;
- lastStartTime = startTime;
- }
-
- ///
- /// Applies a random offset in a random direction to a position, ensuring that the final position remains within the boundary of the playfield.
- ///
- /// The position which the offset should be applied to.
- /// The maximum offset, cannot exceed 20px.
- private void applyRandomOffset(ref float position, double maxOffset)
- {
- bool right = RNG.NextBool();
- float rand = Math.Min(20, (float)RNG.NextDouble(0, Math.Max(0, maxOffset))) / CatchPlayfield.BASE_WIDTH;
-
- if (right)
- {
- // Clamp to the right bound
- if (position + rand <= 1)
- position += rand;
- else
- position -= rand;
- }
- else
- {
- // Clamp to the left bound
- if (position - rand >= 0)
- position -= rand;
- else
- position += rand;
- }
- }
-
- ///
- /// Applies an offset to a position, ensuring that the final position remains within the boundary of the playfield.
- ///
- /// The position which the offset should be applied to.
- /// The amount to offset by.
- private void applyOffset(ref float position, float amount)
- {
- if (amount > 0)
- {
- // Clamp to the right bound
- if (position + amount < 1)
- position += amount;
- }
- else
- {
- // Clamp to the left bound
- if (position + amount > 0)
- position += amount;
- }
- }
+ public void ApplyToBeatmap(IBeatmap beatmap) => CatchBeatmapProcessor.ApplyPositionOffsets(beatmap, this);
}
}
diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
index be76edc01b..19a1b59752 100644
--- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
+++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
@@ -3,6 +3,7 @@
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
+using osu.Game.Rulesets.Catch.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
@@ -12,7 +13,18 @@ namespace osu.Game.Rulesets.Catch.Objects
{
public const double OBJECT_RADIUS = 44;
- public float X { get; set; }
+ private float x;
+
+ public float X
+ {
+ get => x + XOffset;
+ set => x = value;
+ }
+
+ ///
+ /// A random offset applied to , set by the .
+ ///
+ internal float XOffset { get; set; }
public double TimePreempt = 1000;
diff --git a/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-repeat-slider-expected-conversion.json b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-repeat-slider-expected-conversion.json
new file mode 100644
index 0000000000..83f9e30800
--- /dev/null
+++ b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-repeat-slider-expected-conversion.json
@@ -0,0 +1,150 @@
+{
+ "Mappings": [{
+ "StartTime": 369,
+ "Objects": [{
+ "StartTime": 369,
+ "Position": 177
+ },
+ {
+ "StartTime": 450,
+ "Position": 216.539276
+ },
+ {
+ "StartTime": 532,
+ "Position": 256.5667
+ },
+ {
+ "StartTime": 614,
+ "Position": 296.594116
+ },
+ {
+ "StartTime": 696,
+ "Position": 336.621521
+ },
+ {
+ "StartTime": 778,
+ "Position": 376.99762
+ },
+ {
+ "StartTime": 860,
+ "Position": 337.318878
+ },
+ {
+ "StartTime": 942,
+ "Position": 297.291443
+ },
+ {
+ "StartTime": 1024,
+ "Position": 257.264038
+ },
+ {
+ "StartTime": 1106,
+ "Position": 217.2366
+ },
+ {
+ "StartTime": 1188,
+ "Position": 177
+ },
+ {
+ "StartTime": 1270,
+ "Position": 216.818192
+ },
+ {
+ "StartTime": 1352,
+ "Position": 256.8456
+ },
+ {
+ "StartTime": 1434,
+ "Position": 296.873047
+ },
+ {
+ "StartTime": 1516,
+ "Position": 336.900452
+ },
+ {
+ "StartTime": 1598,
+ "Position": 376.99762
+ },
+ {
+ "StartTime": 1680,
+ "Position": 337.039948
+ },
+ {
+ "StartTime": 1762,
+ "Position": 297.0125
+ },
+ {
+ "StartTime": 1844,
+ "Position": 256.9851
+ },
+ {
+ "StartTime": 1926,
+ "Position": 216.957672
+ },
+ {
+ "StartTime": 2008,
+ "Position": 177
+ },
+ {
+ "StartTime": 2090,
+ "Position": 217.097137
+ },
+ {
+ "StartTime": 2172,
+ "Position": 257.124573
+ },
+ {
+ "StartTime": 2254,
+ "Position": 297.152
+ },
+ {
+ "StartTime": 2336,
+ "Position": 337.179443
+ },
+ {
+ "StartTime": 2418,
+ "Position": 376.99762
+ },
+ {
+ "StartTime": 2500,
+ "Position": 336.760956
+ },
+ {
+ "StartTime": 2582,
+ "Position": 296.733643
+ },
+ {
+ "StartTime": 2664,
+ "Position": 256.7062
+ },
+ {
+ "StartTime": 2746,
+ "Position": 216.678772
+ },
+ {
+ "StartTime": 2828,
+ "Position": 177
+ },
+ {
+ "StartTime": 2909,
+ "Position": 216.887909
+ },
+ {
+ "StartTime": 2991,
+ "Position": 256.915344
+ },
+ {
+ "StartTime": 3073,
+ "Position": 296.942749
+ },
+ {
+ "StartTime": 3155,
+ "Position": 336.970184
+ },
+ {
+ "StartTime": 3237,
+ "Position": 376.99762
+ }
+ ]
+ }]
+}
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-repeat-slider.osu b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-repeat-slider.osu
new file mode 100644
index 0000000000..c1971edf2c
--- /dev/null
+++ b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-repeat-slider.osu
@@ -0,0 +1,18 @@
+osu file format v14
+
+[General]
+StackLeniency: 0.4
+Mode: 0
+
+[Difficulty]
+CircleSize:4
+OverallDifficulty:7
+ApproachRate:8
+SliderMultiplier:1.6
+SliderTickRate:4
+
+[TimingPoints]
+369,327.868852459016,4,2,2,32,1,0
+
+[HitObjects]
+177,191,369,6,0,L|382:192,7,200
diff --git a/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-spinner-expected-conversion.json b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-spinner-expected-conversion.json
new file mode 100644
index 0000000000..7333b600fb
--- /dev/null
+++ b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-spinner-expected-conversion.json
@@ -0,0 +1,74 @@
+{
+ "Mappings": [{
+ "StartTime": 369,
+ "Objects": [{
+ "StartTime": 369,
+ "Position": 65
+ },
+ {
+ "StartTime": 450,
+ "Position": 482
+ },
+ {
+ "StartTime": 532,
+ "Position": 164
+ },
+ {
+ "StartTime": 614,
+ "Position": 315
+ },
+ {
+ "StartTime": 696,
+ "Position": 145
+ },
+ {
+ "StartTime": 778,
+ "Position": 159
+ },
+ {
+ "StartTime": 860,
+ "Position": 310
+ },
+ {
+ "StartTime": 942,
+ "Position": 441
+ },
+ {
+ "StartTime": 1024,
+ "Position": 428
+ },
+ {
+ "StartTime": 1106,
+ "Position": 243
+ },
+ {
+ "StartTime": 1188,
+ "Position": 422
+ },
+ {
+ "StartTime": 1270,
+ "Position": 481
+ },
+ {
+ "StartTime": 1352,
+ "Position": 104
+ },
+ {
+ "StartTime": 1434,
+ "Position": 473
+ },
+ {
+ "StartTime": 1516,
+ "Position": 135
+ },
+ {
+ "StartTime": 1598,
+ "Position": 360
+ },
+ {
+ "StartTime": 1680,
+ "Position": 123
+ }
+ ]
+ }]
+}
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-spinner.osu b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-spinner.osu
new file mode 100644
index 0000000000..208d21a344
--- /dev/null
+++ b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-spinner.osu
@@ -0,0 +1,18 @@
+osu file format v14
+
+[General]
+StackLeniency: 0.4
+Mode: 0
+
+[Difficulty]
+CircleSize:4
+OverallDifficulty:7
+ApproachRate:8
+SliderMultiplier:1.6
+SliderTickRate:4
+
+[TimingPoints]
+369,327.868852459016,4,2,2,32,1,0
+
+[HitObjects]
+256,192,369,12,0,1680,0:0:0:0:
diff --git a/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-stream-expected-conversion.json b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-stream-expected-conversion.json
new file mode 100644
index 0000000000..bbc16ab912
--- /dev/null
+++ b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-stream-expected-conversion.json
@@ -0,0 +1,234 @@
+{
+ "Mappings": [{
+ "StartTime": 369,
+ "Objects": [{
+ "StartTime": 369,
+ "Position": 258
+ }]
+ },
+ {
+ "StartTime": 450,
+ "Objects": [{
+ "StartTime": 450,
+ "Position": 254
+ }]
+ },
+ {
+ "StartTime": 532,
+ "Objects": [{
+ "StartTime": 532,
+ "Position": 241
+ }]
+ },
+ {
+ "StartTime": 614,
+ "Objects": [{
+ "StartTime": 614,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 696,
+ "Objects": [{
+ "StartTime": 696,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 778,
+ "Objects": [{
+ "StartTime": 778,
+ "Position": 278
+ }]
+ },
+ {
+ "StartTime": 860,
+ "Objects": [{
+ "StartTime": 860,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 942,
+ "Objects": [{
+ "StartTime": 942,
+ "Position": 278
+ }]
+ },
+ {
+ "StartTime": 1024,
+ "Objects": [{
+ "StartTime": 1024,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 1106,
+ "Objects": [{
+ "StartTime": 1106,
+ "Position": 278
+ }]
+ },
+ {
+ "StartTime": 1188,
+ "Objects": [{
+ "StartTime": 1188,
+ "Position": 278
+ }]
+ },
+ {
+ "StartTime": 1270,
+ "Objects": [{
+ "StartTime": 1270,
+ "Position": 278
+ }]
+ },
+ {
+ "StartTime": 1352,
+ "Objects": [{
+ "StartTime": 1352,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 1434,
+ "Objects": [{
+ "StartTime": 1434,
+ "Position": 258
+ }]
+ },
+ {
+ "StartTime": 1516,
+ "Objects": [{
+ "StartTime": 1516,
+ "Position": 253
+ }]
+ },
+ {
+ "StartTime": 1598,
+ "Objects": [{
+ "StartTime": 1598,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 1680,
+ "Objects": [{
+ "StartTime": 1680,
+ "Position": 260
+ }]
+ },
+ {
+ "StartTime": 1762,
+ "Objects": [{
+ "StartTime": 1762,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 1844,
+ "Objects": [{
+ "StartTime": 1844,
+ "Position": 278
+ }]
+ },
+ {
+ "StartTime": 1926,
+ "Objects": [{
+ "StartTime": 1926,
+ "Position": 278
+ }]
+ },
+ {
+ "StartTime": 2008,
+ "Objects": [{
+ "StartTime": 2008,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 2090,
+ "Objects": [{
+ "StartTime": 2090,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 2172,
+ "Objects": [{
+ "StartTime": 2172,
+ "Position": 243
+ }]
+ },
+ {
+ "StartTime": 2254,
+ "Objects": [{
+ "StartTime": 2254,
+ "Position": 278
+ }]
+ },
+ {
+ "StartTime": 2336,
+ "Objects": [{
+ "StartTime": 2336,
+ "Position": 278
+ }]
+ },
+ {
+ "StartTime": 2418,
+ "Objects": [{
+ "StartTime": 2418,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 2500,
+ "Objects": [{
+ "StartTime": 2500,
+ "Position": 258
+ }]
+ },
+ {
+ "StartTime": 2582,
+ "Objects": [{
+ "StartTime": 2582,
+ "Position": 256
+ }]
+ },
+ {
+ "StartTime": 2664,
+ "Objects": [{
+ "StartTime": 2664,
+ "Position": 242
+ }]
+ },
+ {
+ "StartTime": 2746,
+ "Objects": [{
+ "StartTime": 2746,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 2828,
+ "Objects": [{
+ "StartTime": 2828,
+ "Position": 238
+ }]
+ },
+ {
+ "StartTime": 2909,
+ "Objects": [{
+ "StartTime": 2909,
+ "Position": 271
+ }]
+ },
+ {
+ "StartTime": 2991,
+ "Objects": [{
+ "StartTime": 2991,
+ "Position": 254
+ }]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-stream.osu b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-stream.osu
new file mode 100644
index 0000000000..321af4604b
--- /dev/null
+++ b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/hardrock-stream.osu
@@ -0,0 +1,50 @@
+osu file format v14
+
+[General]
+StackLeniency: 0.4
+Mode: 0
+
+[Difficulty]
+CircleSize:4
+OverallDifficulty:7
+ApproachRate:8
+SliderMultiplier:1.6
+SliderTickRate:1
+
+[TimingPoints]
+369,327.868852459016,4,2,2,32,1,0
+
+[HitObjects]
+258,189,369,1,0,0:0:0:0:
+258,189,450,1,0,0:0:0:0:
+258,189,532,1,0,0:0:0:0:
+258,189,614,1,0,0:0:0:0:
+258,189,696,1,0,0:0:0:0:
+258,189,778,1,0,0:0:0:0:
+258,189,860,1,0,0:0:0:0:
+258,189,942,1,0,0:0:0:0:
+258,189,1024,1,0,0:0:0:0:
+258,189,1106,1,0,0:0:0:0:
+258,189,1188,1,0,0:0:0:0:
+258,189,1270,1,0,0:0:0:0:
+258,189,1352,1,0,0:0:0:0:
+258,189,1434,1,0,0:0:0:0:
+258,189,1516,1,0,0:0:0:0:
+258,189,1598,1,0,0:0:0:0:
+258,189,1680,1,0,0:0:0:0:
+258,189,1762,1,0,0:0:0:0:
+258,189,1844,1,0,0:0:0:0:
+258,189,1926,1,0,0:0:0:0:
+258,189,2008,1,0,0:0:0:0:
+258,189,2090,1,0,0:0:0:0:
+258,189,2172,1,0,0:0:0:0:
+258,189,2254,1,0,0:0:0:0:
+258,189,2336,1,0,0:0:0:0:
+258,189,2418,1,0,0:0:0:0:
+258,189,2500,1,0,0:0:0:0:
+258,189,2582,1,0,0:0:0:0:
+258,189,2664,1,0,0:0:0:0:
+258,189,2746,1,0,0:0:0:0:
+258,189,2828,1,0,0:0:0:0:
+258,189,2909,1,0,0:0:0:0:
+258,189,2991,1,0,0:0:0:0:
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs
index 6b95975059..6f10540973 100644
--- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs
+++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs
@@ -20,10 +20,7 @@ namespace osu.Game.Rulesets.Mania.Tests
protected override string ResourceAssembly => "osu.Game.Rulesets.Mania";
[TestCase("basic")]
- public new void Test(string name)
- {
- base.Test(name);
- }
+ public void Test(string name) => base.Test(name);
protected override IEnumerable CreateConvertValue(HitObject hitObject)
{
@@ -35,11 +32,37 @@ namespace osu.Game.Rulesets.Mania.Tests
};
}
- protected override ManiaConvertMapping CreateConvertMapping() => new ManiaConvertMapping(Converter);
+ private readonly Dictionary rngSnapshots = new Dictionary();
+
+ protected override void OnConversionGenerated(HitObject original, IEnumerable result, IBeatmapConverter beatmapConverter)
+ {
+ base.OnConversionGenerated(original, result, beatmapConverter);
+
+ rngSnapshots[original] = new RngSnapshot(beatmapConverter);
+ }
+
+ protected override ManiaConvertMapping CreateConvertMapping(HitObject source) => new ManiaConvertMapping(rngSnapshots[source]);
protected override Ruleset CreateRuleset() => new ManiaRuleset();
}
+ public class RngSnapshot
+ {
+ public readonly uint RandomW;
+ public readonly uint RandomX;
+ public readonly uint RandomY;
+ public readonly uint RandomZ;
+
+ public RngSnapshot(IBeatmapConverter converter)
+ {
+ var maniaConverter = (ManiaBeatmapConverter)converter;
+ RandomW = maniaConverter.Random.W;
+ RandomX = maniaConverter.Random.X;
+ RandomY = maniaConverter.Random.Y;
+ RandomZ = maniaConverter.Random.Z;
+ }
+ }
+
public class ManiaConvertMapping : ConvertMapping, IEquatable
{
public uint RandomW;
@@ -51,13 +74,12 @@ namespace osu.Game.Rulesets.Mania.Tests
{
}
- public ManiaConvertMapping(IBeatmapConverter converter)
+ public ManiaConvertMapping(RngSnapshot snapshot)
{
- var maniaConverter = (ManiaBeatmapConverter)converter;
- RandomW = maniaConverter.Random.W;
- RandomX = maniaConverter.Random.X;
- RandomY = maniaConverter.Random.Y;
- RandomZ = maniaConverter.Random.Z;
+ RandomW = snapshot.RandomW;
+ RandomX = snapshot.RandomX;
+ RandomY = snapshot.RandomY;
+ RandomZ = snapshot.RandomZ;
}
public bool Equals(ManiaConvertMapping other) => other != null && RandomW == other.RandomW && RandomX == other.RandomX && RandomY == other.RandomY && RandomZ == other.RandomZ;
diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj
index df5131dd8b..013d2a71d4 100644
--- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj
+++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs
index a3cd455886..e4a28167ec 100644
--- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs
+++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs
@@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
///
/// Keep the same as last row.
///
- ForceStack = 1 << 0,
+ ForceStack = 1,
///
/// Keep different from last row.
diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs
index d83033f9c6..8966b5058f 100644
--- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs
+++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs
@@ -13,7 +13,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Graphics;
-using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Beatmaps.Legacy;
@@ -154,7 +153,7 @@ namespace osu.Game.Rulesets.Mania
case ModType.Fun:
return new Mod[]
{
- new MultiMod(new ModWindUp(), new ModWindDown())
+ new MultiMod(new ModWindUp(), new ModWindDown())
};
default:
diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs
index 17f4098420..485595cea9 100644
--- a/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs
+++ b/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs
@@ -10,7 +10,7 @@ using osu.Game.Rulesets.Mania.Beatmaps;
namespace osu.Game.Rulesets.Mania.Mods
{
- public class ManiaModMirror : Mod, IApplicableToBeatmap
+ public class ManiaModMirror : Mod, IApplicableToBeatmap
{
public override string Name => "Mirror";
public override string Acronym => "MR";
@@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mania.Mods
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
- public void ApplyToBeatmap(Beatmap beatmap)
+ public void ApplyToBeatmap(IBeatmap beatmap)
{
var availableColumns = ((ManiaBeatmap)beatmap).TotalColumns;
diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs
index ba16140644..9275371a61 100644
--- a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs
+++ b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs
@@ -13,7 +13,7 @@ using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Mania.Mods
{
- public class ManiaModRandom : Mod, IApplicableToBeatmap
+ public class ManiaModRandom : Mod, IApplicableToBeatmap
{
public override string Name => "Random";
public override string Acronym => "RD";
@@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Mania.Mods
public override string Description => @"Shuffle around the keys!";
public override double ScoreMultiplier => 1;
- public void ApplyToBeatmap(Beatmap beatmap)
+ public void ApplyToBeatmap(IBeatmap beatmap)
{
var availableColumns = ((ManiaBeatmap)beatmap).TotalColumns;
var shuffledColumns = Enumerable.Range(0, availableColumns).OrderBy(item => RNG.Next()).ToList();
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs
index 8102718edf..a92e56d3c3 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs
@@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
}
}
- private Cached subtractionCache = new Cached();
+ private readonly Cached subtractionCache = new Cached();
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
{
diff --git a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs
index f98d63e6c7..e9fdf924c3 100644
--- a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs
+++ b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs
@@ -8,7 +8,6 @@ using osu.Framework.MathUtils;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
-using osu.Game.Rulesets.Osu.UI;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Osu.Tests
@@ -21,10 +20,10 @@ namespace osu.Game.Rulesets.Osu.Tests
[TestCase("basic")]
[TestCase("colinear-perfect-curve")]
[TestCase("slider-ticks")]
- public new void Test(string name)
- {
- base.Test(name);
- }
+ [TestCase("repeat-slider")]
+ [TestCase("uneven-repeat-slider")]
+ [TestCase("old-stacking")]
+ public void Test(string name) => base.Test(name);
protected override IEnumerable CreateConvertValue(HitObject hitObject)
{
@@ -32,22 +31,22 @@ namespace osu.Game.Rulesets.Osu.Tests
{
case Slider slider:
foreach (var nested in slider.NestedHitObjects)
- yield return createConvertValue(nested);
+ yield return createConvertValue((OsuHitObject)nested);
break;
default:
- yield return createConvertValue(hitObject);
+ yield return createConvertValue((OsuHitObject)hitObject);
break;
}
- ConvertValue createConvertValue(HitObject obj) => new ConvertValue
+ ConvertValue createConvertValue(OsuHitObject obj) => new ConvertValue
{
StartTime = obj.StartTime,
EndTime = (obj as IHasEndTime)?.EndTime ?? obj.StartTime,
- X = (obj as IHasPosition)?.X ?? OsuPlayfield.BASE_SIZE.X / 2,
- Y = (obj as IHasPosition)?.Y ?? OsuPlayfield.BASE_SIZE.Y / 2,
+ X = obj.StackedPosition.X,
+ Y = obj.StackedPosition.Y
};
}
diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/approachcircle@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/approachcircle@2x.png
new file mode 100755
index 0000000000..db2f4a5730
Binary files /dev/null and b/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/approachcircle@2x.png differ
diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hit300k@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hit300k@2x.png
new file mode 100755
index 0000000000..b0db9c00af
Binary files /dev/null and b/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hit300k@2x.png differ
diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hitcircle@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hitcircle@2x.png
new file mode 100755
index 0000000000..6674616472
Binary files /dev/null and b/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hitcircle@2x.png differ
diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hitcircleoverlay@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hitcircleoverlay@2x.png
new file mode 100755
index 0000000000..1f98c1697e
Binary files /dev/null and b/osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hitcircleoverlay@2x.png differ
diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/metrics-skin/hitcircle@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/metrics-skin/hitcircle@2x.png
new file mode 100644
index 0000000000..043bfbfae1
Binary files /dev/null and b/osu.Game.Rulesets.Osu.Tests/Resources/metrics-skin/hitcircle@2x.png differ
diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/metrics-skin/hitcircleoverlay@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/metrics-skin/hitcircleoverlay@2x.png
new file mode 100644
index 0000000000..4233d9bb6e
Binary files /dev/null and b/osu.Game.Rulesets.Osu.Tests/Resources/metrics-skin/hitcircleoverlay@2x.png differ
diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/approachcircle@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/approachcircle@2x.png
new file mode 100755
index 0000000000..0a6ec6535c
Binary files /dev/null and b/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/approachcircle@2x.png differ
diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/hitcircle@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/hitcircle@2x.png
new file mode 100755
index 0000000000..919d8f405c
Binary files /dev/null and b/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/hitcircle@2x.png differ
diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/hitcircleoverlay@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/hitcircleoverlay@2x.png
new file mode 100755
index 0000000000..a9b2d95d88
Binary files /dev/null and b/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/hitcircleoverlay@2x.png differ
diff --git a/osu.Game.Rulesets.Osu.Tests/SkinnableTestScene.cs b/osu.Game.Rulesets.Osu.Tests/SkinnableTestScene.cs
new file mode 100644
index 0000000000..a2c058193b
--- /dev/null
+++ b/osu.Game.Rulesets.Osu.Tests/SkinnableTestScene.cs
@@ -0,0 +1,66 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using System.IO;
+using System.Linq;
+using osu.Framework.Allocation;
+using osu.Framework.Audio;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.IO.Stores;
+using osu.Game.Skinning;
+using osu.Game.Tests.Visual;
+
+namespace osu.Game.Rulesets.Osu.Tests
+{
+ public abstract class SkinnableTestScene : OsuGridTestScene
+ {
+ private Skin metricsSkin;
+ private Skin defaultSkin;
+ private Skin specialSkin;
+
+ protected SkinnableTestScene()
+ : base(2, 2)
+ {
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(AudioManager audio)
+ {
+ var skins = new SkinManager(LocalStorage, ContextFactory, null, audio);
+
+ metricsSkin = getSkinFromResources(skins, "metrics_skin");
+ defaultSkin = getSkinFromResources(skins, "default_skin");
+ specialSkin = getSkinFromResources(skins, "special_skin");
+ }
+
+ public void SetContents(Func creationFunction)
+ {
+ Cell(0).Child = new LocalSkinOverrideContainer(null) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
+ Cell(1).Child = new LocalSkinOverrideContainer(metricsSkin) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
+ Cell(2).Child = new LocalSkinOverrideContainer(defaultSkin) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
+ Cell(3).Child = new LocalSkinOverrideContainer(specialSkin) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
+ }
+
+ private static Skin getSkinFromResources(SkinManager skins, string name)
+ {
+ using (var storage = new DllResourceStore("osu.Game.Rulesets.Osu.Tests.dll"))
+ {
+ var tempName = Path.GetTempFileName();
+
+ File.Delete(tempName);
+ Directory.CreateDirectory(tempName);
+
+ var files = storage.GetAvailableResources().Where(f => f.StartsWith($"Resources/{name}"));
+
+ foreach (var file in files)
+ using (var stream = storage.GetStream(file))
+ using (var newFile = File.Create(Path.Combine(tempName, Path.GetFileName(file))))
+ stream.CopyTo(newFile);
+
+ return skins.GetSkin(skins.Import(tempName).Result);
+ }
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs
index d44a0cd841..84a7bfc53e 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs
@@ -7,7 +7,6 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
-using osu.Game.Tests.Visual;
using osuTK;
using System.Collections.Generic;
using System;
@@ -19,37 +18,32 @@ using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
- public class TestSceneHitCircle : OsuTestScene
+ public class TestSceneHitCircle : SkinnableTestScene
{
public override IReadOnlyList RequiredTypes => new[]
{
typeof(DrawableHitCircle)
};
- private readonly Container content;
- protected override Container Content => content;
-
private int depthIndex;
public TestSceneHitCircle()
{
- base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
-
- AddStep("Miss Big Single", () => testSingle(2));
- AddStep("Miss Medium Single", () => testSingle(5));
- AddStep("Miss Small Single", () => testSingle(7));
- AddStep("Hit Big Single", () => testSingle(2, true));
- AddStep("Hit Medium Single", () => testSingle(5, true));
- AddStep("Hit Small Single", () => testSingle(7, true));
- AddStep("Miss Big Stream", () => testStream(2));
- AddStep("Miss Medium Stream", () => testStream(5));
- AddStep("Miss Small Stream", () => testStream(7));
- AddStep("Hit Big Stream", () => testStream(2, true));
- AddStep("Hit Medium Stream", () => testStream(5, true));
- AddStep("Hit Small Stream", () => testStream(7, true));
+ AddStep("Miss Big Single", () => SetContents(() => testSingle(2)));
+ AddStep("Miss Medium Single", () => SetContents(() => testSingle(5)));
+ AddStep("Miss Small Single", () => SetContents(() => testSingle(7)));
+ AddStep("Hit Big Single", () => SetContents(() => testSingle(2, true)));
+ AddStep("Hit Medium Single", () => SetContents(() => testSingle(5, true)));
+ AddStep("Hit Small Single", () => SetContents(() => testSingle(7, true)));
+ AddStep("Miss Big Stream", () => SetContents(() => testStream(2)));
+ AddStep("Miss Medium Stream", () => SetContents(() => testStream(5)));
+ AddStep("Miss Small Stream", () => SetContents(() => testStream(7)));
+ AddStep("Hit Big Stream", () => SetContents(() => testStream(2, true)));
+ AddStep("Hit Medium Stream", () => SetContents(() => testStream(5, true)));
+ AddStep("Hit Small Stream", () => SetContents(() => testStream(7, true)));
}
- private void testSingle(float circleSize, bool auto = false, double timeOffset = 0, Vector2? positionOffset = null)
+ private Drawable testSingle(float circleSize, bool auto = false, double timeOffset = 0, Vector2? positionOffset = null)
{
positionOffset = positionOffset ?? Vector2.Zero;
@@ -61,27 +55,33 @@ namespace osu.Game.Rulesets.Osu.Tests
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
- var drawable = new TestDrawableHitCircle(circle, auto)
- {
- Anchor = Anchor.Centre,
- Depth = depthIndex++
- };
+ var drawable = CreateDrawableHitCircle(circle, auto);
foreach (var mod in Mods.Value.OfType())
mod.ApplyToDrawableHitObjects(new[] { drawable });
- Add(drawable);
+ return drawable;
}
- private void testStream(float circleSize, bool auto = false)
+ protected virtual TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto) => new TestDrawableHitCircle(circle, auto)
{
+ Anchor = Anchor.Centre,
+ Depth = depthIndex++
+ };
+
+ private Drawable testStream(float circleSize, bool auto = false)
+ {
+ var container = new Container { RelativeSizeAxes = Axes.Both };
+
Vector2 pos = new Vector2(-250, 0);
for (int i = 0; i <= 1000; i += 100)
{
- testSingle(circleSize, auto, i, pos);
+ container.Add(testSingle(circleSize, auto, i, pos));
pos.X += 50;
}
+
+ return container;
}
protected class TestDrawableHitCircle : DrawableHitCircle
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs
index 3d8afd66f4..84a73c7cfc 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneShaking.cs
@@ -1,23 +1,22 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.Graphics;
using osu.Framework.MathUtils;
+using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestSceneShaking : TestSceneHitCircle
{
- public override void Add(Drawable drawable)
+ protected override TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto)
{
- base.Add(drawable);
+ var drawableHitObject = base.CreateDrawableHitCircle(circle, auto);
- if (drawable is TestDrawableHitCircle hitObject)
- {
- Scheduler.AddDelayed(() => hitObject.TriggerJudgement(),
- hitObject.HitObject.StartTime - (hitObject.HitObject.HitWindows.HalfWindowFor(HitResult.Miss) + RNG.Next(0, 300)) - Time.Current);
- }
+ Scheduler.AddDelayed(() => drawableHitObject.TriggerJudgement(),
+ drawableHitObject.HitObject.StartTime - (drawableHitObject.HitObject.HitWindows.HalfWindowFor(HitResult.Miss) + RNG.Next(0, 300)) - Time.Current);
+
+ return drawableHitObject;
}
}
}
diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj
index bb3e5a66f3..92c5c77aac 100644
--- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj
+++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs
index 7bb1f42802..bb19b783aa 100644
--- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs
+++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs
@@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Beatmaps
{
@@ -208,17 +209,22 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
if (beatmap.HitObjects[j].StartTime - stackThreshold > startTime)
break;
+ // The start position of the hitobject, or the position at the end of the path if the hitobject is a slider
+ Vector2 position2 = currHitObject is Slider currSlider
+ ? currSlider.Position + currSlider.Path.PositionAt(1)
+ : currHitObject.Position;
+
if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, currHitObject.Position) < stack_distance)
{
currHitObject.StackHeight++;
- startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[i].StartTime;
+ startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[j].StartTime;
}
- else if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, currHitObject.EndPosition) < stack_distance)
+ else if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, position2) < stack_distance)
{
//Case for sliders - bump notes down and right, rather than up and left.
sliderStack++;
beatmap.HitObjects[j].StackHeight -= sliderStack;
- startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[i].StartTime;
+ startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[j].StartTime;
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs
index ddf708d0f1..2d940479f3 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs
@@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{
public override string Description => @"Play with no approach circles and fading circles/sliders.";
public override double ScoreMultiplier => 1.06;
+ public override Type[] IncompatibleMods => new[] { typeof(OsuModSpinIn) };
private const double fade_in_duration_multiplier = 0.4;
private const double fade_out_duration_multiplier = 0.3;
diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSpinIn.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSpinIn.cs
new file mode 100644
index 0000000000..62b5ecfd58
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModSpinIn.cs
@@ -0,0 +1,92 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using osu.Framework.Bindables;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Configuration;
+using osu.Game.Rulesets.Mods;
+using osu.Game.Rulesets.Objects.Drawables;
+using osu.Game.Rulesets.Osu.Objects;
+using osu.Game.Rulesets.Osu.Objects.Drawables;
+using osuTK;
+
+namespace osu.Game.Rulesets.Osu.Mods
+{
+ public class OsuModSpinIn : Mod, IApplicableToDrawableHitObjects, IReadFromConfig
+ {
+ public override string Name => "Spin In";
+ public override string Acronym => "SI";
+ public override IconUsage Icon => FontAwesome.Solid.Undo;
+ public override ModType Type => ModType.Fun;
+ public override string Description => "Circles spin in. No approach circles.";
+ public override double ScoreMultiplier => 1;
+
+ // todo: this mod should be able to be compatible with hidden with a bit of further implementation.
+ public override Type[] IncompatibleMods => new[] { typeof(OsuModeObjectScaleTween), typeof(OsuModHidden) };
+
+ private const int rotate_offset = 360;
+ private const float rotate_starting_width = 2;
+
+ private Bindable increaseFirstObjectVisibility = new Bindable();
+
+ public void ReadFromConfig(OsuConfigManager config)
+ {
+ increaseFirstObjectVisibility = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility);
+ }
+
+ public void ApplyToDrawableHitObjects(IEnumerable drawables)
+ {
+ foreach (var drawable in drawables.Skip(increaseFirstObjectVisibility.Value ? 1 : 0))
+ {
+ switch (drawable)
+ {
+ case DrawableSpinner _:
+ continue;
+
+ default:
+ drawable.ApplyCustomUpdateState += applyZoomState;
+ break;
+ }
+ }
+ }
+
+ private void applyZoomState(DrawableHitObject drawable, ArmedState state)
+ {
+ var h = (OsuHitObject)drawable.HitObject;
+
+ switch (drawable)
+ {
+ case DrawableHitCircle circle:
+ using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
+ {
+ circle.ApproachCircle.Hide();
+
+ circle.RotateTo(rotate_offset).Then().RotateTo(0, h.TimePreempt, Easing.InOutSine);
+ circle.ScaleTo(new Vector2(rotate_starting_width, 0)).Then().ScaleTo(1, h.TimePreempt, Easing.InOutSine);
+
+ // bypass fade in.
+ if (state == ArmedState.Idle)
+ circle.FadeIn();
+ }
+
+ break;
+
+ case DrawableSlider slider:
+ using (slider.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
+ {
+ slider.ScaleTo(0).Then().ScaleTo(1, h.TimePreempt, Easing.InOutSine);
+
+ // bypass fade in.
+ if (state == ArmedState.Idle)
+ slider.FadeIn();
+ }
+
+ break;
+ }
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModeObjectScaleTween.cs b/osu.Game.Rulesets.Osu/Mods/OsuModeObjectScaleTween.cs
index ad6a15718a..e926ade41b 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModeObjectScaleTween.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModeObjectScaleTween.cs
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
@@ -28,6 +29,8 @@ namespace osu.Game.Rulesets.Osu.Mods
private Bindable increaseFirstObjectVisibility = new Bindable();
+ public override Type[] IncompatibleMods => new[] { typeof(OsuModSpinIn) };
+
public void ReadFromConfig(OsuConfigManager config)
{
increaseFirstObjectVisibility = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility);
@@ -64,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Mods
case DrawableSlider _:
case DrawableHitCircle _:
{
- using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
+ using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
drawable.ScaleTo(StartScale).Then().ScaleTo(EndScale, h.TimePreempt, Easing.OutSine);
break;
}
@@ -75,7 +78,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{
case DrawableHitCircle circle:
// we don't want to see the approach circle
- using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
+ using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
circle.ApproachCircle.Hide();
break;
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
index aacf3ee08d..a2a23e9ff7 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
@@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
Anchor = Anchor.Centre,
Alpha = 0.5f,
}
- }, restrictSize: false);
+ }, confineMode: ConfineMode.NoScaling);
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs
index 7569626230..a269b87c75 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs
@@ -97,13 +97,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
Position = pointStartPosition,
Rotation = rotation,
Alpha = 0,
- Scale = new Vector2(1.5f),
+ Scale = new Vector2(1.5f * currHitObject.Scale),
});
using (fp.BeginAbsoluteSequence(fadeInTime))
{
fp.FadeIn(currHitObject.TimeFadeIn);
- fp.ScaleTo(1, currHitObject.TimeFadeIn, Easing.Out);
+ fp.ScaleTo(currHitObject.Scale, currHitObject.TimeFadeIn, Easing.Out);
fp.MoveTo(pointEndPosition, currHitObject.TimeFadeIn, Easing.Out);
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
index d3d763daf3..ca124e9214 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
@@ -6,33 +6,29 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using osuTK;
using osu.Game.Rulesets.Scoring;
+using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
{
public ApproachCircle ApproachCircle;
- private readonly CirclePiece circle;
- private readonly RingPiece ring;
- private readonly FlashPiece flash;
- private readonly ExplodePiece explode;
- private readonly NumberPiece number;
- private readonly GlowPiece glow;
private readonly IBindable positionBindable = new Bindable();
private readonly IBindable stackHeightBindable = new Bindable();
private readonly IBindable scaleBindable = new Bindable();
- public OsuAction? HitAction => circle.HitAction;
-
- private readonly Container explodeContainer;
+ public OsuAction? HitAction => hitArea.HitAction;
private readonly Container scaleContainer;
+ private readonly HitArea hitArea;
+
public DrawableHitCircle(HitCircle h)
: base(h)
{
@@ -47,44 +43,30 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
- Child = explodeContainer = new Container
+ Children = new Drawable[]
{
- RelativeSizeAxes = Axes.Both,
- Origin = Anchor.Centre,
- Anchor = Anchor.Centre,
- Children = new Drawable[]
+ hitArea = new HitArea
{
- glow = new GlowPiece(),
- circle = new CirclePiece
+ Hit = () =>
{
- Hit = () =>
- {
- if (AllJudged)
- return false;
+ if (AllJudged)
+ return false;
- UpdateResult(true);
- return true;
- },
+ UpdateResult(true);
+ return true;
},
- number = new NumberPiece
- {
- Text = (HitObject.IndexInCurrentCombo + 1).ToString(),
- },
- ring = new RingPiece(),
- flash = new FlashPiece(),
- explode = new ExplodePiece(),
- ApproachCircle = new ApproachCircle
- {
- Alpha = 0,
- Scale = new Vector2(4),
- }
+ },
+ new SkinnableDrawable("Play/osu/hitcircle", _ => new MainCirclePiece(HitObject.IndexInCurrentCombo)),
+ ApproachCircle = new ApproachCircle
+ {
+ Alpha = 0,
+ Scale = new Vector2(4),
}
}
},
};
- //may not be so correct
- Size = circle.DrawSize;
+ Size = hitArea.DrawSize;
}
[BackgroundDependencyLoader]
@@ -98,13 +80,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
scaleBindable.BindTo(HitObject.ScaleBindable);
- AccentColour.BindValueChanged(colour =>
- {
- explode.Colour = colour.NewValue;
- glow.Colour = colour.NewValue;
- circle.Colour = colour.NewValue;
- ApproachCircle.Colour = colour.NewValue;
- }, true);
+ AccentColour.BindValueChanged(accent => ApproachCircle.Colour = accent.NewValue, true);
}
protected override void CheckForResult(bool userTriggered, double timeOffset)
@@ -133,14 +109,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
base.UpdateInitialTransforms();
ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadeIn * 2, HitObject.TimePreempt));
- ApproachCircle.ScaleTo(1.1f, HitObject.TimePreempt);
+ ApproachCircle.ScaleTo(1f, HitObject.TimePreempt);
ApproachCircle.Expire(true);
}
protected override void UpdateStateTransforms(ArmedState state)
{
- glow.FadeOut(400);
-
switch (state)
{
case ArmedState.Idle:
@@ -148,7 +122,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Expire(true);
- circle.HitAction = null;
+ hitArea.HitAction = null;
// override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early.
LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss);
@@ -163,29 +137,50 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
case ArmedState.Hit:
ApproachCircle.FadeOut(50);
- const double flash_in = 40;
- flash.FadeTo(0.8f, flash_in)
- .Then()
- .FadeOut(100);
-
- explode.FadeIn(flash_in);
-
- using (BeginDelayedSequence(flash_in, true))
- {
- //after the flash, we can hide some elements that were behind it
- ring.FadeOut();
- circle.FadeOut();
- number.FadeOut();
-
- this.FadeOut(800);
- explodeContainer.ScaleTo(1.5f, 400, Easing.OutQuad);
- }
-
- Expire();
+ // todo: temporary / arbitrary
+ this.Delay(800).Expire();
break;
}
}
public Drawable ProxiedLayer => ApproachCircle;
+
+ private class HitArea : Drawable, IKeyBindingHandler
+ {
+ // IsHovered is used
+ public override bool HandlePositionalInput => true;
+
+ public Func Hit;
+
+ public OsuAction? HitAction;
+
+ public HitArea()
+ {
+ Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
+
+ Anchor = Anchor.Centre;
+ Origin = Anchor.Centre;
+ }
+
+ public bool OnPressed(OsuAction action)
+ {
+ switch (action)
+ {
+ case OsuAction.LeftButton:
+ case OsuAction.RightButton:
+ if (IsHovered && (Hit?.Invoke() ?? false))
+ {
+ HitAction = action;
+ return true;
+ }
+
+ break;
+ }
+
+ return false;
+ }
+
+ public bool OnReleased(OsuAction action) => false;
+ }
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs
index 579f16e0d4..a89fb8b682 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs
@@ -1,4 +1,4 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Objects.Drawables;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs
index 1e2c0ae59f..f75b62eecf 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs
@@ -3,6 +3,8 @@
using System;
using System.Collections.Generic;
+using osu.Framework.Allocation;
+using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils;
@@ -20,27 +22,40 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private double animDuration;
+ private readonly SkinnableDrawable scaleContainer;
+
public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider)
: base(repeatPoint)
{
this.repeatPoint = repeatPoint;
this.drawableSlider = drawableSlider;
- Size = new Vector2(45 * repeatPoint.Scale);
+ Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
Blending = BlendingMode.Additive;
Origin = Anchor.Centre;
- InternalChildren = new Drawable[]
+ InternalChild = scaleContainer = new SkinnableDrawable("Play/osu/reversearrow", _ => new SpriteIcon
{
- new SkinnableDrawable("Play/osu/reversearrow", _ => new SpriteIcon
- {
- RelativeSizeAxes = Axes.Both,
- Icon = FontAwesome.Solid.ChevronRight
- }, restrictSize: false)
+ RelativeSizeAxes = Axes.Both,
+ Icon = FontAwesome.Solid.ChevronRight,
+ Size = new Vector2(0.35f)
+ }, confineMode: ConfineMode.NoScaling)
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
};
}
+ private readonly IBindable scaleBindable = new Bindable();
+
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true);
+ scaleBindable.BindTo(HitObject.ScaleBindable);
+ }
+
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (repeatPoint.StartTime <= Time.Current)
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
index 4a6bd45007..a0626707af 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
@@ -48,10 +48,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
InternalChildren = new Drawable[]
{
- Body = new SnakingSliderBody(s)
- {
- PathRadius = s.Scale * OsuHitObject.OBJECT_RADIUS,
- },
+ Body = new SnakingSliderBody(s),
ticks = new Container { RelativeSizeAxes = Axes.Both },
repeatPoints = new Container { RelativeSizeAxes = Axes.Both },
Ball = new SliderBall(s, this)
@@ -105,7 +102,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
scaleBindable.BindValueChanged(scale =>
{
- Body.PathRadius = scale.NewValue * 64;
+ updatePathRadius();
Ball.Scale = new Vector2(scale.NewValue);
});
@@ -118,7 +115,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AccentColour.BindValueChanged(colour =>
{
Body.AccentColour = colour.NewValue;
- Ball.AccentColour = colour.NewValue;
foreach (var drawableHitObject in NestedHitObjects)
drawableHitObject.AccentColour.Value = colour.NewValue;
@@ -157,16 +153,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Body.RecyclePath();
}
+ private float sliderPathRadius;
+
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
{
base.SkinChanged(skin, allowFallback);
Body.BorderSize = skin.GetValue(s => s.SliderBorderSize) ?? SliderBody.DEFAULT_BORDER_SIZE;
+ sliderPathRadius = skin.GetValue(s => s.SliderPathRadius) ?? OsuHitObject.OBJECT_RADIUS;
+ updatePathRadius();
+
Body.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? AccentColour.Value;
Body.BorderColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Color4.White;
- Ball.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? AccentColour.Value;
}
+ private void updatePathRadius() => Body.PathRadius = slider.Scale * sliderPathRadius;
+
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (userTriggered || Time.Current < slider.EndTime)
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
index f5f92dd05d..653e73ac3f 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using osu.Framework.Allocation;
+using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
@@ -16,36 +18,49 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public const double ANIM_DURATION = 150;
+ private const float default_tick_size = 16;
+
public bool Tracking { get; set; }
public override bool DisplayResult => false;
+ private readonly SkinnableDrawable scaleContainer;
+
public DrawableSliderTick(SliderTick sliderTick)
: base(sliderTick)
{
- Size = new Vector2(16) * sliderTick.Scale;
+ Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
Origin = Anchor.Centre;
- InternalChildren = new Drawable[]
+ InternalChild = scaleContainer = new SkinnableDrawable("Play/osu/sliderscorepoint", _ => new CircularContainer
{
- new SkinnableDrawable("Play/osu/sliderscorepoint", _ => new Container
+ Masking = true,
+ Origin = Anchor.Centre,
+ Size = new Vector2(default_tick_size),
+ BorderThickness = default_tick_size / 4,
+ BorderColour = Color4.White,
+ Child = new Box
{
- Masking = true,
RelativeSizeAxes = Axes.Both,
- Origin = Anchor.Centre,
- CornerRadius = Size.X / 2,
- BorderThickness = 2,
- BorderColour = Color4.White,
- Child = new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = AccentColour.Value,
- Alpha = 0.3f,
- }
- }, restrictSize: false)
+ Colour = AccentColour.Value,
+ Alpha = 0.3f,
+ }
+ })
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
};
}
+ private readonly IBindable scaleBindable = new Bindable();
+
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true);
+ scaleBindable.BindTo(HitObject.ScaleBindable);
+ }
+
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (timeOffset >= 0)
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs
index 9981585f9e..5813197336 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs
@@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures;
using osu.Game.Skinning;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
@@ -24,7 +25,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
- Child = new SkinnableSprite("Play/osu/approachcircle");
+ Child = new SkinnableApproachCircle();
+ }
+
+ private class SkinnableApproachCircle : SkinnableSprite
+ {
+ public SkinnableApproachCircle()
+ : base("Play/osu/approachcircle")
+ {
+ }
+
+ protected override Drawable CreateDefault(string name)
+ {
+ var drawable = base.CreateDefault(name);
+
+ // account for the sprite being used for the default approach circle being taken from stable,
+ // when hitcircles have 5px padding on each size. this should be removed if we update the sprite.
+ drawable.Scale = new Vector2(128 / 118f);
+
+ return drawable;
+ }
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs
index dc0b149140..c92937ef09 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs
@@ -1,24 +1,17 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using System;
+using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using osu.Framework.Input.Bindings;
-using osu.Game.Skinning;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Graphics.Textures;
using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
- public class CirclePiece : Container, IKeyBindingHandler
+ public class CirclePiece : CompositeDrawable
{
- // IsHovered is used
- public override bool HandlePositionalInput => true;
-
- public Func Hit;
-
- public OsuAction? HitAction;
-
public CirclePiece()
{
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
@@ -27,28 +20,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
-
- InternalChild = new SkinnableDrawable("Play/osu/hitcircle", _ => new DefaultCirclePiece());
}
- public bool OnPressed(OsuAction action)
+ [BackgroundDependencyLoader]
+ private void load(TextureStore textures)
{
- switch (action)
+ InternalChildren = new Drawable[]
{
- case OsuAction.LeftButton:
- case OsuAction.RightButton:
- if (IsHovered && (Hit?.Invoke() ?? false))
- {
- HitAction = action;
- return true;
- }
-
- break;
- }
-
- return false;
+ new Sprite
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Texture = textures.Get(@"Play/osu/disc"),
+ },
+ new TrianglesPiece
+ {
+ RelativeSizeAxes = Axes.Both,
+ Blending = BlendingMode.Additive,
+ Alpha = 0.5f,
+ }
+ };
}
-
- public bool OnReleased(OsuAction action) => false;
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs
deleted file mode 100644
index 047ff943ff..0000000000
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using osu.Framework.Allocation;
-using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
-using osu.Framework.Graphics.Sprites;
-using osu.Framework.Graphics.Textures;
-
-namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
-{
- public class DefaultCirclePiece : Container
- {
- [BackgroundDependencyLoader]
- private void load(TextureStore textures)
- {
- RelativeSizeAxes = Axes.Both;
- Children = new Drawable[]
- {
- new Sprite
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Texture = textures.Get(@"Play/osu/disc"),
- },
- new TrianglesPiece
- {
- RelativeSizeAxes = Axes.Both,
- Blending = BlendingMode.Additive,
- Alpha = 0.5f,
- }
- };
- }
- }
-}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/MainCirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/MainCirclePiece.cs
new file mode 100644
index 0000000000..944c93bb6d
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/MainCirclePiece.cs
@@ -0,0 +1,94 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Bindables;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Rulesets.Objects.Drawables;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
+{
+ public class MainCirclePiece : CompositeDrawable
+ {
+ private readonly CirclePiece circle;
+ private readonly RingPiece ring;
+ private readonly FlashPiece flash;
+ private readonly ExplodePiece explode;
+ private readonly NumberPiece number;
+ private readonly GlowPiece glow;
+
+ public MainCirclePiece(int index)
+ {
+ Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
+
+ Anchor = Anchor.Centre;
+ Origin = Anchor.Centre;
+
+ InternalChildren = new Drawable[]
+ {
+ glow = new GlowPiece(),
+ circle = new CirclePiece(),
+ number = new NumberPiece
+ {
+ Text = (index + 1).ToString(),
+ },
+ ring = new RingPiece(),
+ flash = new FlashPiece(),
+ explode = new ExplodePiece(),
+ };
+ }
+
+ private readonly IBindable state = new Bindable();
+
+ private readonly Bindable accentColour = new Bindable();
+
+ [BackgroundDependencyLoader]
+ private void load(DrawableHitObject drawableObject)
+ {
+ state.BindTo(drawableObject.State);
+ state.BindValueChanged(updateState, true);
+
+ accentColour.BindTo(drawableObject.AccentColour);
+ accentColour.BindValueChanged(colour =>
+ {
+ explode.Colour = colour.NewValue;
+ glow.Colour = colour.NewValue;
+ circle.Colour = colour.NewValue;
+ }, true);
+ }
+
+ private void updateState(ValueChangedEvent state)
+ {
+ glow.FadeOut(400);
+
+ switch (state.NewValue)
+ {
+ case ArmedState.Hit:
+ const double flash_in = 40;
+ const double flash_out = 100;
+
+ flash.FadeTo(0.8f, flash_in)
+ .Then()
+ .FadeOut(flash_out);
+
+ explode.FadeIn(flash_in);
+ this.ScaleTo(1.5f, 400, Easing.OutQuad);
+
+ using (BeginDelayedSequence(flash_in, true))
+ {
+ //after the flash, we can hide some elements that were behind it
+ ring.FadeOut();
+ circle.FadeOut();
+ number.FadeOut();
+
+ this.FadeOut(800);
+ }
+
+ break;
+ }
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
index 84034d3ee9..e8dc63abca 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
@@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
Font = OsuFont.Numeric.With(size: 40),
UseFullGlyphHeight = false,
- }, restrictSize: false)
+ }, confineMode: ConfineMode.NoScaling)
{
Text = @"1"
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
index 9ba8ad3474..8b72b23ca3 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
@@ -3,11 +3,13 @@
using System;
using System.Linq;
+using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Framework.Input.Events;
+using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osuTK.Graphics;
using osu.Game.Skinning;
@@ -17,88 +19,44 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
public class SliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition
{
- private Color4 accentColour = Color4.Black;
-
public Func GetInitialHitAction;
- ///
- /// The colour that is used for the slider ball.
- ///
- public Color4 AccentColour
- {
- get => accentColour;
- set
- {
- accentColour = value;
- if (drawableBall != null)
- drawableBall.Colour = value;
- }
- }
-
private readonly Slider slider;
public readonly Drawable FollowCircle;
- private Drawable drawableBall;
private readonly DrawableSlider drawableSlider;
public SliderBall(Slider slider, DrawableSlider drawableSlider = null)
{
this.drawableSlider = drawableSlider;
this.slider = slider;
- Masking = true;
- AutoSizeAxes = Axes.Both;
+
Blending = BlendingMode.Additive;
Origin = Anchor.Centre;
+ Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
+
Children = new[]
{
- FollowCircle = new Container
+ FollowCircle = new FollowCircleContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
- Width = OsuHitObject.OBJECT_RADIUS * 2,
- Height = OsuHitObject.OBJECT_RADIUS * 2,
+ RelativeSizeAxes = Axes.Both,
Alpha = 0,
- Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new CircularContainer
- {
- RelativeSizeAxes = Axes.Both,
- Masking = true,
- BorderThickness = 5,
- BorderColour = Color4.Orange,
- Blending = BlendingMode.Additive,
- Child = new Box
- {
- Colour = Color4.Orange,
- RelativeSizeAxes = Axes.Both,
- Alpha = 0.2f,
- }
- }),
+ Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new DefaultFollowCircle()),
},
new CircularContainer
{
Masking = true,
- AutoSizeAxes = Axes.Both,
+ RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Alpha = 1,
Child = new Container
{
- Width = OsuHitObject.OBJECT_RADIUS * 2,
- Height = OsuHitObject.OBJECT_RADIUS * 2,
+ RelativeSizeAxes = Axes.Both,
// TODO: support skin filename animation (sliderb0, sliderb1...)
- Child = new SkinnableDrawable("Play/osu/sliderb", _ => new CircularContainer
- {
- Masking = true,
- RelativeSizeAxes = Axes.Both,
- BorderThickness = 10,
- BorderColour = Color4.White,
- Alpha = 1,
- Child = drawableBall = new Box
- {
- Colour = AccentColour,
- RelativeSizeAxes = Axes.Both,
- Alpha = 0.4f,
- }
- }),
+ Child = new SkinnableDrawable("Play/osu/sliderball", _ => new DefaultSliderBall()),
}
}
};
@@ -191,7 +149,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
// in valid time range
Time.Current >= slider.StartTime && Time.Current < slider.EndTime &&
// in valid position range
- lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
+ lastScreenSpaceMousePosition.HasValue && FollowCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
// valid action
(actions?.Any(isValidTrackingAction) ?? false);
}
@@ -214,5 +172,62 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
Position = slider.CurvePositionAt(completionProgress);
}
+
+ private class FollowCircleContainer : Container
+ {
+ public override bool HandlePositionalInput => true;
+ }
+
+ public class DefaultFollowCircle : CompositeDrawable
+ {
+ public DefaultFollowCircle()
+ {
+ RelativeSizeAxes = Axes.Both;
+
+ InternalChild = new CircularContainer
+ {
+ RelativeSizeAxes = Axes.Both,
+ Masking = true,
+ BorderThickness = 5,
+ BorderColour = Color4.Orange,
+ Blending = BlendingMode.Additive,
+ Child = new Box
+ {
+ Colour = Color4.Orange,
+ RelativeSizeAxes = Axes.Both,
+ Alpha = 0.2f,
+ }
+ };
+ }
+ }
+
+ public class DefaultSliderBall : CompositeDrawable
+ {
+ [BackgroundDependencyLoader]
+ private void load(DrawableHitObject drawableObject, ISkinSource skin)
+ {
+ RelativeSizeAxes = Axes.Both;
+
+ float radius = skin.GetValue(s => s.SliderPathRadius) ?? OsuHitObject.OBJECT_RADIUS;
+
+ InternalChild = new CircularContainer
+ {
+ Masking = true,
+ RelativeSizeAxes = Axes.Both,
+ Scale = new Vector2(radius / OsuHitObject.OBJECT_RADIUS),
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ BorderThickness = 10,
+ BorderColour = Color4.White,
+ Alpha = 1,
+ Child = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.White,
+ Alpha = 0.4f,
+ }
+ };
+ }
+ }
}
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs
index 6bc19ee3b5..24a437c20e 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs
@@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
protected Path Path => path;
- public float PathRadius
+ public virtual float PathRadius
{
get => path.PathRadius;
set => path.PathRadius = value;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs
index a3d3893c8b..70a1bad4a3 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs
@@ -24,6 +24,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
public double? SnakedStart { get; private set; }
public double? SnakedEnd { get; private set; }
+ public override float PathRadius
+ {
+ get => base.PathRadius;
+ set
+ {
+ if (base.PathRadius == value)
+ return;
+
+ base.PathRadius = value;
+
+ Refresh();
+ }
+ }
+
public override Vector2 PathOffset => snakedPathOffset;
///
@@ -55,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
var spanProgress = slider.ProgressAt(completionProgress);
double start = 0;
- double end = SnakingIn.Value ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1;
+ double end = SnakingIn.Value ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / (slider.TimePreempt / 3), 0, 1) : 1;
if (span >= slider.SpanCount() - 1)
{
diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs
index d1221fd2d3..b52bfcd181 100644
--- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs
+++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs
@@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Objects
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
TimePreempt = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450);
- TimeFadeIn = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1200, 800, 300);
+ TimeFadeIn = 400; // as per osu-stable
Scale = (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5) / 2;
}
diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs
index a4638c31f2..d3279652c7 100644
--- a/osu.Game.Rulesets.Osu/Objects/Slider.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs
@@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
public double Duration => EndTime - StartTime;
- private Cached endPositionCache;
+ private readonly Cached endPositionCache = new Cached();
public override Vector2 EndPosition => endPositionCache.IsValid ? endPositionCache.Value : endPositionCache.Value = Position + this.CurvePositionAt(1);
diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs
index 8df0f77629..d50d4f401c 100644
--- a/osu.Game.Rulesets.Osu/OsuRuleset.cs
+++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs
@@ -14,7 +14,6 @@ using osu.Game.Overlays.Settings;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Edit;
-using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Replays;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Beatmaps.Legacy;
@@ -134,8 +133,9 @@ namespace osu.Game.Rulesets.Osu
{
new OsuModTransform(),
new OsuModWiggle(),
+ new OsuModSpinIn(),
new MultiMod(new OsuModGrow(), new OsuModDeflate()),
- new MultiMod(new ModWindUp(), new ModWindDown()),
+ new MultiMod(new ModWindUp(), new ModWindDown()),
};
case ModType.System:
diff --git a/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/old-stacking-expected-conversion.json b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/old-stacking-expected-conversion.json
new file mode 100644
index 0000000000..b994cbd85a
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/old-stacking-expected-conversion.json
@@ -0,0 +1,278 @@
+{
+ "Mappings": [{
+ "StartTime": 32165,
+ "Objects": [{
+ "StartTime": 32165,
+ "EndTime": 32165,
+ "X": 32,
+ "Y": 320
+ }]
+ },
+ {
+ "StartTime": 32517,
+ "Objects": [{
+ "StartTime": 32517,
+ "EndTime": 32517,
+ "X": 246.396057,
+ "Y": 182.396057
+ }]
+ },
+ {
+ "StartTime": 32605,
+ "Objects": [{
+ "StartTime": 32605,
+ "EndTime": 32605,
+ "X": 249.597382,
+ "Y": 185.597382
+ }]
+ },
+ {
+ "StartTime": 32693,
+ "Objects": [{
+ "StartTime": 32693,
+ "EndTime": 32693,
+ "X": 252.798691,
+ "Y": 188.798691
+ }]
+ },
+ {
+ "StartTime": 32781,
+ "Objects": [{
+ "StartTime": 32781,
+ "EndTime": 32781,
+ "X": 256,
+ "Y": 192
+ }]
+ },
+ {
+ "StartTime": 33248,
+ "Objects": [{
+ "StartTime": 33248,
+ "EndTime": 33248,
+ "X": 39.3960648,
+ "Y": 76.3960648
+ }]
+ },
+ {
+ "StartTime": 33307,
+ "Objects": [{
+ "StartTime": 33307,
+ "EndTime": 33307,
+ "X": 42.5973778,
+ "Y": 79.597374
+ }]
+ },
+ {
+ "StartTime": 33383,
+ "Objects": [{
+ "StartTime": 33383,
+ "EndTime": 33383,
+ "X": 45.798687,
+ "Y": 82.79869
+ }]
+ },
+ {
+ "StartTime": 33459,
+ "Objects": [{
+ "StartTime": 33459,
+ "EndTime": 33459,
+ "X": 49,
+ "Y": 86
+ },
+ {
+ "StartTime": 33635,
+ "EndTime": 33635,
+ "X": 123.847847,
+ "Y": 85.7988
+ },
+ {
+ "StartTime": 33811,
+ "EndTime": 33811,
+ "X": 198.6957,
+ "Y": 85.5975952
+ },
+ {
+ "StartTime": 33988,
+ "EndTime": 33988,
+ "X": 273.9688,
+ "Y": 85.39525
+ },
+ {
+ "StartTime": 34164,
+ "EndTime": 34164,
+ "X": 348.816681,
+ "Y": 85.19404
+ },
+ {
+ "StartTime": 34246,
+ "EndTime": 34246,
+ "X": 398.998718,
+ "Y": 85.05914
+ }
+ ]
+ },
+ {
+ "StartTime": 34341,
+ "Objects": [{
+ "StartTime": 34341,
+ "EndTime": 34341,
+ "X": 401.201324,
+ "Y": 88.20131
+ }]
+ },
+ {
+ "StartTime": 34400,
+ "Objects": [{
+ "StartTime": 34400,
+ "EndTime": 34400,
+ "X": 404.402618,
+ "Y": 91.402626
+ }]
+ },
+ {
+ "StartTime": 34459,
+ "Objects": [{
+ "StartTime": 34459,
+ "EndTime": 34459,
+ "X": 407.603943,
+ "Y": 94.6039352
+ }]
+ },
+ {
+ "StartTime": 34989,
+ "Objects": [{
+ "StartTime": 34989,
+ "EndTime": 34989,
+ "X": 163,
+ "Y": 138
+ },
+ {
+ "StartTime": 35018,
+ "EndTime": 35018,
+ "X": 188,
+ "Y": 138
+ }
+ ]
+ },
+ {
+ "StartTime": 35106,
+ "Objects": [{
+ "StartTime": 35106,
+ "EndTime": 35106,
+ "X": 163,
+ "Y": 138
+ },
+ {
+ "StartTime": 35135,
+ "EndTime": 35135,
+ "X": 188,
+ "Y": 138
+ }
+ ]
+ },
+ {
+ "StartTime": 35224,
+ "Objects": [{
+ "StartTime": 35224,
+ "EndTime": 35224,
+ "X": 163,
+ "Y": 138
+ },
+ {
+ "StartTime": 35253,
+ "EndTime": 35253,
+ "X": 188,
+ "Y": 138
+ }
+ ]
+ },
+ {
+ "StartTime": 35695,
+ "Objects": [{
+ "StartTime": 35695,
+ "EndTime": 35695,
+ "X": 166,
+ "Y": 76
+ },
+ {
+ "StartTime": 35871,
+ "EndTime": 35871,
+ "X": 240.99855,
+ "Y": 75.53417
+ },
+ {
+ "StartTime": 36011,
+ "EndTime": 36011,
+ "X": 315.9971,
+ "Y": 75.0683441
+ }
+ ]
+ },
+ {
+ "StartTime": 36106,
+ "Objects": [{
+ "StartTime": 36106,
+ "EndTime": 36106,
+ "X": 315,
+ "Y": 75
+ },
+ {
+ "StartTime": 36282,
+ "EndTime": 36282,
+ "X": 240.001526,
+ "Y": 75.47769
+ },
+ {
+ "StartTime": 36422,
+ "EndTime": 36422,
+ "X": 165.003052,
+ "Y": 75.95539
+ }
+ ]
+ },
+ {
+ "StartTime": 36518,
+ "Objects": [{
+ "StartTime": 36518,
+ "EndTime": 36518,
+ "X": 166,
+ "Y": 76
+ },
+ {
+ "StartTime": 36694,
+ "EndTime": 36694,
+ "X": 240.99855,
+ "Y": 75.53417
+ },
+ {
+ "StartTime": 36834,
+ "EndTime": 36834,
+ "X": 315.9971,
+ "Y": 75.0683441
+ }
+ ]
+ },
+ {
+ "StartTime": 36929,
+ "Objects": [{
+ "StartTime": 36929,
+ "EndTime": 36929,
+ "X": 315,
+ "Y": 75
+ },
+ {
+ "StartTime": 37105,
+ "EndTime": 37105,
+ "X": 240.001526,
+ "Y": 75.47769
+ },
+ {
+ "StartTime": 37245,
+ "EndTime": 37245,
+ "X": 165.003052,
+ "Y": 75.95539
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/old-stacking.osu b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/old-stacking.osu
new file mode 100644
index 0000000000..4bc9226d67
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/old-stacking.osu
@@ -0,0 +1,40 @@
+osu file format v3
+
+[Difficulty]
+HPDrainRate:3
+CircleSize:5
+OverallDifficulty:8
+ApproachRate:8
+SliderMultiplier:1.5
+SliderTickRate:2
+
+[TimingPoints]
+48,352.941176470588,4,1,1,100,1,0
+
+[HitObjects]
+// Hit circles
+32,320,32165,5,2,0:0:0:0:
+256,192,32517,5,0,0:0:0:0:
+256,192,32605,1,0,0:0:0:0:
+256,192,32693,1,0,0:0:0:0:
+256,192,32781,1,0,0:0:0:0:
+
+// Hit circles on slider endpoints
+49,86,33248,1,0,0:0:0:0:
+49,86,33307,1,0,0:0:0:0:
+49,86,33383,1,0,0:0:0:0:
+49,86,33459,2,0,L|421:85,1,350
+398,85,34341,1,0,0:0:0:0:
+398,85,34400,1,0,0:0:0:0:
+398,85,34459,1,0,0:0:0:0:
+
+// Sliders
+163,138,34989,2,0,L|196:138,1,25
+163,138,35106,2,0,L|196:138,1,25
+163,138,35224,2,0,L|196:138,1,25
+
+// Reversed sliders
+166,76,35695,2,0,L|327:75,1,150
+315,75,36106,2,0,L|158:76,1,150
+166,76,36518,2,0,L|327:75,1,150
+315,75,36929,2,0,L|158:76,1,150
diff --git a/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/repeat-slider-expected-conversion.json b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/repeat-slider-expected-conversion.json
new file mode 100644
index 0000000000..fb4050963f
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/repeat-slider-expected-conversion.json
@@ -0,0 +1,222 @@
+{
+ "Mappings": [{
+ "StartTime": 369,
+ "Objects": [{
+ "StartTime": 369,
+ "EndTime": 369,
+ "X": 177,
+ "Y": 191
+ },
+ {
+ "StartTime": 450,
+ "EndTime": 450,
+ "X": 216.539276,
+ "Y": 191.192871
+ },
+ {
+ "StartTime": 532,
+ "EndTime": 532,
+ "X": 256.5667,
+ "Y": 191.388138
+ },
+ {
+ "StartTime": 614,
+ "EndTime": 614,
+ "X": 296.594116,
+ "Y": 191.583389
+ },
+ {
+ "StartTime": 696,
+ "EndTime": 696,
+ "X": 336.621521,
+ "Y": 191.778641
+ },
+ {
+ "StartTime": 778,
+ "EndTime": 778,
+ "X": 376.648926,
+ "Y": 191.9739
+ },
+ {
+ "StartTime": 860,
+ "EndTime": 860,
+ "X": 337.318878,
+ "Y": 191.782043
+ },
+ {
+ "StartTime": 942,
+ "EndTime": 942,
+ "X": 297.291443,
+ "Y": 191.586792
+ },
+ {
+ "StartTime": 1024,
+ "EndTime": 1024,
+ "X": 257.264038,
+ "Y": 191.391541
+ },
+ {
+ "StartTime": 1106,
+ "EndTime": 1106,
+ "X": 217.2366,
+ "Y": 191.196274
+ },
+ {
+ "StartTime": 1188,
+ "EndTime": 1188,
+ "X": 177.209213,
+ "Y": 191.001022
+ },
+ {
+ "StartTime": 1270,
+ "EndTime": 1270,
+ "X": 216.818192,
+ "Y": 191.194229
+ },
+ {
+ "StartTime": 1352,
+ "EndTime": 1352,
+ "X": 256.8456,
+ "Y": 191.3895
+ },
+ {
+ "StartTime": 1434,
+ "EndTime": 1434,
+ "X": 296.873047,
+ "Y": 191.584747
+ },
+ {
+ "StartTime": 1516,
+ "EndTime": 1516,
+ "X": 336.900452,
+ "Y": 191.78
+ },
+ {
+ "StartTime": 1598,
+ "EndTime": 1598,
+ "X": 376.927917,
+ "Y": 191.975266
+ },
+ {
+ "StartTime": 1680,
+ "EndTime": 1680,
+ "X": 337.039948,
+ "Y": 191.780685
+ },
+ {
+ "StartTime": 1762,
+ "EndTime": 1762,
+ "X": 297.0125,
+ "Y": 191.585434
+ },
+ {
+ "StartTime": 1844,
+ "EndTime": 1844,
+ "X": 256.9851,
+ "Y": 191.390167
+ },
+ {
+ "StartTime": 1926,
+ "EndTime": 1926,
+ "X": 216.957672,
+ "Y": 191.194916
+ },
+ {
+ "StartTime": 2008,
+ "EndTime": 2008,
+ "X": 177.069717,
+ "Y": 191.000336
+ },
+ {
+ "StartTime": 2090,
+ "EndTime": 2090,
+ "X": 217.097137,
+ "Y": 191.1956
+ },
+ {
+ "StartTime": 2172,
+ "EndTime": 2172,
+ "X": 257.124573,
+ "Y": 191.390854
+ },
+ {
+ "StartTime": 2254,
+ "EndTime": 2254,
+ "X": 297.152,
+ "Y": 191.5861
+ },
+ {
+ "StartTime": 2336,
+ "EndTime": 2336,
+ "X": 337.179443,
+ "Y": 191.781372
+ },
+ {
+ "StartTime": 2418,
+ "EndTime": 2418,
+ "X": 376.7884,
+ "Y": 191.974579
+ },
+ {
+ "StartTime": 2500,
+ "EndTime": 2500,
+ "X": 336.760956,
+ "Y": 191.779327
+ },
+ {
+ "StartTime": 2582,
+ "EndTime": 2582,
+ "X": 296.733643,
+ "Y": 191.584076
+ },
+ {
+ "StartTime": 2664,
+ "EndTime": 2664,
+ "X": 256.7062,
+ "Y": 191.388809
+ },
+ {
+ "StartTime": 2746,
+ "EndTime": 2746,
+ "X": 216.678772,
+ "Y": 191.193558
+ },
+ {
+ "StartTime": 2828,
+ "EndTime": 2828,
+ "X": 177.348663,
+ "Y": 191.0017
+ },
+ {
+ "StartTime": 2909,
+ "EndTime": 2909,
+ "X": 216.887909,
+ "Y": 191.19458
+ },
+ {
+ "StartTime": 2991,
+ "EndTime": 2991,
+ "X": 256.915344,
+ "Y": 191.389832
+ },
+ {
+ "StartTime": 3073,
+ "EndTime": 3073,
+ "X": 296.942749,
+ "Y": 191.585083
+ },
+ {
+ "StartTime": 3155,
+ "EndTime": 3155,
+ "X": 336.970184,
+ "Y": 191.78035
+ },
+ {
+ "StartTime": 3201,
+ "EndTime": 3201,
+ "X": 376.99762,
+ "Y": 191.9756
+ }
+ ]
+ }]
+}
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/repeat-slider.osu b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/repeat-slider.osu
new file mode 100644
index 0000000000..624d905384
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/repeat-slider.osu
@@ -0,0 +1,18 @@
+osu file format v14
+
+[General]
+StackLeniency: 0.4
+Mode: 0
+
+[Difficulty]
+CircleSize:4
+OverallDifficulty:7
+ApproachRate:8
+SliderMultiplier:1.6
+SliderTickRate:4
+
+[TimingPoints]
+369,327.868852459016,4,2,2,32,1,0
+
+[HitObjects]
+177,191,369,6,0,L|382:192,7,200
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/uneven-repeat-slider-expected-conversion.json b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/uneven-repeat-slider-expected-conversion.json
new file mode 100644
index 0000000000..12d1645c04
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/uneven-repeat-slider-expected-conversion.json
@@ -0,0 +1,348 @@
+{
+ "Mappings": [{
+ "StartTime": 369,
+ "Objects": [{
+ "StartTime": 369,
+ "EndTime": 369,
+ "X": 127,
+ "Y": 194
+ },
+ {
+ "StartTime": 450,
+ "EndTime": 450,
+ "X": 166.53389,
+ "Y": 193.8691
+ },
+ {
+ "StartTime": 532,
+ "EndTime": 532,
+ "X": 206.555847,
+ "Y": 193.736572
+ },
+ {
+ "StartTime": 614,
+ "EndTime": 614,
+ "X": 246.57782,
+ "Y": 193.60405
+ },
+ {
+ "StartTime": 696,
+ "EndTime": 696,
+ "X": 286.5998,
+ "Y": 193.471527
+ },
+ {
+ "StartTime": 778,
+ "EndTime": 778,
+ "X": 326.621765,
+ "Y": 193.339
+ },
+ {
+ "StartTime": 860,
+ "EndTime": 860,
+ "X": 366.6437,
+ "Y": 193.206482
+ },
+ {
+ "StartTime": 942,
+ "EndTime": 942,
+ "X": 406.66568,
+ "Y": 193.073959
+ },
+ {
+ "StartTime": 970,
+ "EndTime": 970,
+ "X": 420.331726,
+ "Y": 193.0287
+ },
+ {
+ "StartTime": 997,
+ "EndTime": 997,
+ "X": 407.153748,
+ "Y": 193.072342
+ },
+ {
+ "StartTime": 1079,
+ "EndTime": 1079,
+ "X": 367.131775,
+ "Y": 193.204865
+ },
+ {
+ "StartTime": 1161,
+ "EndTime": 1161,
+ "X": 327.1098,
+ "Y": 193.337387
+ },
+ {
+ "StartTime": 1243,
+ "EndTime": 1243,
+ "X": 287.08783,
+ "Y": 193.46991
+ },
+ {
+ "StartTime": 1325,
+ "EndTime": 1325,
+ "X": 247.0659,
+ "Y": 193.602432
+ },
+ {
+ "StartTime": 1407,
+ "EndTime": 1407,
+ "X": 207.043915,
+ "Y": 193.734955
+ },
+ {
+ "StartTime": 1489,
+ "EndTime": 1489,
+ "X": 167.021988,
+ "Y": 193.867477
+ },
+ {
+ "StartTime": 1571,
+ "EndTime": 1571,
+ "X": 127,
+ "Y": 194
+ },
+ {
+ "StartTime": 1653,
+ "EndTime": 1653,
+ "X": 167.021988,
+ "Y": 193.867477
+ },
+ {
+ "StartTime": 1735,
+ "EndTime": 1735,
+ "X": 207.043976,
+ "Y": 193.734955
+ },
+ {
+ "StartTime": 1817,
+ "EndTime": 1817,
+ "X": 247.065887,
+ "Y": 193.602432
+ },
+ {
+ "StartTime": 1899,
+ "EndTime": 1899,
+ "X": 287.08783,
+ "Y": 193.46991
+ },
+ {
+ "StartTime": 1981,
+ "EndTime": 1981,
+ "X": 327.1098,
+ "Y": 193.337387
+ },
+ {
+ "StartTime": 2062,
+ "EndTime": 2062,
+ "X": 366.643738,
+ "Y": 193.206482
+ },
+ {
+ "StartTime": 2144,
+ "EndTime": 2144,
+ "X": 406.665649,
+ "Y": 193.073959
+ },
+ {
+ "StartTime": 2172,
+ "EndTime": 2172,
+ "X": 420.331726,
+ "Y": 193.0287
+ },
+ {
+ "StartTime": 2199,
+ "EndTime": 2199,
+ "X": 407.153748,
+ "Y": 193.072342
+ },
+ {
+ "StartTime": 2281,
+ "EndTime": 2281,
+ "X": 367.1318,
+ "Y": 193.204865
+ },
+ {
+ "StartTime": 2363,
+ "EndTime": 2363,
+ "X": 327.1098,
+ "Y": 193.337387
+ },
+ {
+ "StartTime": 2445,
+ "EndTime": 2445,
+ "X": 287.08783,
+ "Y": 193.46991
+ },
+ {
+ "StartTime": 2527,
+ "EndTime": 2527,
+ "X": 247.065887,
+ "Y": 193.602432
+ },
+ {
+ "StartTime": 2609,
+ "EndTime": 2609,
+ "X": 207.043976,
+ "Y": 193.734955
+ },
+ {
+ "StartTime": 2691,
+ "EndTime": 2691,
+ "X": 167.021988,
+ "Y": 193.867477
+ },
+ {
+ "StartTime": 2773,
+ "EndTime": 2773,
+ "X": 127,
+ "Y": 194
+ },
+ {
+ "StartTime": 2855,
+ "EndTime": 2855,
+ "X": 167.021988,
+ "Y": 193.867477
+ },
+ {
+ "StartTime": 2937,
+ "EndTime": 2937,
+ "X": 207.043976,
+ "Y": 193.734955
+ },
+ {
+ "StartTime": 3019,
+ "EndTime": 3019,
+ "X": 247.065948,
+ "Y": 193.602432
+ },
+ {
+ "StartTime": 3101,
+ "EndTime": 3101,
+ "X": 287.087952,
+ "Y": 193.46991
+ },
+ {
+ "StartTime": 3183,
+ "EndTime": 3183,
+ "X": 327.109772,
+ "Y": 193.337387
+ },
+ {
+ "StartTime": 3265,
+ "EndTime": 3265,
+ "X": 367.131775,
+ "Y": 193.204865
+ },
+ {
+ "StartTime": 3347,
+ "EndTime": 3347,
+ "X": 407.153748,
+ "Y": 193.072342
+ },
+ {
+ "StartTime": 3374,
+ "EndTime": 3374,
+ "X": 420.331726,
+ "Y": 193.0287
+ },
+ {
+ "StartTime": 3401,
+ "EndTime": 3401,
+ "X": 407.153748,
+ "Y": 193.072342
+ },
+ {
+ "StartTime": 3483,
+ "EndTime": 3483,
+ "X": 367.131775,
+ "Y": 193.204865
+ },
+ {
+ "StartTime": 3565,
+ "EndTime": 3565,
+ "X": 327.109772,
+ "Y": 193.337387
+ },
+ {
+ "StartTime": 3647,
+ "EndTime": 3647,
+ "X": 287.087952,
+ "Y": 193.46991
+ },
+ {
+ "StartTime": 3729,
+ "EndTime": 3729,
+ "X": 247.065948,
+ "Y": 193.602432
+ },
+ {
+ "StartTime": 3811,
+ "EndTime": 3811,
+ "X": 207.043976,
+ "Y": 193.734955
+ },
+ {
+ "StartTime": 3893,
+ "EndTime": 3893,
+ "X": 167.021988,
+ "Y": 193.867477
+ },
+ {
+ "StartTime": 3975,
+ "EndTime": 3975,
+ "X": 127,
+ "Y": 194
+ },
+ {
+ "StartTime": 4057,
+ "EndTime": 4057,
+ "X": 167.021988,
+ "Y": 193.867477
+ },
+ {
+ "StartTime": 4139,
+ "EndTime": 4139,
+ "X": 207.043976,
+ "Y": 193.734955
+ },
+ {
+ "StartTime": 4221,
+ "EndTime": 4221,
+ "X": 247.065948,
+ "Y": 193.602432
+ },
+ {
+ "StartTime": 4303,
+ "EndTime": 4303,
+ "X": 287.087952,
+ "Y": 193.46991
+ },
+ {
+ "StartTime": 4385,
+ "EndTime": 4385,
+ "X": 327.109772,
+ "Y": 193.337387
+ },
+ {
+ "StartTime": 4467,
+ "EndTime": 4467,
+ "X": 367.131775,
+ "Y": 193.204865
+ },
+ {
+ "StartTime": 4540,
+ "EndTime": 4540,
+ "X": 420.331726,
+ "Y": 193.0287
+ },
+ {
+ "StartTime": 4549,
+ "EndTime": 4549,
+ "X": 407.153748,
+ "Y": 193.072342
+ }
+ ]
+ }]
+}
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/uneven-repeat-slider.osu b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/uneven-repeat-slider.osu
new file mode 100644
index 0000000000..64aeeb0c07
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/uneven-repeat-slider.osu
@@ -0,0 +1,19 @@
+osu file format v14
+
+[General]
+StackLeniency: 0.4
+Mode: 0
+
+[Difficulty]
+CircleSize:4
+OverallDifficulty:7
+ApproachRate:8
+SliderMultiplier:1.6
+SliderTickRate:4
+
+[TimingPoints]
+369,327.868852459016,4,2,2,32,1,0
+
+[HitObjects]
+// A slider with an un-even amount of ticks
+127,194,369,6,0,L|429:193,7,293.333333333333
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
index 27546fa424..eb1977a13d 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs
@@ -18,6 +18,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
{
public class OsuCursor : SkinReloadableDrawable
{
+ private const float size = 28;
+
private bool cursorExpand;
private Bindable cursorScale;
@@ -30,7 +32,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
public OsuCursor()
{
Origin = Anchor.Centre;
- Size = new Vector2(28);
+
+ Size = new Vector2(size);
}
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
@@ -46,66 +49,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
- Child = scaleTarget = new SkinnableDrawable("cursor", _ => new CircularContainer
- {
- RelativeSizeAxes = Axes.Both,
- Masking = true,
- BorderThickness = Size.X / 6,
- BorderColour = Color4.White,
- EdgeEffect = new EdgeEffectParameters
- {
- Type = EdgeEffectType.Shadow,
- Colour = Color4.Pink.Opacity(0.5f),
- Radius = 5,
- },
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Alpha = 0,
- AlwaysPresent = true,
- },
- new CircularContainer
- {
- Origin = Anchor.Centre,
- Anchor = Anchor.Centre,
- RelativeSizeAxes = Axes.Both,
- Masking = true,
- BorderThickness = Size.X / 3,
- BorderColour = Color4.White.Opacity(0.5f),
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Alpha = 0,
- AlwaysPresent = true,
- },
- },
- },
- new CircularContainer
- {
- Origin = Anchor.Centre,
- Anchor = Anchor.Centre,
- RelativeSizeAxes = Axes.Both,
- Scale = new Vector2(0.1f),
- Masking = true,
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.White,
- },
- },
- },
- }
- }, restrictSize: false)
+ Child = scaleTarget = new SkinnableDrawable("Play/osu/cursor", _ => new DefaultCursor(), confineMode: ConfineMode.NoScaling)
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
- RelativeSizeAxes = Axes.Both,
}
};
@@ -145,5 +92,76 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
}
public void Contract() => expandTarget.ScaleTo(released_scale, 100, Easing.OutQuad);
+
+ private class DefaultCursor : CompositeDrawable
+ {
+ public DefaultCursor()
+ {
+ RelativeSizeAxes = Axes.Both;
+
+ Anchor = Anchor.Centre;
+ Origin = Anchor.Centre;
+
+ InternalChildren = new Drawable[]
+ {
+ new CircularContainer
+ {
+ RelativeSizeAxes = Axes.Both,
+ Masking = true,
+ BorderThickness = size / 6,
+ BorderColour = Color4.White,
+ EdgeEffect = new EdgeEffectParameters
+ {
+ Type = EdgeEffectType.Shadow,
+ Colour = Color4.Pink.Opacity(0.5f),
+ Radius = 5,
+ },
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Alpha = 0,
+ AlwaysPresent = true,
+ },
+ new CircularContainer
+ {
+ Origin = Anchor.Centre,
+ Anchor = Anchor.Centre,
+ RelativeSizeAxes = Axes.Both,
+ Masking = true,
+ BorderThickness = size / 3,
+ BorderColour = Color4.White.Opacity(0.5f),
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Alpha = 0,
+ AlwaysPresent = true,
+ },
+ },
+ },
+ new CircularContainer
+ {
+ Origin = Anchor.Centre,
+ Anchor = Anchor.Centre,
+ RelativeSizeAxes = Axes.Both,
+ Scale = new Vector2(0.1f),
+ Masking = true,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.White,
+ },
+ },
+ },
+ }
+ }
+ };
+ }
+ }
}
}
diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs
index e28ff5f460..9c8be868b0 100644
--- a/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs
+++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs
@@ -13,12 +13,15 @@ namespace osu.Game.Rulesets.Osu.UI
protected override Container Content => content;
private readonly Container content;
+ private const float playfield_size_adjust = 0.8f;
+
public OsuPlayfieldAdjustmentContainer()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
- Size = new Vector2(0.75f);
+ // Calculated from osu!stable as 512 (default gamefield size) / 640 (default window size)
+ Size = new Vector2(playfield_size_adjust);
InternalChild = new Container
{
@@ -40,7 +43,19 @@ namespace osu.Game.Rulesets.Osu.UI
{
base.Update();
+ // The following calculation results in a constant of 1.6 when OsuPlayfieldAdjustmentContainer
+ // is consuming the full game_size. This matches the osu-stable "magic ratio".
+ //
+ // game_size = DrawSizePreservingFillContainer.TargetSize = new Vector2(1024, 768)
+ //
+ // Parent is a 4:3 aspect enforced, using height as the constricting dimension
+ // Parent.ChildSize.X = min(game_size.X, game_size.Y * (4 / 3)) * playfield_size_adjust
+ // Parent.ChildSize.X = 819.2
+ //
+ // Scale = 819.2 / 512
+ // Scale = 1.6
Scale = new Vector2(Parent.ChildSize.X / OsuPlayfield.BASE_SIZE.X);
+ // Size = 0.625
Size = Vector2.Divide(Vector2.One, Scale);
}
}
diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs
index 68ae7544c2..6c1882b4e2 100644
--- a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs
+++ b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs
@@ -20,10 +20,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
[NonParallelizable]
[TestCase("basic")]
[TestCase("slider-generating-drumroll")]
- public new void Test(string name)
- {
- base.Test(name);
- }
+ public void Test(string name) => base.Test(name);
protected override IEnumerable CreateConvertValue(HitObject hitObject)
{
diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj
index 5510c3a9d9..82055ecaee 100644
--- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj
+++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs
index a67004e9c7..83356b77c2 100644
--- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs
+++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs
@@ -12,7 +12,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Replays.Types;
-using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Replays;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Rulesets.Difficulty;
@@ -107,7 +106,7 @@ namespace osu.Game.Rulesets.Taiko
case ModType.Fun:
return new Mod[]
{
- new MultiMod(new ModWindUp(), new ModWindDown())
+ new MultiMod(new ModWindUp(), new ModWindDown())
};
default:
diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
index d087251e7e..535320530d 100644
--- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
+++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
@@ -482,5 +482,17 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(hitObjects[0].Samples[0].Bank, hitObjects[0].Samples[1].Bank);
}
}
+
+ [Test]
+ public void TestInvalidEventStillPasses()
+ {
+ var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
+
+ using (var badResStream = TestResources.OpenResource("invalid-events.osu"))
+ using (var badStream = new StreamReader(badResStream))
+ {
+ Assert.DoesNotThrow(() => decoder.Decode(badStream));
+ }
+ }
}
}
diff --git a/osu.Game.Tests/Beatmaps/SliderEventGenerationTest.cs b/osu.Game.Tests/Beatmaps/SliderEventGenerationTest.cs
new file mode 100644
index 0000000000..9fba0f1668
--- /dev/null
+++ b/osu.Game.Tests/Beatmaps/SliderEventGenerationTest.cs
@@ -0,0 +1,116 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System.Linq;
+using NUnit.Framework;
+using osu.Game.Rulesets.Objects;
+
+namespace osu.Game.Tests.Beatmaps
+{
+ [TestFixture]
+ public class SliderEventGenerationTest
+ {
+ private const double start_time = 0;
+ private const double span_duration = 1000;
+
+ [Test]
+ public void TestSingleSpan()
+ {
+ var events = SliderEventGenerator.Generate(start_time, span_duration, 1, span_duration / 2, span_duration, 1, null).ToArray();
+
+ Assert.That(events[0].Type, Is.EqualTo(SliderEventType.Head));
+ Assert.That(events[0].Time, Is.EqualTo(start_time));
+
+ Assert.That(events[1].Type, Is.EqualTo(SliderEventType.Tick));
+ Assert.That(events[1].Time, Is.EqualTo(span_duration / 2));
+
+ Assert.That(events[3].Type, Is.EqualTo(SliderEventType.Tail));
+ Assert.That(events[3].Time, Is.EqualTo(span_duration));
+ }
+
+ [Test]
+ public void TestRepeat()
+ {
+ var events = SliderEventGenerator.Generate(start_time, span_duration, 1, span_duration / 2, span_duration, 2, null).ToArray();
+
+ Assert.That(events[0].Type, Is.EqualTo(SliderEventType.Head));
+ Assert.That(events[0].Time, Is.EqualTo(start_time));
+
+ Assert.That(events[1].Type, Is.EqualTo(SliderEventType.Tick));
+ Assert.That(events[1].Time, Is.EqualTo(span_duration / 2));
+
+ Assert.That(events[2].Type, Is.EqualTo(SliderEventType.Repeat));
+ Assert.That(events[2].Time, Is.EqualTo(span_duration));
+
+ Assert.That(events[3].Type, Is.EqualTo(SliderEventType.Tick));
+ Assert.That(events[3].Time, Is.EqualTo(span_duration + span_duration / 2));
+
+ Assert.That(events[5].Type, Is.EqualTo(SliderEventType.Tail));
+ Assert.That(events[5].Time, Is.EqualTo(2 * span_duration));
+ }
+
+ [Test]
+ public void TestNonEvenTicks()
+ {
+ var events = SliderEventGenerator.Generate(start_time, span_duration, 1, 300, span_duration, 2, null).ToArray();
+
+ Assert.That(events[0].Type, Is.EqualTo(SliderEventType.Head));
+ Assert.That(events[0].Time, Is.EqualTo(start_time));
+
+ Assert.That(events[1].Type, Is.EqualTo(SliderEventType.Tick));
+ Assert.That(events[1].Time, Is.EqualTo(300));
+
+ Assert.That(events[2].Type, Is.EqualTo(SliderEventType.Tick));
+ Assert.That(events[2].Time, Is.EqualTo(600));
+
+ Assert.That(events[3].Type, Is.EqualTo(SliderEventType.Tick));
+ Assert.That(events[3].Time, Is.EqualTo(900));
+
+ Assert.That(events[4].Type, Is.EqualTo(SliderEventType.Repeat));
+ Assert.That(events[4].Time, Is.EqualTo(span_duration));
+
+ Assert.That(events[5].Type, Is.EqualTo(SliderEventType.Tick));
+ Assert.That(events[5].Time, Is.EqualTo(1100));
+
+ Assert.That(events[6].Type, Is.EqualTo(SliderEventType.Tick));
+ Assert.That(events[6].Time, Is.EqualTo(1400));
+
+ Assert.That(events[7].Type, Is.EqualTo(SliderEventType.Tick));
+ Assert.That(events[7].Time, Is.EqualTo(1700));
+
+ Assert.That(events[9].Type, Is.EqualTo(SliderEventType.Tail));
+ Assert.That(events[9].Time, Is.EqualTo(2 * span_duration));
+ }
+
+ [Test]
+ public void TestLegacyLastTickOffset()
+ {
+ var events = SliderEventGenerator.Generate(start_time, span_duration, 1, span_duration / 2, span_duration, 1, 100).ToArray();
+
+ Assert.That(events[2].Type, Is.EqualTo(SliderEventType.LegacyLastTick));
+ Assert.That(events[2].Time, Is.EqualTo(900));
+ }
+
+ [Test]
+ public void TestMinimumTickDistance()
+ {
+ const double velocity = 5;
+ const double min_distance = velocity * 10;
+
+ var events = SliderEventGenerator.Generate(start_time, span_duration, velocity, velocity, span_duration, 2, 0).ToArray();
+
+ Assert.Multiple(() =>
+ {
+ int tickIndex = -1;
+
+ while (++tickIndex < events.Length)
+ {
+ if (events[tickIndex].Type != SliderEventType.Tick)
+ continue;
+
+ Assert.That(events[tickIndex].Time, Is.LessThan(span_duration - min_distance).Or.GreaterThan(span_duration + min_distance));
+ }
+ });
+ }
+ }
+}
diff --git a/osu.Game.Tests/Resources/invalid-events.osu b/osu.Game.Tests/Resources/invalid-events.osu
new file mode 100644
index 0000000000..df86b26dba
--- /dev/null
+++ b/osu.Game.Tests/Resources/invalid-events.osu
@@ -0,0 +1,14 @@
+osu file format v14
+
+[Events]
+bad,event,this,should,fail
+//Background and Video events
+0,0,"machinetop_background.jpg",0,0
+//Break Periods
+2,122474,140135
+//Storyboard Layer 0 (Background)
+this,is,also,bad
+//Storyboard Layer 1 (Fail)
+//Storyboard Layer 2 (Pass)
+//Storyboard Layer 3 (Foreground)
+//Storyboard Sound Samples
diff --git a/osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs b/osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs
index dc4ceed59e..f114559114 100644
--- a/osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs
+++ b/osu.Game.Tests/Visual/Background/TestSceneUserDimContainer.cs
@@ -17,7 +17,6 @@ using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
-using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
@@ -51,26 +50,14 @@ namespace osu.Game.Tests.Visual.Background
private DummySongSelect songSelect;
private TestPlayerLoader playerLoader;
private TestPlayer player;
- private DatabaseContextFactory factory;
private BeatmapManager manager;
private RulesetStore rulesets;
[BackgroundDependencyLoader]
private void load(GameHost host, AudioManager audio)
{
- factory = new DatabaseContextFactory(LocalStorage);
- factory.ResetDatabase();
-
- using (var usage = factory.Get())
- usage.Migrate();
-
- factory.ResetDatabase();
-
- using (var usage = factory.Get())
- usage.Migrate();
-
- Dependencies.Cache(rulesets = new RulesetStore(factory));
- Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, audio, host, Beatmap.Default));
+ Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
+ Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default));
Dependencies.Cache(new OsuConfigManager(LocalStorage));
manager.Import(TestResources.GetTestBeatmapForImport()).Wait();
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneBreakOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneBreakOverlay.cs
index 3cd1b8307a..879e15c548 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneBreakOverlay.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneBreakOverlay.cs
@@ -1,8 +1,11 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using System;
using System.Collections.Generic;
+using System.Linq;
using NUnit.Framework;
+using osu.Framework.Timing;
using osu.Game.Beatmaps.Timing;
using osu.Game.Screens.Play;
@@ -11,78 +14,172 @@ namespace osu.Game.Tests.Visual.Gameplay
[TestFixture]
public class TestSceneBreakOverlay : OsuTestScene
{
- private readonly BreakOverlay breakOverlay;
+ public override IReadOnlyList RequiredTypes => new[]
+ {
+ typeof(BreakOverlay),
+ };
+
+ private readonly TestBreakOverlay breakOverlay;
+
+ private readonly IReadOnlyList testBreaks = new List
+ {
+ new BreakPeriod
+ {
+ StartTime = 1000,
+ EndTime = 5000,
+ },
+ new BreakPeriod
+ {
+ StartTime = 6000,
+ EndTime = 13500,
+ },
+ };
public TestSceneBreakOverlay()
{
- Child = breakOverlay = new BreakOverlay(true);
-
- AddStep("2s break", () => startBreak(2000));
- AddStep("5s break", () => startBreak(5000));
- AddStep("10s break", () => startBreak(10000));
- AddStep("15s break", () => startBreak(15000));
- AddStep("2s, 2s", startMultipleBreaks);
- AddStep("0.5s, 0.7s, 1s, 2s", startAnotherMultipleBreaks);
+ Add(breakOverlay = new TestBreakOverlay(true));
}
- private void startBreak(double duration)
+ [Test]
+ public void TestShowBreaks()
{
- breakOverlay.Breaks = new List
+ setClock(false);
+
+ addShowBreakStep(2);
+ addShowBreakStep(5);
+ addShowBreakStep(15);
+ }
+
+ [Test]
+ public void TestNoEffectsBreak()
+ {
+ var shortBreak = new BreakPeriod { EndTime = 500 };
+
+ setClock(true);
+ loadBreaksStep("short break", new[] { shortBreak });
+
+ addBreakSeeks(shortBreak, false);
+ }
+
+ [Test]
+ public void TestMultipleBreaks()
+ {
+ setClock(true);
+ loadBreaksStep("multiple breaks", testBreaks);
+
+ foreach (var b in testBreaks)
+ addBreakSeeks(b, false);
+ }
+
+ [Test]
+ public void TestRewindBreaks()
+ {
+ setClock(true);
+ loadBreaksStep("multiple breaks", testBreaks);
+
+ foreach (var b in testBreaks.Reverse())
+ addBreakSeeks(b, true);
+ }
+
+ [Test]
+ public void TestSkipBreaks()
+ {
+ setClock(true);
+ loadBreaksStep("multiple breaks", testBreaks);
+
+ seekAndAssertBreak("seek to break start", testBreaks[1].StartTime, true);
+ AddAssert("is skipped to break #2", () => breakOverlay.CurrentBreakIndex == 1);
+
+ seekAndAssertBreak("seek to break middle", testBreaks[1].StartTime + testBreaks[1].Duration / 2, true);
+ seekAndAssertBreak("seek to break end", testBreaks[1].EndTime, false);
+ seekAndAssertBreak("seek to break after end", testBreaks[1].EndTime + 500, false);
+ }
+
+ private void addShowBreakStep(double seconds)
+ {
+ AddStep($"show '{seconds}s' break", () => breakOverlay.Breaks = new List
{
new BreakPeriod
{
StartTime = Clock.CurrentTime,
- EndTime = Clock.CurrentTime + duration,
+ EndTime = Clock.CurrentTime + seconds * 1000,
}
- };
+ });
}
- private void startMultipleBreaks()
+ private void setClock(bool useManual)
{
- double currentTime = Clock.CurrentTime;
-
- breakOverlay.Breaks = new List
- {
- new BreakPeriod
- {
- StartTime = currentTime,
- EndTime = currentTime + 2000,
- },
- new BreakPeriod
- {
- StartTime = currentTime + 4000,
- EndTime = currentTime + 6000,
- }
- };
+ AddStep($"set {(useManual ? "manual" : "realtime")} clock", () => breakOverlay.SwitchClock(useManual));
}
- private void startAnotherMultipleBreaks()
+ private void loadBreaksStep(string breakDescription, IReadOnlyList breaks)
{
- double currentTime = Clock.CurrentTime;
+ AddStep($"load {breakDescription}", () => breakOverlay.Breaks = breaks);
+ seekAndAssertBreak("seek back to 0", 0, false);
+ }
- breakOverlay.Breaks = new List
+ private void addBreakSeeks(BreakPeriod b, bool isReversed)
+ {
+ if (isReversed)
{
- new BreakPeriod // Duration is less than 650 - too short to appear
- {
- StartTime = currentTime,
- EndTime = currentTime + 500,
- },
- new BreakPeriod
- {
- StartTime = currentTime + 1500,
- EndTime = currentTime + 2200,
- },
- new BreakPeriod
- {
- StartTime = currentTime + 3200,
- EndTime = currentTime + 4200,
- },
- new BreakPeriod
- {
- StartTime = currentTime + 5200,
- EndTime = currentTime + 7200,
- }
- };
+ seekAndAssertBreak("seek to break after end", b.EndTime + 500, false);
+ seekAndAssertBreak("seek to break end", b.EndTime, false);
+ seekAndAssertBreak("seek to break middle", b.StartTime + b.Duration / 2, b.HasEffect);
+ seekAndAssertBreak("seek to break start", b.StartTime, b.HasEffect);
+ }
+ else
+ {
+ seekAndAssertBreak("seek to break start", b.StartTime, b.HasEffect);
+ seekAndAssertBreak("seek to break middle", b.StartTime + b.Duration / 2, b.HasEffect);
+ seekAndAssertBreak("seek to break end", b.EndTime, false);
+ seekAndAssertBreak("seek to break after end", b.EndTime + 500, false);
+ }
+ }
+
+ private void seekAndAssertBreak(string seekStepDescription, double time, bool shouldBeBreak)
+ {
+ AddStep(seekStepDescription, () => breakOverlay.ManualClockTime = time);
+ AddAssert($"is{(!shouldBeBreak ? " not" : string.Empty)} break time", () =>
+ {
+ breakOverlay.ProgressTime();
+ return breakOverlay.IsBreakTime.Value == shouldBeBreak;
+ });
+ }
+
+ private class TestBreakOverlay : BreakOverlay
+ {
+ private readonly FramedClock framedManualClock;
+ private readonly ManualClock manualClock;
+ private IFrameBasedClock originalClock;
+
+ public new int CurrentBreakIndex => base.CurrentBreakIndex;
+
+ public double ManualClockTime
+ {
+ get => manualClock.CurrentTime;
+ set => manualClock.CurrentTime = value;
+ }
+
+ public TestBreakOverlay(bool letterboxing)
+ : base(letterboxing)
+ {
+ framedManualClock = new FramedClock(manualClock = new ManualClock());
+ ProcessCustomClock = false;
+ }
+
+ public void ProgressTime()
+ {
+ framedManualClock.ProcessFrame();
+ Update();
+ }
+
+ public void SwitchClock(bool setManual) => Clock = setManual ? framedManualClock : originalClock;
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+ originalClock = Clock;
+ }
}
}
}
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs
deleted file mode 100644
index c7a0df6e9f..0000000000
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using System;
-using NUnit.Framework;
-using osu.Framework.Audio.Sample;
-using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
-using osu.Framework.Graphics.Shapes;
-using osu.Framework.Graphics.Textures;
-using osu.Game.Graphics;
-using osu.Game.Graphics.Sprites;
-using osu.Game.Skinning;
-using osuTK.Graphics;
-
-namespace osu.Game.Tests.Visual.Gameplay
-{
- public class TestSceneSkinReloadable : OsuTestScene
- {
- [Test]
- public void TestInitialLoad()
- {
- var secondarySource = new SecondarySource();
- SkinConsumer consumer = null;
-
- AddStep("setup layout", () =>
- {
- Child = new SkinSourceContainer
- {
- RelativeSizeAxes = Axes.Both,
- Child = new LocalSkinOverrideContainer(secondarySource)
- {
- RelativeSizeAxes = Axes.Both,
- Child = consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true)
- }
- };
- });
-
- AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
- AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1);
- }
-
- [Test]
- public void TestOverride()
- {
- var secondarySource = new SecondarySource();
-
- SkinConsumer consumer = null;
- Container target = null;
-
- AddStep("setup layout", () =>
- {
- Child = new SkinSourceContainer
- {
- RelativeSizeAxes = Axes.Both,
- Child = target = new LocalSkinOverrideContainer(secondarySource)
- {
- RelativeSizeAxes = Axes.Both,
- }
- };
- });
-
- AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true)));
- AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
- AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1);
- }
-
- private class NamedBox : Container
- {
- public NamedBox(string name)
- {
- Children = new Drawable[]
- {
- new Box
- {
- Colour = Color4.Black,
- RelativeSizeAxes = Axes.Both,
- },
- new OsuSpriteText
- {
- Font = OsuFont.Default.With(size: 40),
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Text = name
- }
- };
- }
- }
-
- private class SkinConsumer : SkinnableDrawable
- {
- public new Drawable Drawable => base.Drawable;
- public int SkinChangedCount { get; private set; }
-
- public SkinConsumer(string name, Func defaultImplementation, Func allowFallback = null, bool restrictSize = true)
- : base(name, defaultImplementation, allowFallback, restrictSize)
- {
- }
-
- protected override void SkinChanged(ISkinSource skin, bool allowFallback)
- {
- base.SkinChanged(skin, allowFallback);
- SkinChangedCount++;
- }
- }
-
- private class BaseSourceBox : NamedBox
- {
- public BaseSourceBox()
- : base("Base Source")
- {
- }
- }
-
- private class SecondarySourceBox : NamedBox
- {
- public SecondarySourceBox()
- : base("Secondary Source")
- {
- }
- }
-
- private class SecondarySource : ISkin
- {
- public Drawable GetDrawableComponent(string componentName) => new SecondarySourceBox();
-
- public Texture GetTexture(string componentName) => throw new NotImplementedException();
-
- public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
-
- public TValue GetValue(Func query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
- }
-
- private class SkinSourceContainer : Container, ISkin
- {
- public Drawable GetDrawableComponent(string componentName) => new BaseSourceBox();
-
- public Texture GetTexture(string componentName) => throw new NotImplementedException();
-
- public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
-
- public TValue GetValue(Func query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
- }
- }
-}
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs
new file mode 100644
index 0000000000..0b5978e3eb
--- /dev/null
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs
@@ -0,0 +1,283 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using System.Globalization;
+using System.Linq;
+using NUnit.Framework;
+using osu.Framework.Audio.Sample;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Graphics.Textures;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Sprites;
+using osu.Game.Skinning;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Tests.Visual.Gameplay
+{
+ public class TestSceneSkinnableDrawable : OsuTestScene
+ {
+ [Test]
+ public void TestConfineScaleDown()
+ {
+ FillFlowContainer fill = null;
+
+ AddStep("setup layout larger source", () =>
+ {
+ Child = new LocalSkinOverrideContainer(new SizedSource(50))
+ {
+ RelativeSizeAxes = Axes.Both,
+ Child = fill = new FillFlowContainer
+ {
+ Size = new Vector2(30),
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Spacing = new Vector2(10),
+ Children = new[]
+ {
+ new ExposedSkinnableDrawable("default", _ => new DefaultBox(), _ => true),
+ new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true),
+ new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true, ConfineMode.ScaleToFit),
+ new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true, ConfineMode.NoScaling)
+ }
+ },
+ };
+ });
+
+ AddAssert("check sizes", () => fill.Children.Select(c => c.Drawable.DrawWidth).SequenceEqual(new float[] { 30, 30, 30, 50 }));
+ AddStep("adjust scale", () => fill.Scale = new Vector2(2));
+ AddAssert("check sizes unchanged by scale", () => fill.Children.Select(c => c.Drawable.DrawWidth).SequenceEqual(new float[] { 30, 30, 30, 50 }));
+ }
+
+ [Test]
+ public void TestConfineScaleUp()
+ {
+ FillFlowContainer fill = null;
+
+ AddStep("setup layout larger source", () =>
+ {
+ Child = new LocalSkinOverrideContainer(new SizedSource(30))
+ {
+ RelativeSizeAxes = Axes.Both,
+ Child = fill = new FillFlowContainer
+ {
+ Size = new Vector2(50),
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Spacing = new Vector2(10),
+ Children = new[]
+ {
+ new ExposedSkinnableDrawable("default", _ => new DefaultBox(), _ => true),
+ new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true),
+ new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true, ConfineMode.ScaleToFit),
+ new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true, ConfineMode.NoScaling)
+ }
+ },
+ };
+ });
+
+ AddAssert("check sizes", () => fill.Children.Select(c => c.Drawable.DrawWidth).SequenceEqual(new float[] { 50, 30, 50, 30 }));
+ AddStep("adjust scale", () => fill.Scale = new Vector2(2));
+ AddAssert("check sizes unchanged by scale", () => fill.Children.Select(c => c.Drawable.DrawWidth).SequenceEqual(new float[] { 50, 30, 50, 30 }));
+ }
+
+ [Test]
+ public void TestInitialLoad()
+ {
+ var secondarySource = new SecondarySource();
+ SkinConsumer consumer = null;
+
+ AddStep("setup layout", () =>
+ {
+ Child = new SkinSourceContainer
+ {
+ RelativeSizeAxes = Axes.Both,
+ Child = new LocalSkinOverrideContainer(secondarySource)
+ {
+ RelativeSizeAxes = Axes.Both,
+ Child = consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true)
+ }
+ };
+ });
+
+ AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
+ AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1);
+ }
+
+ [Test]
+ public void TestOverride()
+ {
+ var secondarySource = new SecondarySource();
+
+ SkinConsumer consumer = null;
+ Container target = null;
+
+ AddStep("setup layout", () =>
+ {
+ Child = new SkinSourceContainer
+ {
+ RelativeSizeAxes = Axes.Both,
+ Child = target = new LocalSkinOverrideContainer(secondarySource)
+ {
+ RelativeSizeAxes = Axes.Both,
+ }
+ };
+ });
+
+ AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true)));
+ AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
+ AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1);
+ }
+
+ private class ExposedSkinnableDrawable : SkinnableDrawable
+ {
+ public new Drawable Drawable => base.Drawable;
+
+ public ExposedSkinnableDrawable(string name, Func defaultImplementation, Func allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
+ : base(name, defaultImplementation, allowFallback, confineMode)
+ {
+ }
+ }
+
+ private class DefaultBox : DrawWidthBox
+ {
+ public DefaultBox()
+ {
+ RelativeSizeAxes = Axes.Both;
+ }
+ }
+
+ private class DrawWidthBox : Container
+ {
+ private readonly OsuSpriteText text;
+
+ public DrawWidthBox()
+ {
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ Colour = Color4.Gray,
+ RelativeSizeAxes = Axes.Both,
+ },
+ text = new OsuSpriteText
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ }
+ };
+ }
+
+ protected override void UpdateAfterChildren()
+ {
+ base.UpdateAfterChildren();
+ text.Text = DrawWidth.ToString(CultureInfo.InvariantCulture);
+ }
+ }
+
+ private class NamedBox : Container
+ {
+ public NamedBox(string name)
+ {
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ Colour = Color4.Black,
+ RelativeSizeAxes = Axes.Both,
+ },
+ new OsuSpriteText
+ {
+ Font = OsuFont.Default.With(size: 40),
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Text = name
+ }
+ };
+ }
+ }
+
+ private class SkinConsumer : SkinnableDrawable
+ {
+ public new Drawable Drawable => base.Drawable;
+ public int SkinChangedCount { get; private set; }
+
+ public SkinConsumer(string name, Func defaultImplementation, Func allowFallback = null)
+ : base(name, defaultImplementation, allowFallback)
+ {
+ }
+
+ protected override void SkinChanged(ISkinSource skin, bool allowFallback)
+ {
+ base.SkinChanged(skin, allowFallback);
+ SkinChangedCount++;
+ }
+ }
+
+ private class BaseSourceBox : NamedBox
+ {
+ public BaseSourceBox()
+ : base("Base Source")
+ {
+ }
+ }
+
+ private class SecondarySourceBox : NamedBox
+ {
+ public SecondarySourceBox()
+ : base("Secondary Source")
+ {
+ }
+ }
+
+ private class SizedSource : ISkin
+ {
+ private readonly float size;
+
+ public SizedSource(float size)
+ {
+ this.size = size;
+ }
+
+ public Drawable GetDrawableComponent(string componentName) =>
+ componentName == "available"
+ ? new DrawWidthBox
+ {
+ Colour = Color4.Yellow,
+ Size = new Vector2(size)
+ }
+ : null;
+
+ public Texture GetTexture(string componentName) => throw new NotImplementedException();
+
+ public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
+
+ public TValue GetValue(Func query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
+ }
+
+ private class SecondarySource : ISkin
+ {
+ public Drawable GetDrawableComponent(string componentName) => new SecondarySourceBox();
+
+ public Texture GetTexture(string componentName) => throw new NotImplementedException();
+
+ public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
+
+ public TValue GetValue(Func query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
+ }
+
+ private class SkinSourceContainer : Container, ISkin
+ {
+ public Drawable GetDrawableComponent(string componentName) => new BaseSourceBox();
+
+ public Texture GetTexture(string componentName) => throw new NotImplementedException();
+
+ public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
+
+ public TValue GetValue(Func query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/Menus/IntroTestScene.cs b/osu.Game.Tests/Visual/Menus/IntroTestScene.cs
new file mode 100644
index 0000000000..d03d341ee4
--- /dev/null
+++ b/osu.Game.Tests/Visual/Menus/IntroTestScene.cs
@@ -0,0 +1,69 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Screens;
+using osu.Game.Screens;
+using osu.Game.Screens.Menu;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Tests.Visual.Menus
+{
+ [TestFixture]
+ public abstract class IntroTestScene : OsuTestScene
+ {
+ public override IReadOnlyList RequiredTypes => new[]
+ {
+ typeof(StartupScreen),
+ typeof(IntroScreen),
+ typeof(OsuScreen),
+ typeof(IntroTestScene),
+ };
+
+ [Cached]
+ private OsuLogo logo;
+
+ protected IntroTestScene()
+ {
+ Drawable introStack = null;
+
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Depth = float.MaxValue,
+ Colour = Color4.Black,
+ },
+ logo = new OsuLogo
+ {
+ Alpha = 0,
+ RelativePositionAxes = Axes.Both,
+ Depth = float.MinValue,
+ Position = new Vector2(0.5f),
+ }
+ };
+
+ AddStep("restart sequence", () =>
+ {
+ logo.FinishTransforms();
+ logo.IsTracking = false;
+
+ introStack?.Expire();
+
+ Add(introStack = new OsuScreenStack(CreateScreen())
+ {
+ RelativeSizeAxes = Axes.Both,
+ });
+ });
+ }
+
+ protected abstract IScreen CreateScreen();
+ }
+}
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneIntroCircles.cs b/osu.Game.Tests/Visual/Menus/TestSceneIntroCircles.cs
new file mode 100644
index 0000000000..107734cc8d
--- /dev/null
+++ b/osu.Game.Tests/Visual/Menus/TestSceneIntroCircles.cs
@@ -0,0 +1,15 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using NUnit.Framework;
+using osu.Framework.Screens;
+using osu.Game.Screens.Menu;
+
+namespace osu.Game.Tests.Visual.Menus
+{
+ [TestFixture]
+ public class TestSceneIntroCircles : IntroTestScene
+ {
+ protected override IScreen CreateScreen() => new IntroCircles();
+ }
+}
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneIntroSequence.cs b/osu.Game.Tests/Visual/Menus/TestSceneIntroSequence.cs
deleted file mode 100644
index b59fb18428..0000000000
--- a/osu.Game.Tests/Visual/Menus/TestSceneIntroSequence.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using System;
-using System.Collections.Generic;
-using NUnit.Framework;
-using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
-using osu.Framework.Graphics.Shapes;
-using osu.Framework.Timing;
-using osu.Game.Screens.Menu;
-using osuTK.Graphics;
-
-namespace osu.Game.Tests.Visual.Menus
-{
- [TestFixture]
- public class TestSceneIntroSequence : OsuTestScene
- {
- public override IReadOnlyList RequiredTypes => new[]
- {
- typeof(OsuLogo),
- };
-
- public TestSceneIntroSequence()
- {
- OsuLogo logo;
-
- var rateAdjustClock = new StopwatchClock(true);
- var framedClock = new FramedClock(rateAdjustClock);
- framedClock.ProcessFrame();
-
- Add(new Container
- {
- RelativeSizeAxes = Axes.Both,
- Clock = framedClock,
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black,
- },
- logo = new OsuLogo
- {
- Anchor = Anchor.Centre,
- }
- }
- });
-
- AddStep(@"Restart", logo.PlayIntro);
- AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v);
- }
- }
-}
diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs
index 4d3992ce13..9196513a55 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs
@@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.Online
private TestChatOverlay chatOverlay;
private ChannelManager channelManager;
- private readonly Channel channel1 = new Channel(new User()) { Name = "test1" };
+ private readonly Channel channel1 = new Channel(new User()) { Name = "test really long username" };
private readonly Channel channel2 = new Channel(new User()) { Name = "test2" };
[SetUp]
diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs
index c344cb9598..1f5ba67e03 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs
@@ -9,6 +9,8 @@ using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Taiko;
+using osu.Game.Users;
+using osu.Framework.Bindables;
namespace osu.Game.Tests.Visual.Online
{
@@ -23,18 +25,25 @@ namespace osu.Game.Tests.Visual.Online
public TestSceneProfileRulesetSelector()
{
ProfileRulesetSelector selector;
+ Bindable user = new Bindable();
Child = selector = new ProfileRulesetSelector
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
+ User = { BindTarget = user }
};
AddStep("set osu! as default", () => selector.SetDefaultRuleset(new OsuRuleset().RulesetInfo));
AddStep("set mania as default", () => selector.SetDefaultRuleset(new ManiaRuleset().RulesetInfo));
AddStep("set taiko as default", () => selector.SetDefaultRuleset(new TaikoRuleset().RulesetInfo));
AddStep("set catch as default", () => selector.SetDefaultRuleset(new CatchRuleset().RulesetInfo));
- AddStep("select default ruleset", selector.SelectDefaultRuleset);
+
+ AddStep("User with osu as default", () => user.Value = new User { PlayMode = "osu" });
+ AddStep("User with mania as default", () => user.Value = new User { PlayMode = "mania" });
+ AddStep("User with taiko as default", () => user.Value = new User { PlayMode = "taiko" });
+ AddStep("User with catch as default", () => user.Value = new User { PlayMode = "fruits" });
+ AddStep("null user", () => user.Value = null);
}
}
}
diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs
index 709e75ab13..c70cc4ae4e 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs
@@ -69,28 +69,22 @@ namespace osu.Game.Tests.Visual.Online
}
});
- AddStep("null user", () => graph.User.Value = null);
+ AddStep("null user", () => graph.Statistics.Value = null);
AddStep("rank only", () =>
{
- graph.User.Value = new User
+ graph.Statistics.Value = new UserStatistics
{
- Statistics = new UserStatistics
- {
- Ranks = new UserStatistics.UserRanks { Global = 123456 },
- PP = 12345,
- }
+ Ranks = new UserStatistics.UserRanks { Global = 123456 },
+ PP = 12345,
};
});
AddStep("with rank history", () =>
{
- graph.User.Value = new User
+ graph.Statistics.Value = new UserStatistics
{
- Statistics = new UserStatistics
- {
- Ranks = new UserStatistics.UserRanks { Global = 89000 },
- PP = 12345,
- },
+ Ranks = new UserStatistics.UserRanks { Global = 89000 },
+ PP = 12345,
RankHistory = new User.RankHistoryData
{
Data = data,
@@ -100,13 +94,10 @@ namespace osu.Game.Tests.Visual.Online
AddStep("with zero values", () =>
{
- graph.User.Value = new User
+ graph.Statistics.Value = new UserStatistics
{
- Statistics = new UserStatistics
- {
- Ranks = new UserStatistics.UserRanks { Global = 89000 },
- PP = 12345,
- },
+ Ranks = new UserStatistics.UserRanks { Global = 89000 },
+ PP = 12345,
RankHistory = new User.RankHistoryData
{
Data = dataWithZeros,
@@ -116,13 +107,10 @@ namespace osu.Game.Tests.Visual.Online
AddStep("small amount of data", () =>
{
- graph.User.Value = new User
+ graph.Statistics.Value = new UserStatistics
{
- Statistics = new UserStatistics
- {
- Ranks = new UserStatistics.UserRanks { Global = 12000 },
- PP = 12345,
- },
+ Ranks = new UserStatistics.UserRanks { Global = 12000 },
+ PP = 12345,
RankHistory = new User.RankHistoryData
{
Data = smallData,
@@ -132,13 +120,10 @@ namespace osu.Game.Tests.Visual.Online
AddStep("graph with edges", () =>
{
- graph.User.Value = new User
+ graph.Statistics.Value = new UserStatistics
{
- Statistics = new UserStatistics
- {
- Ranks = new UserStatistics.UserRanks { Global = 12000 },
- PP = 12345,
- },
+ Ranks = new UserStatistics.UserRanks { Global = 12000 },
+ PP = 12345,
RankHistory = new User.RankHistoryData
{
Data = edgyData,
diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs
index c2376aa153..84c99d8c3a 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs
@@ -50,12 +50,12 @@ namespace osu.Game.Tests.Visual.Online
{
Current = 727,
Progress = 69,
- }
- },
- RankHistory = new User.RankHistoryData
- {
- Mode = @"osu",
- Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray()
+ },
+ RankHistory = new User.RankHistoryData
+ {
+ Mode = @"osu",
+ Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray()
+ },
},
Badges = new[]
{
diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs b/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs
new file mode 100644
index 0000000000..18d6028cb8
--- /dev/null
+++ b/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs
@@ -0,0 +1,109 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using NUnit.Framework;
+using osu.Framework.Allocation;
+using osu.Framework.Bindables;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Online.API;
+using osu.Game.Online.API.Requests;
+using osu.Game.Rulesets;
+using osu.Game.Rulesets.Mania;
+using osu.Game.Users;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Rulesets.Taiko;
+using osu.Game.Graphics.UserInterface;
+
+namespace osu.Game.Tests.Visual.Online
+{
+ [TestFixture]
+ public class TestSceneUserRequest : OsuTestScene
+ {
+ [Resolved]
+ private IAPIProvider api { get; set; }
+
+ private readonly Bindable user = new Bindable();
+ private GetUserRequest request;
+ private readonly DimmedLoadingLayer loading;
+
+ public TestSceneUserRequest()
+ {
+ Add(new Container
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ AutoSizeAxes = Axes.Both,
+ Children = new Drawable[]
+ {
+ new UserTestContainer
+ {
+ User = { BindTarget = user }
+ },
+ loading = new DimmedLoadingLayer
+ {
+ Alpha = 0
+ }
+ }
+ });
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ AddStep(@"local user", () => getUser());
+ AddStep(@"local user with taiko ruleset", () => getUser(ruleset: new TaikoRuleset().RulesetInfo));
+ AddStep(@"cookiezi", () => getUser(124493));
+ AddStep(@"cookiezi with mania ruleset", () => getUser(124493, new ManiaRuleset().RulesetInfo));
+ }
+
+ private void getUser(long? userId = null, RulesetInfo ruleset = null)
+ {
+ loading.Show();
+
+ request?.Cancel();
+ request = new GetUserRequest(userId, ruleset);
+ request.Success += user =>
+ {
+ this.user.Value = user;
+ loading.Hide();
+ };
+ api.Queue(request);
+ }
+
+ private class UserTestContainer : FillFlowContainer
+ {
+ public readonly Bindable User = new Bindable();
+
+ public UserTestContainer()
+ {
+ AutoSizeAxes = Axes.Both;
+ Direction = FillDirection.Vertical;
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+ User.BindValueChanged(onUserUpdate, true);
+ }
+
+ private void onUserUpdate(ValueChangedEvent user)
+ {
+ Clear();
+
+ AddRange(new Drawable[]
+ {
+ new SpriteText
+ {
+ Text = $@"Username: {user.NewValue?.Username}"
+ },
+ new SpriteText
+ {
+ Text = $@"RankedScore: {user.NewValue?.Statistics.RankedScore}"
+ },
+ });
+ }
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
index f3255814f2..680250a226 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
@@ -15,7 +15,6 @@ using osu.Framework.MathUtils;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
-using osu.Game.Database;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
@@ -35,7 +34,6 @@ namespace osu.Game.Tests.Visual.SongSelect
private RulesetStore rulesets;
private WorkingBeatmap defaultBeatmap;
- private DatabaseContextFactory factory;
public override IReadOnlyList RequiredTypes => new[]
{
@@ -74,28 +72,11 @@ namespace osu.Game.Tests.Visual.SongSelect
private TestSongSelect songSelect;
- protected override void Dispose(bool isDisposing)
- {
- factory.ResetDatabase();
- base.Dispose(isDisposing);
- }
-
[BackgroundDependencyLoader]
private void load(GameHost host, AudioManager audio)
{
- factory = new DatabaseContextFactory(LocalStorage);
- factory.ResetDatabase();
-
- using (var usage = factory.Get())
- usage.Migrate();
-
- factory.ResetDatabase();
-
- using (var usage = factory.Get())
- usage.Migrate();
-
- Dependencies.Cache(rulesets = new RulesetStore(factory));
- Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
+ Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
+ Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
Beatmap.SetDefault();
}
diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj
index 659f5415c3..50530088c2 100644
--- a/osu.Game.Tests/osu.Game.Tests.csproj
+++ b/osu.Game.Tests/osu.Game.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs
index f329623703..e65b708fea 100644
--- a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs
+++ b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs
@@ -5,14 +5,13 @@ using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using osu.Game.Tests.Visual;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Ladder.Components;
namespace osu.Game.Tournament.Tests.Components
{
- public class TestSceneDrawableTournamentMatch : OsuTestScene
+ public class TestSceneDrawableTournamentMatch : TournamentTestScene
{
public override IReadOnlyList RequiredTypes => new[]
{
diff --git a/osu.Game.Tournament.Tests/LadderTestScene.cs b/osu.Game.Tournament.Tests/LadderTestScene.cs
index b49341d0d1..dae0721023 100644
--- a/osu.Game.Tournament.Tests/LadderTestScene.cs
+++ b/osu.Game.Tournament.Tests/LadderTestScene.cs
@@ -1,13 +1,14 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using NUnit.Framework;
using osu.Framework.Allocation;
-using osu.Game.Tests.Visual;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Tests
{
- public abstract class LadderTestScene : OsuTestScene
+ [TestFixture]
+ public abstract class LadderTestScene : TournamentTestScene
{
[Resolved]
protected LadderInfo Ladder { get; private set; }
diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs
index 201736f38a..9de00818a5 100644
--- a/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs
+++ b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs
@@ -2,13 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
-using osu.Game.Tests.Visual;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Gameplay;
namespace osu.Game.Tournament.Tests.Screens
{
- public class TestSceneGameplayScreen : OsuTestScene
+ public class TestSceneGameplayScreen : TournamentTestScene
{
[Cached]
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs
index f3e65919eb..2277302e98 100644
--- a/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs
+++ b/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs
@@ -2,12 +2,11 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
-using osu.Game.Tests.Visual;
using osu.Game.Tournament.Screens.Schedule;
namespace osu.Game.Tournament.Tests.Screens
{
- public class TestSceneScheduleScreen : OsuTestScene
+ public class TestSceneScheduleScreen : TournamentTestScene
{
[BackgroundDependencyLoader]
private void load()
diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs
index edf1477b06..8c43e25416 100644
--- a/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs
+++ b/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs
@@ -2,12 +2,11 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
-using osu.Game.Tests.Visual;
using osu.Game.Tournament.Screens.Showcase;
namespace osu.Game.Tournament.Tests.Screens
{
- public class TestSceneShowcaseScreen : OsuTestScene
+ public class TestSceneShowcaseScreen : TournamentTestScene
{
[BackgroundDependencyLoader]
private void load()
diff --git a/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs b/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs
index 378614343a..4d134ce4af 100644
--- a/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs
+++ b/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs
@@ -3,11 +3,10 @@
using osu.Framework.Allocation;
using osu.Framework.Platform;
-using osu.Game.Tests.Visual;
namespace osu.Game.Tournament.Tests
{
- public class TestSceneTournamentSceneManager : OsuTestScene
+ public class TestSceneTournamentSceneManager : TournamentTestScene
{
[BackgroundDependencyLoader]
private void load(Storage storage)
diff --git a/osu.Game.Tournament.Tests/TournamentTestScene.cs b/osu.Game.Tournament.Tests/TournamentTestScene.cs
new file mode 100644
index 0000000000..18ac3230da
--- /dev/null
+++ b/osu.Game.Tournament.Tests/TournamentTestScene.cs
@@ -0,0 +1,28 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Testing;
+using osu.Game.Tests.Visual;
+
+namespace osu.Game.Tournament.Tests
+{
+ public abstract class TournamentTestScene : OsuTestScene
+ {
+ protected override ITestSceneTestRunner CreateRunner() => new TournamentTestSceneTestRunner();
+
+ public class TournamentTestSceneTestRunner : TournamentGameBase, ITestSceneTestRunner
+ {
+ private TestSceneTestRunner.TestRunner runner;
+
+ protected override void LoadAsyncComplete()
+ {
+ // this has to be run here rather than LoadComplete because
+ // TestScene.cs is checking the IsLoaded state (on another thread) and expects
+ // the runner to be loaded at that point.
+ Add(runner = new TestSceneTestRunner.TestRunner());
+ }
+
+ public void RunTestBlocking(TestScene test) => runner.RunTestBlocking(test);
+ }
+ }
+}
diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
index dad2fe0877..257db89a20 100644
--- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
+++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
@@ -7,7 +7,7 @@
-
+
WinExe
diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs
index 67531ce5d3..83a41a662f 100644
--- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs
+++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs
@@ -88,7 +88,7 @@ namespace osu.Game.Tournament.Screens.Ladder
};
}
- private Cached layout = new Cached();
+ private readonly Cached layout = new Cached();
protected override void Update()
{
diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs
index 06fb52da77..dbfa70704b 100644
--- a/osu.Game.Tournament/TournamentGameBase.cs
+++ b/osu.Game.Tournament/TournamentGameBase.cs
@@ -9,15 +9,20 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Framework.IO.Stores;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
+using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models;
+using osuTK.Graphics;
using osuTK.Input;
namespace osu.Game.Tournament
@@ -35,6 +40,8 @@ namespace osu.Game.Tournament
private Bindable windowSize;
private FileBasedIPC ipc;
+ private Drawable heightWarning;
+
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
return dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
@@ -53,6 +60,12 @@ namespace osu.Game.Tournament
this.storage = storage;
windowSize = frameworkConfig.GetBindable(FrameworkSetting.WindowedSize);
+ windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
+ {
+ var minWidth = (int)(size.NewValue.Height / 9f * 16 + 400);
+
+ heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
+ }), true);
readBracket();
@@ -61,16 +74,43 @@ namespace osu.Game.Tournament
dependencies.CacheAs(ipc = new FileBasedIPC());
Add(ipc);
- Add(new OsuButton
+ AddRange(new[]
{
- Text = "Save Changes",
- Width = 140,
- Height = 50,
- Depth = float.MinValue,
- Anchor = Anchor.BottomRight,
- Origin = Anchor.BottomRight,
- Padding = new MarginPadding(10),
- Action = SaveChanges,
+ new OsuButton
+ {
+ Text = "Save Changes",
+ Width = 140,
+ Height = 50,
+ Depth = float.MinValue,
+ Anchor = Anchor.BottomRight,
+ Origin = Anchor.BottomRight,
+ Padding = new MarginPadding(10),
+ Action = SaveChanges,
+ },
+ heightWarning = new Container
+ {
+ Masking = true,
+ CornerRadius = 5,
+ Depth = float.MinValue,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ AutoSizeAxes = Axes.Both,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ Colour = Color4.Red,
+ RelativeSizeAxes = Axes.Both,
+ },
+ new SpriteText
+ {
+ Text = "Please make the window wider",
+ Font = OsuFont.Default.With(weight: "bold"),
+ Colour = Color4.White,
+ Padding = new MarginPadding(20)
+ }
+ }
+ },
});
}
@@ -195,18 +235,6 @@ namespace osu.Game.Tournament
base.LoadComplete();
}
- protected override void Update()
- {
- base.Update();
- var minWidth = (int)(windowSize.Value.Height / 9f * 16 + 400);
-
- if (windowSize.Value.Width < minWidth)
- {
- // todo: can be removed after ppy/osu-framework#1975
- windowSize.Value = Host.Window.ClientSize = new Size(minWidth, windowSize.Value.Height);
- }
- }
-
protected virtual void SaveChanges()
{
foreach (var r in ladder.Rounds)
diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs
index 3cd425ea44..02d969b571 100644
--- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs
@@ -5,7 +5,6 @@ using System;
using System.IO;
using System.Linq;
using osu.Framework.IO.File;
-using osu.Framework.Logging;
using osu.Game.Beatmaps.Timing;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Beatmaps.ControlPoints;
@@ -290,8 +289,9 @@ namespace osu.Game.Beatmaps.Formats
string[] split = line.Split(',');
EventType type;
+
if (!Enum.TryParse(split[0], out type))
- throw new InvalidDataException($@"Unknown event type {split[0]}");
+ throw new InvalidDataException($@"Unknown event type: {split[0]}");
switch (type)
{
@@ -319,90 +319,79 @@ namespace osu.Game.Beatmaps.Formats
private void handleTimingPoint(string line)
{
- try
+ string[] split = line.Split(',');
+
+ double time = getOffsetTime(Parsing.ParseDouble(split[0].Trim()));
+ double beatLength = Parsing.ParseDouble(split[1].Trim());
+ double speedMultiplier = beatLength < 0 ? 100.0 / -beatLength : 1;
+
+ TimeSignatures timeSignature = TimeSignatures.SimpleQuadruple;
+ if (split.Length >= 3)
+ timeSignature = split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)Parsing.ParseInt(split[2]);
+
+ LegacySampleBank sampleSet = defaultSampleBank;
+ if (split.Length >= 4)
+ sampleSet = (LegacySampleBank)Parsing.ParseInt(split[3]);
+
+ int customSampleBank = 0;
+ if (split.Length >= 5)
+ customSampleBank = Parsing.ParseInt(split[4]);
+
+ int sampleVolume = defaultSampleVolume;
+ if (split.Length >= 6)
+ sampleVolume = Parsing.ParseInt(split[5]);
+
+ bool timingChange = true;
+ if (split.Length >= 7)
+ timingChange = split[6][0] == '1';
+
+ bool kiaiMode = false;
+ bool omitFirstBarSignature = false;
+
+ if (split.Length >= 8)
{
- string[] split = line.Split(',');
-
- double time = getOffsetTime(Parsing.ParseDouble(split[0].Trim()));
- double beatLength = Parsing.ParseDouble(split[1].Trim());
- double speedMultiplier = beatLength < 0 ? 100.0 / -beatLength : 1;
-
- TimeSignatures timeSignature = TimeSignatures.SimpleQuadruple;
- if (split.Length >= 3)
- timeSignature = split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)Parsing.ParseInt(split[2]);
-
- LegacySampleBank sampleSet = defaultSampleBank;
- if (split.Length >= 4)
- sampleSet = (LegacySampleBank)Parsing.ParseInt(split[3]);
-
- int customSampleBank = 0;
- if (split.Length >= 5)
- customSampleBank = Parsing.ParseInt(split[4]);
-
- int sampleVolume = defaultSampleVolume;
- if (split.Length >= 6)
- sampleVolume = Parsing.ParseInt(split[5]);
-
- bool timingChange = true;
- if (split.Length >= 7)
- timingChange = split[6][0] == '1';
-
- bool kiaiMode = false;
- bool omitFirstBarSignature = false;
-
- if (split.Length >= 8)
- {
- EffectFlags effectFlags = (EffectFlags)Parsing.ParseInt(split[7]);
- kiaiMode = effectFlags.HasFlag(EffectFlags.Kiai);
- omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine);
- }
-
- string stringSampleSet = sampleSet.ToString().ToLowerInvariant();
- if (stringSampleSet == @"none")
- stringSampleSet = @"normal";
-
- if (timingChange)
- {
- var controlPoint = CreateTimingControlPoint();
- controlPoint.Time = time;
- controlPoint.BeatLength = beatLength;
- controlPoint.TimeSignature = timeSignature;
-
- handleTimingControlPoint(controlPoint);
- }
-
- handleDifficultyControlPoint(new DifficultyControlPoint
- {
- Time = time,
- SpeedMultiplier = speedMultiplier,
- AutoGenerated = timingChange
- });
-
- handleEffectControlPoint(new EffectControlPoint
- {
- Time = time,
- KiaiMode = kiaiMode,
- OmitFirstBarLine = omitFirstBarSignature,
- AutoGenerated = timingChange
- });
-
- handleSampleControlPoint(new LegacySampleControlPoint
- {
- Time = time,
- SampleBank = stringSampleSet,
- SampleVolume = sampleVolume,
- CustomSampleBank = customSampleBank,
- AutoGenerated = timingChange
- });
+ EffectFlags effectFlags = (EffectFlags)Parsing.ParseInt(split[7]);
+ kiaiMode = effectFlags.HasFlag(EffectFlags.Kiai);
+ omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine);
}
- catch (FormatException)
+
+ string stringSampleSet = sampleSet.ToString().ToLowerInvariant();
+ if (stringSampleSet == @"none")
+ stringSampleSet = @"normal";
+
+ if (timingChange)
{
- Logger.Log("A timing point could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
+ var controlPoint = CreateTimingControlPoint();
+ controlPoint.Time = time;
+ controlPoint.BeatLength = beatLength;
+ controlPoint.TimeSignature = timeSignature;
+
+ handleTimingControlPoint(controlPoint);
}
- catch (OverflowException)
+
+ handleDifficultyControlPoint(new DifficultyControlPoint
{
- Logger.Log("A timing point could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
- }
+ Time = time,
+ SpeedMultiplier = speedMultiplier,
+ AutoGenerated = timingChange
+ });
+
+ handleEffectControlPoint(new EffectControlPoint
+ {
+ Time = time,
+ KiaiMode = kiaiMode,
+ OmitFirstBarLine = omitFirstBarSignature,
+ AutoGenerated = timingChange
+ });
+
+ handleSampleControlPoint(new LegacySampleControlPoint
+ {
+ Time = time,
+ SampleBank = stringSampleSet,
+ SampleVolume = sampleVolume,
+ CustomSampleBank = customSampleBank,
+ AutoGenerated = timingChange
+ });
}
private void handleTimingControlPoint(TimingControlPoint newPoint)
diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs
index 7999c82761..d6d6804d16 100644
--- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs
@@ -49,7 +49,7 @@ namespace osu.Game.Beatmaps.Formats
}
catch (Exception e)
{
- Logger.Error(e, $"Failed to process line \"{line}\" into {output}");
+ Logger.Log($"Failed to process line \"{line}\" into {output}: {e.Message}", LoggingTarget.Runtime, LogLevel.Important);
}
}
}
diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs
index f6e2bf6966..3ae1c3ef12 100644
--- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs
@@ -82,8 +82,9 @@ namespace osu.Game.Beatmaps.Formats
storyboardSprite = null;
EventType type;
+
if (!Enum.TryParse(split[0], out type))
- throw new InvalidDataException($@"Unknown event type {split[0]}");
+ throw new InvalidDataException($@"Unknown event type: {split[0]}");
switch (type)
{
diff --git a/osu.Game/Beatmaps/Legacy/LegacyMods.cs b/osu.Game/Beatmaps/Legacy/LegacyMods.cs
index 8e53c24e7b..583e950e49 100644
--- a/osu.Game/Beatmaps/Legacy/LegacyMods.cs
+++ b/osu.Game/Beatmaps/Legacy/LegacyMods.cs
@@ -9,7 +9,7 @@ namespace osu.Game.Beatmaps.Legacy
public enum LegacyMods
{
None = 0,
- NoFail = 1 << 0,
+ NoFail = 1,
Easy = 1 << 1,
TouchDevice = 1 << 2,
Hidden = 1 << 3,
diff --git a/osu.Game/Beatmaps/Timing/BreakPeriod.cs b/osu.Game/Beatmaps/Timing/BreakPeriod.cs
index 856a5fefd4..5d79c7a86b 100644
--- a/osu.Game/Beatmaps/Timing/BreakPeriod.cs
+++ b/osu.Game/Beatmaps/Timing/BreakPeriod.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using osu.Game.Screens.Play;
+
namespace osu.Game.Beatmaps.Timing
{
public class BreakPeriod
@@ -35,6 +37,6 @@ namespace osu.Game.Beatmaps.Timing
///
/// The time to check in milliseconds.
/// Whether the time falls within this .
- public bool Contains(double time) => time >= StartTime && time <= EndTime;
+ public bool Contains(double time) => time >= StartTime && time <= EndTime - BreakOverlay.BREAK_FADE_DURATION;
}
}
diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs
index 949a2aab6f..8605caa5fe 100644
--- a/osu.Game/Beatmaps/WorkingBeatmap.cs
+++ b/osu.Game/Beatmaps/WorkingBeatmap.cs
@@ -89,6 +89,14 @@ namespace osu.Game.Beatmaps
return path;
}
+ ///
+ /// Creates a to convert a for a specified .
+ ///
+ /// The to be converted.
+ /// The for which should be converted.
+ /// The applicable .
+ protected virtual IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset) => ruleset.CreateBeatmapConverter(beatmap);
+
///
/// Constructs a playable from using the applicable converters for a specific .
///
@@ -104,7 +112,7 @@ namespace osu.Game.Beatmaps
{
var rulesetInstance = ruleset.CreateInstance();
- IBeatmapConverter converter = rulesetInstance.CreateBeatmapConverter(Beatmap);
+ IBeatmapConverter converter = CreateBeatmapConverter(Beatmap, rulesetInstance);
// Check if the beatmap can be converted
if (!converter.CanConvert)
@@ -141,6 +149,9 @@ namespace osu.Game.Beatmaps
processor?.PostProcess();
+ foreach (var mod in mods.OfType())
+ mod.ApplyToBeatmap(converted);
+
return converted;
}
diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs
index ed65bdc069..52d3f013ce 100644
--- a/osu.Game/Database/ArchiveModelManager.cs
+++ b/osu.Game/Database/ArchiveModelManager.cs
@@ -31,10 +31,21 @@ namespace osu.Game.Database
///
/// The model type.
/// The associated file join type.
- public abstract class ArchiveModelManager : ArchiveModelManager, ICanAcceptFiles, IModelManager
+ public abstract class ArchiveModelManager : ICanAcceptFiles, IModelManager
where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete
where TFileModel : INamedFileInfo, new()
{
+ private const int import_queue_request_concurrency = 1;
+
+ ///
+ /// A singleton scheduler shared by all .
+ ///
+ ///
+ /// This scheduler generally performs IO and CPU intensive work so concurrency is limited harshly.
+ /// It is mainly being used as a queue mechanism for large imports.
+ ///
+ private static readonly ThreadedTaskScheduler import_scheduler = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(ArchiveModelManager));
+
///
/// Set an endpoint for notifications to be posted to.
///
@@ -253,7 +264,7 @@ namespace osu.Game.Database
using (Stream s = reader.GetStream(file))
s.CopyTo(hashable);
- return hashable.ComputeSHA2Hash();
+ return hashable.Length > 0 ? hashable.ComputeSHA2Hash() : null;
}
///
@@ -336,7 +347,7 @@ namespace osu.Game.Database
flushEvents(true);
return item;
- }, cancellationToken, TaskCreationOptions.HideScheduler, IMPORT_SCHEDULER).Unwrap();
+ }, cancellationToken, TaskCreationOptions.HideScheduler, import_scheduler).Unwrap();
///
/// Perform an update of the specified item.
@@ -646,18 +657,4 @@ namespace osu.Game.Database
#endregion
}
-
- public abstract class ArchiveModelManager
- {
- private const int import_queue_request_concurrency = 1;
-
- ///
- /// A singleton scheduler shared by all .
- ///
- ///
- /// This scheduler generally performs IO and CPU intensive work so concurrency is limited harshly.
- /// It is mainly being used as a queue mechanism for large imports.
- ///
- protected static readonly ThreadedTaskScheduler IMPORT_SCHEDULER = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(ArchiveModelManager));
- }
}
diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs
index 2b68e8530d..dffa0c4fd5 100644
--- a/osu.Game/Graphics/Backgrounds/Triangles.cs
+++ b/osu.Game/Graphics/Backgrounds/Triangles.cs
@@ -191,7 +191,7 @@ namespace osu.Game.Graphics.Backgrounds
private readonly List parts = new List();
private Vector2 size;
- private TriangleBatch vertexBatch;
+ private QuadBatch vertexBatch;
public TrianglesDrawNode(Triangles source)
: base(source)
@@ -217,7 +217,7 @@ namespace osu.Game.Graphics.Backgrounds
if (Source.AimCount > 0 && (vertexBatch == null || vertexBatch.Size != Source.AimCount))
{
vertexBatch?.Dispose();
- vertexBatch = new TriangleBatch(Source.AimCount, 1);
+ vertexBatch = new QuadBatch(Source.AimCount, 1);
}
shader.Bind();
diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs
index 53092ddc9e..8fc8dec9fd 100644
--- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs
+++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs
@@ -27,11 +27,12 @@ namespace osu.Game.Graphics.Containers
private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;
- private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
+ private void scrollFromMouseEvent(MouseEvent e) =>
+ ScrollTo(Clamp(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim] / DrawSize[ScrollDim]) * Content.DrawSize[ScrollDim], true, DistanceDecayOnRightMouseScrollbar);
- private bool mouseScrollBarDragging;
+ private bool rightMouseDragging;
- protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging;
+ protected override bool IsDragging => base.IsDragging || rightMouseDragging;
public OsuScrollContainer(Direction scrollDirection = Direction.Vertical)
: base(scrollDirection)
@@ -42,7 +43,7 @@ namespace osu.Game.Graphics.Containers
{
if (shouldPerformRightMouseScroll(e))
{
- scrollToRelative(e.MousePosition[ScrollDim]);
+ scrollFromMouseEvent(e);
return true;
}
@@ -51,9 +52,9 @@ namespace osu.Game.Graphics.Containers
protected override bool OnDrag(DragEvent e)
{
- if (mouseScrollBarDragging)
+ if (rightMouseDragging)
{
- scrollToRelative(e.MousePosition[ScrollDim]);
+ scrollFromMouseEvent(e);
return true;
}
@@ -64,7 +65,7 @@ namespace osu.Game.Graphics.Containers
{
if (shouldPerformRightMouseScroll(e))
{
- mouseScrollBarDragging = true;
+ rightMouseDragging = true;
return true;
}
@@ -73,9 +74,9 @@ namespace osu.Game.Graphics.Containers
protected override bool OnDragEnd(DragEndEvent e)
{
- if (mouseScrollBarDragging)
+ if (rightMouseDragging)
{
- mouseScrollBarDragging = false;
+ rightMouseDragging = false;
return true;
}
diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs
index 5ad5e5569a..524a4742c0 100644
--- a/osu.Game/Graphics/ScreenshotManager.cs
+++ b/osu.Game/Graphics/ScreenshotManager.cs
@@ -92,7 +92,8 @@ namespace osu.Game.Graphics
using (var image = await host.TakeScreenshotAsync())
{
- Interlocked.Decrement(ref screenShotTasks);
+ if (Interlocked.Decrement(ref screenShotTasks) == 0 && cursorVisibility.Value == false)
+ cursorVisibility.Value = true;
var fileName = getFileName();
if (fileName == null) return;
@@ -125,14 +126,6 @@ namespace osu.Game.Graphics
}
});
- protected override void Update()
- {
- base.Update();
-
- if (cursorVisibility.Value == false && Interlocked.CompareExchange(ref screenShotTasks, 0, 0) == 0)
- cursorVisibility.Value = true;
- }
-
private string getFileName()
{
var dt = DateTime.Now;
diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs
index 48bf0848ae..c4735b4a16 100644
--- a/osu.Game/Graphics/UserInterface/BackButton.cs
+++ b/osu.Game/Graphics/UserInterface/BackButton.cs
@@ -22,8 +22,8 @@ namespace osu.Game.Graphics.UserInterface
Child = button = new TwoLayerButton
{
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
+ Anchor = Anchor.TopLeft,
+ Origin = Anchor.TopLeft,
Text = @"back",
Icon = OsuIcon.LeftCircle,
Action = () => Action?.Invoke()
diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs
index 2a858ccbcf..f8d5955503 100644
--- a/osu.Game/Graphics/UserInterface/Bar.cs
+++ b/osu.Game/Graphics/UserInterface/Bar.cs
@@ -110,7 +110,7 @@ namespace osu.Game.Graphics.UserInterface
[Flags]
public enum BarDirection
{
- LeftToRight = 1 << 0,
+ LeftToRight = 1,
RightToLeft = 1 << 1,
TopToBottom = 1 << 2,
BottomToTop = 1 << 3,
diff --git a/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs b/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs
new file mode 100644
index 0000000000..b7d2222f33
--- /dev/null
+++ b/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs
@@ -0,0 +1,44 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osuTK.Graphics;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Extensions.Color4Extensions;
+
+namespace osu.Game.Graphics.UserInterface
+{
+ public class DimmedLoadingLayer : VisibilityContainer
+ {
+ private const float transition_duration = 250;
+
+ private readonly LoadingAnimation loading;
+
+ public DimmedLoadingLayer()
+ {
+ RelativeSizeAxes = Axes.Both;
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black.Opacity(0.5f),
+ },
+ loading = new LoadingAnimation(),
+ };
+ }
+
+ protected override void PopIn()
+ {
+ this.FadeIn(transition_duration, Easing.OutQuint);
+ loading.Show();
+ }
+
+ protected override void PopOut()
+ {
+ this.FadeOut(transition_duration, Easing.OutQuint);
+ loading.Hide();
+ }
+ }
+}
diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs
index 714e953816..6d65b77cbf 100644
--- a/osu.Game/Graphics/UserInterface/LineGraph.cs
+++ b/osu.Game/Graphics/UserInterface/LineGraph.cs
@@ -93,7 +93,7 @@ namespace osu.Game.Graphics.UserInterface
return base.Invalidate(invalidation, source, shallPropagate);
}
- private Cached pathCached = new Cached();
+ private readonly Cached pathCached = new Cached();
protected override void Update()
{
diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
index d158186899..544acc7eb2 100644
--- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
@@ -81,7 +81,8 @@ namespace osu.Game.Graphics.UserInterface
Colour = Color4.White,
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
- }
+ },
+ new HoverClickSounds()
};
Current.ValueChanged += selected =>
diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs
index c74d00cd1e..aa96796cf1 100644
--- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs
+++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs
@@ -15,6 +15,7 @@ using System;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
+using osu.Game.Screens.Select;
namespace osu.Game.Graphics.UserInterface
{
@@ -28,7 +29,9 @@ namespace osu.Game.Graphics.UserInterface
private const int transform_time = 600;
private const int pulse_length = 250;
- private const float shear = 0.1f;
+ private const float shear_width = 5f;
+
+ private static readonly Vector2 shear = new Vector2(shear_width / Footer.HEIGHT, 0);
public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50);
public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50);
@@ -56,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface
c1.Origin = c1.Anchor = value.HasFlag(Anchor.x2) ? Anchor.TopLeft : Anchor.TopRight;
c2.Origin = c2.Anchor = value.HasFlag(Anchor.x2) ? Anchor.TopRight : Anchor.TopLeft;
- X = value.HasFlag(Anchor.x2) ? SIZE_RETRACTED.X * shear * 0.5f : 0;
+ X = value.HasFlag(Anchor.x2) ? SIZE_RETRACTED.X * shear.X * 0.5f : 0;
Remove(c1);
Remove(c2);
@@ -70,6 +73,7 @@ namespace osu.Game.Graphics.UserInterface
public TwoLayerButton()
{
Size = SIZE_RETRACTED;
+ Shear = shear;
Children = new Drawable[]
{
@@ -82,7 +86,6 @@ namespace osu.Game.Graphics.UserInterface
new Container
{
RelativeSizeAxes = Axes.Both,
- Shear = new Vector2(shear, 0),
Masking = true,
MaskingSmoothness = 2,
EdgeEffect = new EdgeEffectParameters
@@ -105,6 +108,7 @@ namespace osu.Game.Graphics.UserInterface
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
+ Shear = -shear,
},
}
},
@@ -119,7 +123,6 @@ namespace osu.Game.Graphics.UserInterface
new Container
{
RelativeSizeAxes = Axes.Both,
- Shear = new Vector2(shear, 0),
Masking = true,
MaskingSmoothness = 2,
EdgeEffect = new EdgeEffectParameters
@@ -144,6 +147,7 @@ namespace osu.Game.Graphics.UserInterface
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
+ Shear = -shear,
}
}
},
@@ -188,7 +192,6 @@ namespace osu.Game.Graphics.UserInterface
var flash = new Box
{
RelativeSizeAxes = Axes.Both,
- Shear = new Vector2(shear, 0),
Colour = Color4.White.Opacity(0.5f),
};
Add(flash);
diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs
index f3384163b8..fb1385793f 100644
--- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs
+++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs
@@ -27,6 +27,7 @@ namespace osu.Game.Online.API.Requests
{
Favourite,
RankedAndApproved,
+ Loved,
Unranked,
Graveyard
}
diff --git a/osu.Game/Online/API/Requests/GetUserRequest.cs b/osu.Game/Online/API/Requests/GetUserRequest.cs
index 37ed0574f1..31b7e95b39 100644
--- a/osu.Game/Online/API/Requests/GetUserRequest.cs
+++ b/osu.Game/Online/API/Requests/GetUserRequest.cs
@@ -2,18 +2,21 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Users;
+using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests
{
public class GetUserRequest : APIRequest
{
private readonly long? userId;
+ private readonly RulesetInfo ruleset;
- public GetUserRequest(long? userId = null)
+ public GetUserRequest(long? userId = null, RulesetInfo ruleset = null)
{
this.userId = userId;
+ this.ruleset = ruleset;
}
- protected override string Target => userId.HasValue ? $@"users/{userId}" : @"me";
+ protected override string Target => userId.HasValue ? $@"users/{userId}/{ruleset?.ShortName}" : $@"me/{ruleset?.ShortName}";
}
}
diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs
index d41966fe1b..7b4d66e7b2 100644
--- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs
+++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs
@@ -2,7 +2,9 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
+using osu.Framework.IO.Network;
using osu.Game.Online.API.Requests.Responses;
+using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests
{
@@ -10,12 +12,24 @@ namespace osu.Game.Online.API.Requests
{
private readonly long userId;
private readonly ScoreType type;
+ private readonly RulesetInfo ruleset;
- public GetUserScoresRequest(long userId, ScoreType type, int page = 0, int itemsPerPage = 5)
+ public GetUserScoresRequest(long userId, ScoreType type, int page = 0, int itemsPerPage = 5, RulesetInfo ruleset = null)
: base(page, itemsPerPage)
{
this.userId = userId;
this.type = type;
+ this.ruleset = ruleset;
+ }
+
+ protected override WebRequest CreateWebRequest()
+ {
+ var req = base.CreateWebRequest();
+
+ if (ruleset != null)
+ req.AddParameter("mode", ruleset.ShortName);
+
+ return req;
}
protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLowerInvariant()}";
diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs
index d9d05ff285..c8c36789c4 100644
--- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs
+++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs
@@ -27,24 +27,25 @@ namespace osu.Game.Online.API.Requests
}
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
- protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)searchCategory}&sort={sortCriteria.ToString().ToLowerInvariant()}_{directionString}";
+ protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={searchCategory.ToString().ToLowerInvariant()}&sort={sortCriteria.ToString().ToLowerInvariant()}_{directionString}";
}
public enum BeatmapSearchCategory
{
- Any = 7,
+ Any,
- [Description("Ranked & Approved")]
- RankedApproved = 0,
- Qualified = 3,
- Loved = 8,
- Favourites = 2,
+ [Description("Has Leaderboard")]
+ Leaderboard,
+ Ranked,
+ Qualified,
+ Loved,
+ Favourites,
[Description("Pending & WIP")]
- PendingWIP = 4,
- Graveyard = 5,
+ Pending,
+ Graveyard,
[Description("My Maps")]
- MyMaps = 6,
+ Mine,
}
}
diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs
index 3af11ff20f..4f6066cab1 100644
--- a/osu.Game/Online/Chat/ChannelManager.cs
+++ b/osu.Game/Online/Chat/ChannelManager.cs
@@ -213,8 +213,27 @@ namespace osu.Game.Online.Chat
PostMessage(content, true);
break;
+ case "join":
+ if (string.IsNullOrWhiteSpace(content))
+ {
+ target.AddNewMessages(new ErrorMessage("Usage: /join [channel]"));
+ break;
+ }
+
+ var channel = availableChannels.Where(c => c.Name == content || c.Name == $"#{content}").FirstOrDefault();
+
+ if (channel == null)
+ {
+ target.AddNewMessages(new ErrorMessage($"Channel '{content}' not found."));
+ break;
+ }
+
+ JoinChannel(channel);
+ CurrentChannel.Value = channel;
+ break;
+
case "help":
- target.AddNewMessages(new InfoMessage("Supported commands: /help, /me [action]"));
+ target.AddNewMessages(new InfoMessage("Supported commands: /help, /me [action], /join [channel]"));
break;
default:
diff --git a/osu.Game/Online/Chat/ErrorMessage.cs b/osu.Game/Online/Chat/ErrorMessage.cs
index a8ff0e9a98..87a65fb3f1 100644
--- a/osu.Game/Online/Chat/ErrorMessage.cs
+++ b/osu.Game/Online/Chat/ErrorMessage.cs
@@ -8,7 +8,7 @@ namespace osu.Game.Online.Chat
public ErrorMessage(string message)
: base(message)
{
- Sender.Colour = @"ff0000";
+ // todo: this should likely be styled differently in the future.
}
}
}
diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs
index 62d6efcb6f..7bfdc7ff69 100644
--- a/osu.Game/Online/DownloadTrackingComposite.cs
+++ b/osu.Game/Online/DownloadTrackingComposite.cs
@@ -48,22 +48,24 @@ namespace osu.Game.Online
attachDownload(manager.GetExistingDownload(modelInfo.NewValue));
}, true);
- manager.DownloadBegan += download =>
- {
- if (download.Model.Equals(Model.Value))
- attachDownload(download);
- };
-
- manager.DownloadFailed += download =>
- {
- if (download.Model.Equals(Model.Value))
- attachDownload(null);
- };
-
+ manager.DownloadBegan += downloadBegan;
+ manager.DownloadFailed += downloadFailed;
manager.ItemAdded += itemAdded;
manager.ItemRemoved += itemRemoved;
}
+ private void downloadBegan(ArchiveDownloadRequest request)
+ {
+ if (request.Model.Equals(Model.Value))
+ attachDownload(request);
+ }
+
+ private void downloadFailed(ArchiveDownloadRequest request)
+ {
+ if (request.Model.Equals(Model.Value))
+ attachDownload(null);
+ }
+
private ArchiveDownloadRequest attachedRequest;
private void attachDownload(ArchiveDownloadRequest request)
@@ -126,8 +128,10 @@ namespace osu.Game.Online
if (manager != null)
{
- manager.DownloadBegan -= attachDownload;
+ manager.DownloadBegan -= downloadBegan;
+ manager.DownloadFailed -= downloadFailed;
manager.ItemAdded -= itemAdded;
+ manager.ItemRemoved -= itemRemoved;
}
State.UnbindAll();
diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs
index ceaf0c3d5e..b9e2b79b05 100644
--- a/osu.Game/OsuGame.cs
+++ b/osu.Game/OsuGame.cs
@@ -87,7 +87,8 @@ namespace osu.Game
private BackButton backButton;
private MainMenu menuScreen;
- private Intro introScreen;
+
+ private IntroScreen introScreen;
private Bindable configRuleset;
@@ -264,7 +265,16 @@ namespace osu.Game
{
// The given ScoreInfo may have missing properties if it was retrieved from online data. Re-retrieve it from the database
// to ensure all the required data for presenting a replay are present.
- var databasedScoreInfo = ScoreManager.Query(s => s.OnlineScoreID == score.OnlineScoreID);
+ var databasedScoreInfo = score.OnlineScoreID != null
+ ? ScoreManager.Query(s => s.OnlineScoreID == score.OnlineScoreID)
+ : ScoreManager.Query(s => s.Hash == score.Hash);
+
+ if (databasedScoreInfo == null)
+ {
+ Logger.Log("The requested score could not be found locally.", LoggingTarget.Information);
+ return;
+ }
+
var databasedScore = ScoreManager.GetScore(databasedScoreInfo);
if (databasedScore.Replay == null)
@@ -297,7 +307,9 @@ namespace osu.Game
if (nextBeatmap?.Track != null)
nextBeatmap.Track.Completed += currentTrackCompleted;
- beatmap.OldValue?.Dispose();
+ using (var oldBeatmap = beatmap.OldValue)
+ if (oldBeatmap?.Track != null)
+ oldBeatmap.Track.Completed -= currentTrackCompleted;
nextBeatmap?.LoadBeatmapAsync();
}
@@ -761,7 +773,7 @@ namespace osu.Game
if (introScreen == null)
return true;
- if (!introScreen.DidLoadMenu || !(screenStack.CurrentScreen is Intro))
+ if (!introScreen.DidLoadMenu || !(screenStack.CurrentScreen is IntroScreen))
{
Scheduler.Add(introScreen.MakeCurrent);
return true;
@@ -796,7 +808,7 @@ namespace osu.Game
{
switch (newScreen)
{
- case Intro intro:
+ case IntroScreen intro:
introScreen = intro;
break;
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
index a6cc2b0500..4bbcd8d631 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
@@ -132,7 +132,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Scores = null;
- if (beatmap?.OnlineBeatmapID.HasValue != true)
+ if (beatmap?.OnlineBeatmapID.HasValue != true || beatmap.Status <= BeatmapSetOnlineStatus.Pending)
return;
loadingAnimation.Show();
diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs
index 7386bffb1a..d5d9a6c2ce 100644
--- a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs
+++ b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs
@@ -13,6 +13,8 @@ namespace osu.Game.Overlays.Chat.Tabs
public override bool IsSwitchable => false;
+ protected override bool IsBoldWhenActive => false;
+
public ChannelSelectorTabItem()
: base(new ChannelSelectorTabChannel())
{
@@ -22,7 +24,7 @@ namespace osu.Game.Overlays.Chat.Tabs
Icon.Alpha = 0;
Text.Font = Text.Font.With(size: 45);
- TextBold.Font = Text.Font.With(size: 45);
+ Text.Truncate = false;
}
[BackgroundDependencyLoader]
diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs
index 2a3dd55c71..266e68f17e 100644
--- a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs
+++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs
@@ -29,7 +29,6 @@ namespace osu.Game.Overlays.Chat.Tabs
public override bool IsRemovable => !Pinned;
protected readonly SpriteText Text;
- protected readonly SpriteText TextBold;
protected readonly ClickableContainer CloseButton;
private readonly Box box;
private readonly Box highlightBox;
@@ -88,20 +87,17 @@ namespace osu.Game.Overlays.Chat.Tabs
},
Text = new OsuSpriteText
{
- Margin = new MarginPadding(5),
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Text = value.ToString(),
- Font = OsuFont.GetFont(size: 18)
- },
- TextBold = new OsuSpriteText
- {
- Alpha = 0,
- Margin = new MarginPadding(5),
- Origin = Anchor.CentreLeft,
- Anchor = Anchor.CentreLeft,
- Text = value.ToString(),
- Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold)
+ Font = OsuFont.GetFont(size: 18),
+ Padding = new MarginPadding(5)
+ {
+ Left = LeftTextPadding,
+ Right = RightTextPadding,
+ },
+ RelativeSizeAxes = Axes.X,
+ Truncate = true,
},
CloseButton = new TabCloseButton
{
@@ -119,10 +115,16 @@ namespace osu.Game.Overlays.Chat.Tabs
};
}
+ protected virtual float LeftTextPadding => 5;
+
+ protected virtual float RightTextPadding => IsRemovable ? 40 : 5;
+
protected virtual IconUsage DisplayIcon => FontAwesome.Solid.Hashtag;
protected virtual bool ShowCloseOnHover => true;
+ protected virtual bool IsBoldWhenActive => true;
+
protected override bool OnHover(HoverEvent e)
{
if (IsRemovable && ShowCloseOnHover)
@@ -203,8 +205,7 @@ namespace osu.Game.Overlays.Chat.Tabs
box.FadeColour(BackgroundActive, TRANSITION_LENGTH, Easing.OutQuint);
highlightBox.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
- Text.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
- TextBold.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
+ if (IsBoldWhenActive) Text.Font = Text.Font.With(weight: FontWeight.Bold);
}
protected virtual void FadeInactive()
@@ -216,8 +217,7 @@ namespace osu.Game.Overlays.Chat.Tabs
box.FadeColour(BackgroundInactive, TRANSITION_LENGTH, Easing.OutQuint);
highlightBox.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
- Text.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
- TextBold.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
+ Text.Font = Text.Font.With(weight: FontWeight.Medium);
}
protected override void OnActivated() => updateState();
diff --git a/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs
index 9e87bae864..1413b8fe78 100644
--- a/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs
+++ b/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs
@@ -62,11 +62,10 @@ namespace osu.Game.Overlays.Chat.Tabs
});
avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);
-
- Text.X = ChatOverlay.TAB_AREA_HEIGHT;
- TextBold.X = ChatOverlay.TAB_AREA_HEIGHT;
}
+ protected override float LeftTextPadding => base.LeftTextPadding + ChatOverlay.TAB_AREA_HEIGHT;
+
protected override bool ShowCloseOnHover => false;
protected override void FadeActive()
diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs
index e223856b27..53a05656b1 100644
--- a/osu.Game/Overlays/ChatOverlay.cs
+++ b/osu.Game/Overlays/ChatOverlay.cs
@@ -256,6 +256,9 @@ namespace osu.Game.Overlays
loadedChannels.Add(loaded);
LoadComponentAsync(loaded, l =>
{
+ if (currentChannel.Value != e.NewValue)
+ return;
+
loading.Hide();
currentChannelContainer.Clear(false);
@@ -381,7 +384,18 @@ namespace osu.Game.Overlays
foreach (Channel channel in channels)
{
ChannelTabControl.RemoveChannel(channel);
- loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel));
+
+ var loaded = loadedChannels.Find(c => c.Channel == channel);
+
+ if (loaded != null)
+ {
+ loadedChannels.Remove(loaded);
+
+ // Because the container is only cleared in the async load callback of a new channel, it is forcefully cleared
+ // to ensure that the previous channel doesn't get updated after it's disposed
+ currentChannelContainer.Remove(loaded);
+ loaded.Dispose();
+ }
}
}
diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs
index 4b43542b43..8b04bf0387 100644
--- a/osu.Game/Overlays/Direct/FilterControl.cs
+++ b/osu.Game/Overlays/Direct/FilterControl.cs
@@ -18,6 +18,7 @@ namespace osu.Game.Overlays.Direct
protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552");
protected override DirectSortCriteria DefaultTab => DirectSortCriteria.Ranked;
+ protected override BeatmapSearchCategory DefaultCategory => BeatmapSearchCategory.Leaderboard;
protected override Drawable CreateSupplementaryControls() => rulesetSelector = new DirectRulesetSelector();
diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs
index fa1ee500a8..7b8745cf42 100644
--- a/osu.Game/Overlays/Mods/ModButton.cs
+++ b/osu.Game/Overlays/Mods/ModButton.cs
@@ -96,7 +96,7 @@ namespace osu.Game.Overlays.Mods
}
}
- foregroundIcon.Highlighted = Selected;
+ foregroundIcon.Highlighted.Value = Selected;
SelectionChanged?.Invoke(SelectedMod);
return true;
diff --git a/osu.Game/Overlays/Profile/Header/Components/AddFriendButton.cs b/osu.Game/Overlays/Profile/Header/Components/AddFriendButton.cs
index 2e4fd6fe3d..6e1b6e2c7d 100644
--- a/osu.Game/Overlays/Profile/Header/Components/AddFriendButton.cs
+++ b/osu.Game/Overlays/Profile/Header/Components/AddFriendButton.cs
@@ -53,6 +53,6 @@ namespace osu.Game.Overlays.Profile.Header.Components
User.BindValueChanged(user => updateFollowers(user.NewValue), true);
}
- private void updateFollowers(User user) => followerText.Text = user?.FollowerCount?.Length > 0 ? user.FollowerCount[0].ToString("#,##0") : "0";
+ private void updateFollowers(User user) => followerText.Text = user?.FollowerCount.ToString("#,##0");
}
}
diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs
index b6112a6501..2c9a3dd5f9 100644
--- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs
+++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs
@@ -2,11 +2,13 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
+using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Rulesets;
+using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
@@ -16,6 +18,8 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
private Color4 accentColour = Color4.White;
+ public readonly Bindable User = new Bindable();
+
public ProfileRulesetSelector()
{
TabContainer.Masking = false;
@@ -32,24 +36,17 @@ namespace osu.Game.Overlays.Profile.Header.Components
((ProfileRulesetTabItem)tabItem).AccentColour = accentColour;
}
- public void SetDefaultRuleset(RulesetInfo ruleset)
+ protected override void LoadComplete()
{
- // Todo: This method shouldn't exist, but bindables don't provide the concept of observing a change to the default value
- foreach (TabItem tabItem in TabContainer)
- ((ProfileRulesetTabItem)tabItem).IsDefault = ((ProfileRulesetTabItem)tabItem).Value.ID == ruleset.ID;
+ base.LoadComplete();
+
+ User.BindValueChanged(u => SetDefaultRuleset(Rulesets.GetRuleset(u.NewValue?.PlayMode ?? "osu")), true);
}
- public void SelectDefaultRuleset()
+ public void SetDefaultRuleset(RulesetInfo ruleset)
{
- // Todo: This method shouldn't exist, but bindables don't provide the concept of observing a change to the default value
foreach (TabItem tabItem in TabContainer)
- {
- if (((ProfileRulesetTabItem)tabItem).IsDefault)
- {
- Current.Value = ((ProfileRulesetTabItem)tabItem).Value;
- return;
- }
- }
+ ((ProfileRulesetTabItem)tabItem).IsDefault = ((ProfileRulesetTabItem)tabItem).Value.ID == ruleset.ID;
}
protected override TabItem CreateTabItem(RulesetInfo value) => new ProfileRulesetTabItem(value)
diff --git a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs
index 5f79386b76..9cb9d48de7 100644
--- a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs
+++ b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs
@@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
private KeyValuePair[] ranks;
private int dayIndex;
- public Bindable User = new Bindable();
+ public readonly Bindable Statistics = new Bindable();
public RankGraph()
{
@@ -56,8 +56,6 @@ namespace osu.Game.Overlays.Profile.Header.Components
};
graph.OnBallMove += i => dayIndex = i;
-
- User.ValueChanged += userChanged;
}
[BackgroundDependencyLoader]
@@ -66,18 +64,25 @@ namespace osu.Game.Overlays.Profile.Header.Components
graph.LineColour = colours.Yellow;
}
- private void userChanged(ValueChangedEvent e)
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ Statistics.BindValueChanged(statistics => updateStatistics(statistics.NewValue), true);
+ }
+
+ private void updateStatistics(UserStatistics statistics)
{
placeholder.FadeIn(fade_duration, Easing.Out);
- if (e.NewValue?.Statistics?.Ranks.Global == null)
+ if (statistics?.Ranks.Global == null)
{
graph.FadeOut(fade_duration, Easing.Out);
ranks = null;
return;
}
- int[] userRanks = e.NewValue.RankHistory?.Data ?? new[] { e.NewValue.Statistics.Ranks.Global.Value };
+ int[] userRanks = statistics.RankHistory?.Data ?? new[] { statistics.Ranks.Global.Value };
ranks = userRanks.Select((x, index) => new KeyValuePair(index, x)).Where(x => x.Value != 0).ToArray();
if (ranks.Length > 1)
@@ -191,7 +196,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
}
}
- public string TooltipText => User.Value?.Statistics?.Ranks.Global == null ? "" : $"#{ranks[dayIndex].Value:#,##0}|{ranked_days - ranks[dayIndex].Key + 1}";
+ public string TooltipText => Statistics.Value?.Ranks.Global == null ? "" : $"#{ranks[dayIndex].Value:#,##0}|{ranked_days - ranks[dayIndex].Key + 1}";
public ITooltip GetCustomTooltip() => new RankGraphTooltip();
diff --git a/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs b/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs
index c5e61f68f4..fa60a37ddb 100644
--- a/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs
+++ b/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs
@@ -80,7 +80,6 @@ namespace osu.Game.Overlays.Profile.Header.Components
private void load(OsuColour colours)
{
background.Colour = colours.Pink;
- iconContainer.Colour = colours.GreySeafoam;
}
}
}
diff --git a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs
index 0db1cb32d7..6ee0d9ee8f 100644
--- a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs
+++ b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs
@@ -179,7 +179,7 @@ namespace osu.Game.Overlays.Profile.Header
detailGlobalRank.Content = user?.Statistics?.Ranks.Global?.ToString("\\##,##0") ?? "-";
detailCountryRank.Content = user?.Statistics?.Ranks.Country?.ToString("\\##,##0") ?? "-";
- rankGraph.User.Value = user;
+ rankGraph.Statistics.Value = user?.Statistics;
}
private class ScoreRankInfo : CompositeDrawable
diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs
index ae91837d29..37f017277f 100644
--- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs
+++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs
@@ -18,6 +18,7 @@ namespace osu.Game.Overlays.Profile.Sections
{
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, "Ranked & Approved Beatmaps"),
+ new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, "Loved Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, "Pending Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps"),
};
diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
index b0a8a0e77d..a0c4e9a080 100644
--- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
+++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs
@@ -26,6 +26,7 @@ namespace osu.Game.Overlays.SearchableList
protected abstract Color4 BackgroundColour { get; }
protected abstract T DefaultTab { get; }
+ protected abstract U DefaultCategory { get; }
protected virtual Drawable CreateSupplementaryControls() => null;
///
@@ -109,6 +110,9 @@ namespace osu.Game.Overlays.SearchableList
Tabs.Current.Value = DefaultTab;
Tabs.Current.TriggerChange();
+
+ DisplayStyleControl.Dropdown.Current.Value = DefaultCategory;
+ DisplayStyleControl.Dropdown.Current.TriggerChange();
}
[BackgroundDependencyLoader]
diff --git a/osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs
index f063898a9f..7eec971b62 100644
--- a/osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs
@@ -27,11 +27,6 @@ namespace osu.Game.Overlays.Settings.Sections.Debug
Bindable = frameworkConfig.GetBindable(FrameworkSetting.PerformanceLogging)
},
new SettingsCheckbox
- {
- LabelText = "Bypass caching (slow)",
- Bindable = config.GetBindable(DebugSetting.BypassCaching)
- },
- new SettingsCheckbox
{
LabelText = "Bypass front-to-back render pass",
Bindable = config.GetBindable(DebugSetting.BypassFrontToBackPass)
diff --git a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs b/osu.Game/Overlays/Settings/Sections/Debug/MemorySettings.cs
similarity index 63%
rename from osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs
rename to osu.Game/Overlays/Settings/Sections/Debug/MemorySettings.cs
index 6897b42f4f..db64c9a8ac 100644
--- a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/Debug/MemorySettings.cs
@@ -1,26 +1,26 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
+using osu.Framework.Platform;
namespace osu.Game.Overlays.Settings.Sections.Debug
{
- public class GCSettings : SettingsSubsection
+ public class MemorySettings : SettingsSubsection
{
- protected override string Header => "Garbage Collector";
+ protected override string Header => "Memory";
[BackgroundDependencyLoader]
- private void load(FrameworkDebugConfigManager config)
+ private void load(FrameworkDebugConfigManager config, GameHost host)
{
Children = new Drawable[]
{
new SettingsButton
{
- Text = "Force garbage collection",
- Action = GC.Collect
+ Text = "Clear all caches",
+ Action = host.Collect
},
};
}
diff --git a/osu.Game/Overlays/Settings/Sections/DebugSection.cs b/osu.Game/Overlays/Settings/Sections/DebugSection.cs
index 0149cab802..f62de0b243 100644
--- a/osu.Game/Overlays/Settings/Sections/DebugSection.cs
+++ b/osu.Game/Overlays/Settings/Sections/DebugSection.cs
@@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Settings.Sections
Children = new Drawable[]
{
new GeneralSettings(),
- new GCSettings(),
+ new MemorySettings(),
};
}
}
diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs
index 5d7542ca2b..35be930a2e 100644
--- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs
+++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs
@@ -107,6 +107,8 @@ namespace osu.Game.Overlays.Settings.Sections
private class SkinDropdownControl : DropdownControl
{
protected override string GenerateItemText(SkinInfo item) => item.ToString();
+
+ protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = 200);
}
}
}
diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs
index a80b7c1108..358f94b659 100644
--- a/osu.Game/Overlays/Settings/Sidebar.cs
+++ b/osu.Game/Overlays/Settings/Sidebar.cs
@@ -84,6 +84,7 @@ namespace osu.Game.Overlays.Settings
Content.Anchor = Anchor.CentreLeft;
Content.Origin = Anchor.CentreLeft;
RelativeSizeAxes = Axes.Both;
+ ScrollbarVisible = false;
}
}
diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs
index 474f529bb1..9dd0def453 100644
--- a/osu.Game/Overlays/SettingsPanel.cs
+++ b/osu.Game/Overlays/SettingsPanel.cs
@@ -186,7 +186,7 @@ namespace osu.Game.Overlays
base.UpdateAfterChildren();
ContentContainer.Margin = new MarginPadding { Left = Sidebar?.DrawWidth ?? 0 };
- ContentContainer.Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
+ Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
}
protected class SettingsSectionsContainer : SectionsContainer
diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs
index 6abf6ec98d..1c2cb95dfe 100644
--- a/osu.Game/Overlays/Social/FilterControl.cs
+++ b/osu.Game/Overlays/Social/FilterControl.cs
@@ -12,6 +12,7 @@ namespace osu.Game.Overlays.Social
{
protected override Color4 BackgroundColour => OsuColour.FromHex(@"47253a");
protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Rank;
+ protected override SortDirection DefaultCategory => SortDirection.Ascending;
public FilterControl()
{
diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs
index 2150726a42..61c2644c6f 100644
--- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs
+++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs
@@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Judgements
Font = OsuFont.Numeric.With(size: 12),
Colour = judgementColour(Result.Type),
Scale = new Vector2(0.85f, 1),
- }, restrictSize: false)
+ })
};
}
diff --git a/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs b/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs
index a634976b3c..cff669bf53 100644
--- a/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs
+++ b/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs
@@ -2,21 +2,18 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
-using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mods
{
///
- /// Interface for a that applies changes to a
- /// after conversion and post-processing has completed.
+ /// Interface for a that applies changes to a after conversion and post-processing has completed.
///
- public interface IApplicableToBeatmap : IApplicableMod
- where TObject : HitObject
+ public interface IApplicableToBeatmap : IApplicableMod
{
///
- /// Applies this to a .
+ /// Applies this to an .
///
- /// The to apply to.
- void ApplyToBeatmap(Beatmap beatmap);
+ /// The to apply to.
+ void ApplyToBeatmap(IBeatmap beatmap);
}
}
diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs
index cb0c2fafe5..4f939362bb 100644
--- a/osu.Game/Rulesets/Mods/ModFlashlight.cs
+++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs
@@ -193,6 +193,12 @@ namespace osu.Game.Rulesets.Mods
shader.Unbind();
}
+
+ protected override void Dispose(bool isDisposing)
+ {
+ base.Dispose(isDisposing);
+ quadBatch?.Dispose();
+ }
}
}
}
diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs
index a5f96087c0..9edf57ad00 100644
--- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs
+++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs
@@ -13,27 +13,21 @@ using osuTK;
namespace osu.Game.Rulesets.Mods
{
- public abstract class ModTimeRamp : Mod
+ public abstract class ModTimeRamp : Mod, IUpdatableByPlayfield, IApplicableToClock, IApplicableToBeatmap
{
- public override Type[] IncompatibleMods => new[] { typeof(ModTimeAdjust) };
-
- protected abstract double FinalRateAdjustment { get; }
- }
-
- public abstract class ModTimeRamp : ModTimeRamp, IUpdatableByPlayfield, IApplicableToClock, IApplicableToBeatmap
- where T : HitObject
- {
- private double finalRateTime;
-
- private double beginRampTime;
-
- private IAdjustableClock clock;
-
///
/// The point in the beatmap at which the final ramping rate should be reached.
///
private const double final_rate_progress = 0.75f;
+ public override Type[] IncompatibleMods => new[] { typeof(ModTimeAdjust) };
+
+ protected abstract double FinalRateAdjustment { get; }
+
+ private double finalRateTime;
+ private double beginRampTime;
+ private IAdjustableClock clock;
+
public virtual void ApplyToClock(IAdjustableClock clock)
{
this.clock = clock;
@@ -44,7 +38,7 @@ namespace osu.Game.Rulesets.Mods
applyAdjustment(1);
}
- public virtual void ApplyToBeatmap(Beatmap beatmap)
+ public virtual void ApplyToBeatmap(IBeatmap beatmap)
{
HitObject lastObject = beatmap.HitObjects.LastOrDefault();
diff --git a/osu.Game/Rulesets/Mods/ModWindDown.cs b/osu.Game/Rulesets/Mods/ModWindDown.cs
index 5d71c8950b..b2e3abb59d 100644
--- a/osu.Game/Rulesets/Mods/ModWindDown.cs
+++ b/osu.Game/Rulesets/Mods/ModWindDown.cs
@@ -4,12 +4,10 @@
using System;
using System.Linq;
using osu.Framework.Graphics.Sprites;
-using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mods
{
- public class ModWindDown : ModTimeRamp
- where T : HitObject
+ public class ModWindDown : ModTimeRamp
{
public override string Name => "Wind Down";
public override string Acronym => "WD";
@@ -19,6 +17,6 @@ namespace osu.Game.Rulesets.Mods
protected override double FinalRateAdjustment => -0.25;
- public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp)).ToArray();
+ public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp)).ToArray();
}
}
diff --git a/osu.Game/Rulesets/Mods/ModWindUp.cs b/osu.Game/Rulesets/Mods/ModWindUp.cs
index aae85cec19..8df35a1de2 100644
--- a/osu.Game/Rulesets/Mods/ModWindUp.cs
+++ b/osu.Game/Rulesets/Mods/ModWindUp.cs
@@ -4,12 +4,10 @@
using System;
using System.Linq;
using osu.Framework.Graphics.Sprites;
-using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mods
{
- public class ModWindUp : ModTimeRamp
- where T : HitObject
+ public class ModWindUp : ModTimeRamp
{
public override string Name => "Wind Up";
public override string Acronym => "WU";
@@ -19,6 +17,6 @@ namespace osu.Game.Rulesets.Mods
protected override double FinalRateAdjustment => 0.5;
- public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindDown)).ToArray();
+ public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindDown)).ToArray();
}
}
diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
index 181ae37a8b..b72a55b9ed 100644
--- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
+++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
@@ -17,6 +17,7 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Objects.Drawables
{
+ [Cached(typeof(DrawableHitObject))]
public abstract class DrawableHitObject : SkinReloadableDrawable
{
public readonly HitObject HitObject;
diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs
index d70c1bf7d3..e990938291 100644
--- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs
@@ -10,7 +10,6 @@ using osu.Game.Beatmaps.Formats;
using osu.Game.Audio;
using System.Linq;
using JetBrains.Annotations;
-using osu.Framework.Logging;
using osu.Framework.MathUtils;
namespace osu.Game.Rulesets.Objects.Legacy
@@ -41,208 +40,192 @@ namespace osu.Game.Rulesets.Objects.Legacy
[CanBeNull]
public override HitObject Parse(string text)
{
- try
+ string[] split = text.Split(',');
+
+ Vector2 pos = new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));
+
+ double startTime = Parsing.ParseDouble(split[2]) + Offset;
+
+ ConvertHitObjectType type = (ConvertHitObjectType)Parsing.ParseInt(split[3]);
+
+ int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4;
+ type &= ~ConvertHitObjectType.ComboOffset;
+
+ bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
+ type &= ~ConvertHitObjectType.NewCombo;
+
+ var soundType = (LegacySoundType)Parsing.ParseInt(split[4]);
+ var bankInfo = new SampleBankInfo();
+
+ HitObject result = null;
+
+ if (type.HasFlag(ConvertHitObjectType.Circle))
{
- string[] split = text.Split(',');
+ result = CreateHit(pos, combo, comboOffset);
- Vector2 pos = new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));
+ if (split.Length > 5)
+ readCustomSampleBanks(split[5], bankInfo);
+ }
+ else if (type.HasFlag(ConvertHitObjectType.Slider))
+ {
+ PathType pathType = PathType.Catmull;
+ double? length = null;
- double startTime = Parsing.ParseDouble(split[2]) + Offset;
+ string[] pointSplit = split[5].Split('|');
- ConvertHitObjectType type = (ConvertHitObjectType)Parsing.ParseInt(split[3]);
+ int pointCount = 1;
+ foreach (var t in pointSplit)
+ if (t.Length > 1)
+ pointCount++;
- int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4;
- type &= ~ConvertHitObjectType.ComboOffset;
+ var points = new Vector2[pointCount];
- bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
- type &= ~ConvertHitObjectType.NewCombo;
+ int pointIndex = 1;
- var soundType = (LegacySoundType)Parsing.ParseInt(split[4]);
- var bankInfo = new SampleBankInfo();
-
- HitObject result = null;
-
- if (type.HasFlag(ConvertHitObjectType.Circle))
+ foreach (string t in pointSplit)
{
- result = CreateHit(pos, combo, comboOffset);
-
- if (split.Length > 5)
- readCustomSampleBanks(split[5], bankInfo);
- }
- else if (type.HasFlag(ConvertHitObjectType.Slider))
- {
- PathType pathType = PathType.Catmull;
- double? length = null;
-
- string[] pointSplit = split[5].Split('|');
-
- int pointCount = 1;
- foreach (var t in pointSplit)
- if (t.Length > 1)
- pointCount++;
-
- var points = new Vector2[pointCount];
-
- int pointIndex = 1;
-
- foreach (string t in pointSplit)
+ if (t.Length == 1)
{
- if (t.Length == 1)
+ switch (t)
{
- switch (t)
- {
- case @"C":
- pathType = PathType.Catmull;
- break;
-
- case @"B":
- pathType = PathType.Bezier;
- break;
-
- case @"L":
- pathType = PathType.Linear;
- break;
-
- case @"P":
- pathType = PathType.PerfectCurve;
- break;
- }
-
- continue;
- }
-
- string[] temp = t.Split(':');
- points[pointIndex++] = new Vector2((int)Parsing.ParseDouble(temp[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseDouble(temp[1], Parsing.MAX_COORDINATE_VALUE)) - pos;
- }
-
- // osu-stable special-cased colinear perfect curves to a CurveType.Linear
- bool isLinear(Vector2[] p) => Precision.AlmostEquals(0, (p[1].Y - p[0].Y) * (p[2].X - p[0].X) - (p[1].X - p[0].X) * (p[2].Y - p[0].Y));
-
- if (points.Length == 3 && pathType == PathType.PerfectCurve && isLinear(points))
- pathType = PathType.Linear;
-
- int repeatCount = Parsing.ParseInt(split[6]);
-
- if (repeatCount > 9000)
- throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high");
-
- // osu-stable treated the first span of the slider as a repeat, but no repeats are happening
- repeatCount = Math.Max(0, repeatCount - 1);
-
- if (split.Length > 7)
- {
- length = Math.Max(0, Parsing.ParseDouble(split[7]));
- if (length == 0)
- length = null;
- }
-
- if (split.Length > 10)
- readCustomSampleBanks(split[10], bankInfo);
-
- // One node for each repeat + the start and end nodes
- int nodes = repeatCount + 2;
-
- // Populate node sample bank infos with the default hit object sample bank
- var nodeBankInfos = new List();
- for (int i = 0; i < nodes; i++)
- nodeBankInfos.Add(bankInfo.Clone());
-
- // Read any per-node sample banks
- if (split.Length > 9 && split[9].Length > 0)
- {
- string[] sets = split[9].Split('|');
-
- for (int i = 0; i < nodes; i++)
- {
- if (i >= sets.Length)
+ case @"C":
+ pathType = PathType.Catmull;
break;
- SampleBankInfo info = nodeBankInfos[i];
- readCustomSampleBanks(sets[i], info);
- }
- }
-
- // Populate node sound types with the default hit object sound type
- var nodeSoundTypes = new List();
- for (int i = 0; i < nodes; i++)
- nodeSoundTypes.Add(soundType);
-
- // Read any per-node sound types
- if (split.Length > 8 && split[8].Length > 0)
- {
- string[] adds = split[8].Split('|');
-
- for (int i = 0; i < nodes; i++)
- {
- if (i >= adds.Length)
+ case @"B":
+ pathType = PathType.Bezier;
break;
- int sound;
- int.TryParse(adds[i], out sound);
- nodeSoundTypes[i] = (LegacySoundType)sound;
+ case @"L":
+ pathType = PathType.Linear;
+ break;
+
+ case @"P":
+ pathType = PathType.PerfectCurve;
+ break;
}
+
+ continue;
}
- // Generate the final per-node samples
- var nodeSamples = new List>(nodes);
+ string[] temp = t.Split(':');
+ points[pointIndex++] = new Vector2((int)Parsing.ParseDouble(temp[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseDouble(temp[1], Parsing.MAX_COORDINATE_VALUE)) - pos;
+ }
+
+ // osu-stable special-cased colinear perfect curves to a CurveType.Linear
+ bool isLinear(Vector2[] p) => Precision.AlmostEquals(0, (p[1].Y - p[0].Y) * (p[2].X - p[0].X) - (p[1].X - p[0].X) * (p[2].Y - p[0].Y));
+
+ if (points.Length == 3 && pathType == PathType.PerfectCurve && isLinear(points))
+ pathType = PathType.Linear;
+
+ int repeatCount = Parsing.ParseInt(split[6]);
+
+ if (repeatCount > 9000)
+ throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high");
+
+ // osu-stable treated the first span of the slider as a repeat, but no repeats are happening
+ repeatCount = Math.Max(0, repeatCount - 1);
+
+ if (split.Length > 7)
+ {
+ length = Math.Max(0, Parsing.ParseDouble(split[7]));
+ if (length == 0)
+ length = null;
+ }
+
+ if (split.Length > 10)
+ readCustomSampleBanks(split[10], bankInfo);
+
+ // One node for each repeat + the start and end nodes
+ int nodes = repeatCount + 2;
+
+ // Populate node sample bank infos with the default hit object sample bank
+ var nodeBankInfos = new List();
+ for (int i = 0; i < nodes; i++)
+ nodeBankInfos.Add(bankInfo.Clone());
+
+ // Read any per-node sample banks
+ if (split.Length > 9 && split[9].Length > 0)
+ {
+ string[] sets = split[9].Split('|');
+
for (int i = 0; i < nodes; i++)
- nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
-
- result = CreateSlider(pos, combo, comboOffset, points, length, pathType, repeatCount, nodeSamples);
-
- // The samples are played when the slider ends, which is the last node
- result.Samples = nodeSamples[nodeSamples.Count - 1];
- }
- else if (type.HasFlag(ConvertHitObjectType.Spinner))
- {
- double endTime = Math.Max(startTime, Parsing.ParseDouble(split[5]) + Offset);
-
- result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, endTime);
-
- if (split.Length > 6)
- readCustomSampleBanks(split[6], bankInfo);
- }
- else if (type.HasFlag(ConvertHitObjectType.Hold))
- {
- // Note: Hold is generated by BMS converts
-
- double endTime = Math.Max(startTime, Parsing.ParseDouble(split[2]));
-
- if (split.Length > 5 && !string.IsNullOrEmpty(split[5]))
{
- string[] ss = split[5].Split(':');
- endTime = Math.Max(startTime, Parsing.ParseDouble(ss[0]));
- readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
+ if (i >= sets.Length)
+ break;
+
+ SampleBankInfo info = nodeBankInfos[i];
+ readCustomSampleBanks(sets[i], info);
}
-
- result = CreateHold(pos, combo, comboOffset, endTime + Offset);
}
- if (result == null)
+ // Populate node sound types with the default hit object sound type
+ var nodeSoundTypes = new List();
+ for (int i = 0; i < nodes; i++)
+ nodeSoundTypes.Add(soundType);
+
+ // Read any per-node sound types
+ if (split.Length > 8 && split[8].Length > 0)
{
- Logger.Log($"Unknown hit object type: {type}. Skipped.", level: LogLevel.Error);
- return null;
+ string[] adds = split[8].Split('|');
+
+ for (int i = 0; i < nodes; i++)
+ {
+ if (i >= adds.Length)
+ break;
+
+ int sound;
+ int.TryParse(adds[i], out sound);
+ nodeSoundTypes[i] = (LegacySoundType)sound;
+ }
}
- result.StartTime = startTime;
+ // Generate the final per-node samples
+ var nodeSamples = new List>(nodes);
+ for (int i = 0; i < nodes; i++)
+ nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
- if (result.Samples.Count == 0)
- result.Samples = convertSoundType(soundType, bankInfo);
+ result = CreateSlider(pos, combo, comboOffset, points, length, pathType, repeatCount, nodeSamples);
- FirstObject = false;
-
- return result;
+ // The samples are played when the slider ends, which is the last node
+ result.Samples = nodeSamples[nodeSamples.Count - 1];
}
- catch (FormatException)
+ else if (type.HasFlag(ConvertHitObjectType.Spinner))
{
- Logger.Log("A hitobject could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
+ double endTime = Math.Max(startTime, Parsing.ParseDouble(split[5]) + Offset);
+
+ result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, endTime);
+
+ if (split.Length > 6)
+ readCustomSampleBanks(split[6], bankInfo);
}
- catch (OverflowException)
+ else if (type.HasFlag(ConvertHitObjectType.Hold))
{
- Logger.Log("A hitobject could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
+ // Note: Hold is generated by BMS converts
+
+ double endTime = Math.Max(startTime, Parsing.ParseDouble(split[2]));
+
+ if (split.Length > 5 && !string.IsNullOrEmpty(split[5]))
+ {
+ string[] ss = split[5].Split(':');
+ endTime = Math.Max(startTime, Parsing.ParseDouble(ss[0]));
+ readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
+ }
+
+ result = CreateHold(pos, combo, comboOffset, endTime + Offset);
}
- return null;
+ if (result == null)
+ throw new InvalidDataException($"Unknown hit object type: {split[3]}");
+
+ result.StartTime = startTime;
+
+ if (result.Samples.Count == 0)
+ result.Samples = convertSoundType(soundType, bankInfo);
+
+ FirstObject = false;
+
+ return result;
}
private void readCustomSampleBanks(string str, SampleBankInfo bankInfo)
diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs
index c9f7224643..eab37b682c 100644
--- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs
+++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs
@@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
[Flags]
internal enum ConvertHitObjectType
{
- Circle = 1 << 0,
+ Circle = 1,
Slider = 1 << 1,
NewCombo = 1 << 2,
Spinner = 1 << 3,
diff --git a/osu.Game/Rulesets/Objects/SliderEventGenerator.cs b/osu.Game/Rulesets/Objects/SliderEventGenerator.cs
index 7cda7485f9..0d8796b4cb 100644
--- a/osu.Game/Rulesets/Objects/SliderEventGenerator.cs
+++ b/osu.Game/Rulesets/Objects/SliderEventGenerator.cs
@@ -3,13 +3,15 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using osuTK;
namespace osu.Game.Rulesets.Objects
{
public static class SliderEventGenerator
{
- public static IEnumerable Generate(double startTime, double spanDuration, double velocity, double tickDistance, double totalDistance, int spanCount, double? legacyLastTickOffset)
+ public static IEnumerable Generate(double startTime, double spanDuration, double velocity, double tickDistance, double totalDistance, int spanCount,
+ double? legacyLastTickOffset)
{
// A very lenient maximum length of a slider for ticks to be generated.
// This exists for edge cases such as /b/1573664 where the beatmap has been edited by the user, and should never be reached in normal usage.
@@ -36,24 +38,17 @@ namespace osu.Game.Rulesets.Objects
var spanStartTime = startTime + span * spanDuration;
var reversed = span % 2 == 1;
- for (var d = tickDistance; d <= length; d += tickDistance)
+ var ticks = generateTicks(span, spanStartTime, spanDuration, reversed, length, tickDistance, minDistanceFromEnd);
+
+ if (reversed)
{
- if (d >= length - minDistanceFromEnd)
- break;
-
- var pathProgress = d / length;
- var timeProgress = reversed ? 1 - pathProgress : pathProgress;
-
- yield return new SliderEventDescriptor
- {
- Type = SliderEventType.Tick,
- SpanIndex = span,
- SpanStartTime = spanStartTime,
- Time = spanStartTime + timeProgress * spanDuration,
- PathProgress = pathProgress,
- };
+ // For repeat spans, ticks are returned in reverse-StartTime order, which is undesirable for some rulesets
+ ticks = ticks.Reverse();
}
+ foreach (var e in ticks)
+ yield return e;
+
if (span < spanCount - 1)
{
yield return new SliderEventDescriptor
@@ -103,6 +98,40 @@ namespace osu.Game.Rulesets.Objects
PathProgress = spanCount % 2,
};
}
+
+ ///
+ /// Generates the ticks for a span of the slider.
+ ///
+ /// The span index.
+ /// The start time of the span.
+ /// The duration of the span.
+ /// Whether the span is reversed.
+ /// The length of the path.
+ /// The distance between each tick.
+ /// The distance from the end of the path at which ticks are not allowed to be added.
+ /// A for each tick. If is true, the ticks will be returned in reverse-StartTime order.
+ private static IEnumerable generateTicks(int spanIndex, double spanStartTime, double spanDuration, bool reversed, double length, double tickDistance,
+ double minDistanceFromEnd)
+ {
+ for (var d = tickDistance; d <= length; d += tickDistance)
+ {
+ if (d >= length - minDistanceFromEnd)
+ break;
+
+ // Always generate ticks from the start of the path rather than the span to ensure that ticks in repeat spans are positioned identically to those in non-repeat spans
+ var pathProgress = d / length;
+ var timeProgress = reversed ? 1 - pathProgress : pathProgress;
+
+ yield return new SliderEventDescriptor
+ {
+ Type = SliderEventType.Tick,
+ SpanIndex = spanIndex,
+ SpanStartTime = spanStartTime,
+ Time = spanStartTime + timeProgress * spanDuration,
+ PathProgress = pathProgress,
+ };
+ }
+ }
}
///
diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs
index 47ce28db4c..ba2375bec1 100644
--- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs
+++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs
@@ -217,9 +217,7 @@ namespace osu.Game.Rulesets.Scoring
private double baseScore;
private double bonusScore;
- protected ScoreProcessor()
- {
- }
+ private double scoreMultiplier = 1;
public ScoreProcessor(DrawableRuleset drawableRuleset)
{
@@ -239,6 +237,15 @@ namespace osu.Game.Rulesets.Scoring
}
Mode.ValueChanged += _ => updateScore();
+ Mods.ValueChanged += mods =>
+ {
+ scoreMultiplier = 1;
+
+ foreach (var m in mods.NewValue)
+ scoreMultiplier *= m.ScoreMultiplier;
+
+ updateScore();
+ };
}
///
@@ -306,6 +313,9 @@ namespace osu.Game.Rulesets.Scoring
///
/// Applies the score change of a to this .
///
+ ///
+ /// Any changes applied via this method can be reverted via .
+ ///
/// The to apply.
protected virtual void ApplyResult(JudgementResult result)
{
@@ -350,7 +360,7 @@ namespace osu.Game.Rulesets.Scoring
}
///
- /// Reverts the score change of a that was applied to this .
+ /// Reverts the score change of a that was applied to this via .
///
/// The judgement scoring result.
protected virtual void RevertResult(JudgementResult result)
@@ -388,7 +398,7 @@ namespace osu.Game.Rulesets.Scoring
if (rollingMaxBaseScore != 0)
Accuracy.Value = baseScore / rollingMaxBaseScore;
- TotalScore.Value = getScore(Mode.Value);
+ TotalScore.Value = getScore(Mode.Value) * scoreMultiplier;
}
private double getScore(ScoringMode mode)
diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs
index 52fba9cab3..ac81fdc719 100644
--- a/osu.Game/Rulesets/UI/DrawableRuleset.cs
+++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs
@@ -109,8 +109,6 @@ namespace osu.Game.Rulesets.UI
Beatmap = (Beatmap)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
- applyBeatmapMods(mods);
-
KeyBindingInputManager = CreateInputManager();
playfield = new Lazy(CreatePlayfield);
@@ -269,19 +267,6 @@ namespace osu.Game.Rulesets.UI
public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor(this);
- ///
- /// Applies the active mods to the Beatmap.
- ///
- ///
- private void applyBeatmapMods(IReadOnlyList mods)
- {
- if (mods == null)
- return;
-
- foreach (var mod in mods.OfType>())
- mod.ApplyToBeatmap(Beatmap);
- }
-
///
/// Applies the active mods to this DrawableRuleset.
///
diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs
index 86feea09a8..5bb1de7a38 100644
--- a/osu.Game/Rulesets/UI/ModIcon.cs
+++ b/osu.Game/Rulesets/UI/ModIcon.cs
@@ -11,11 +11,14 @@ using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
using osuTK;
+using osu.Framework.Bindables;
namespace osu.Game.Rulesets.UI
{
public class ModIcon : Container, IHasTooltip
{
+ public readonly BindableBool Highlighted = new BindableBool();
+
private readonly SpriteIcon modIcon;
private readonly SpriteIcon background;
@@ -97,26 +100,12 @@ namespace osu.Game.Rulesets.UI
highlightedColour = colours.PinkLight;
break;
}
-
- applyStyle();
}
- private bool highlighted;
-
- public bool Highlighted
+ protected override void LoadComplete()
{
- get => highlighted;
-
- set
- {
- highlighted = value;
- applyStyle();
- }
- }
-
- private void applyStyle()
- {
- background.Colour = highlighted ? highlightedColour : backgroundColour;
+ base.LoadComplete();
+ Highlighted.BindValueChanged(highlighted => background.Colour = highlighted.NewValue ? highlightedColour : backgroundColour, true);
}
}
}
diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs
index 069e2d1a0b..19247d8a37 100644
--- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs
+++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs
@@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
[Resolved]
private IScrollingInfo scrollingInfo { get; set; }
- private Cached initialStateCache = new Cached();
+ private readonly Cached initialStateCache = new Cached();
public ScrollingHitObjectContainer()
{
diff --git a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs
index 0fdbd56c92..2e4b4b3a9a 100644
--- a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs
+++ b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs
@@ -80,6 +80,9 @@ namespace osu.Game.Scoring.Legacy
else if (version >= 20121008)
scoreInfo.OnlineScoreID = sr.ReadInt32();
+ if (scoreInfo.OnlineScoreID <= 0)
+ scoreInfo.OnlineScoreID = null;
+
if (compressedReplay?.Length > 0)
{
using (var replayInStream = new MemoryStream(compressedReplay))
diff --git a/osu.Game/Screens/Direct/OnlineListing.cs b/osu.Game/Screens/Direct/OnlineListing.cs
deleted file mode 100644
index 8376383674..0000000000
--- a/osu.Game/Screens/Direct/OnlineListing.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-namespace osu.Game.Screens.Direct
-{
- public class OnlineListing : ScreenWhiteBox
- {
- }
-}
diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs
index 8add730c4e..de00ba2e9f 100644
--- a/osu.Game/Screens/Loader.cs
+++ b/osu.Game/Screens/Loader.cs
@@ -45,7 +45,15 @@ namespace osu.Game.Screens
private OsuScreen loadableScreen;
private ShaderPrecompiler precompiler;
- protected virtual OsuScreen CreateLoadableScreen() => showDisclaimer ? (OsuScreen)new Disclaimer() : new Intro();
+ protected virtual OsuScreen CreateLoadableScreen()
+ {
+ if (showDisclaimer)
+ return new Disclaimer(getIntroSequence());
+
+ return getIntroSequence();
+ }
+
+ private IntroScreen getIntroSequence() => new IntroCircles();
protected virtual ShaderPrecompiler CreateShaderPrecompiler() => new ShaderPrecompiler();
diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs
index 97231a1331..073ab639e3 100644
--- a/osu.Game/Screens/Menu/Disclaimer.cs
+++ b/osu.Game/Screens/Menu/Disclaimer.cs
@@ -21,7 +21,6 @@ namespace osu.Game.Screens.Menu
{
public class Disclaimer : StartupScreen
{
- private Intro intro;
private SpriteIcon icon;
private Color4 iconColour;
private LinkFlowContainer textFlow;
@@ -32,10 +31,13 @@ namespace osu.Game.Screens.Menu
private const float icon_y = -85;
private const float icon_size = 30;
+ private readonly OsuScreen nextScreen;
+
private readonly Bindable currentUser = new Bindable();
- public Disclaimer()
+ public Disclaimer(OsuScreen nextScreen = null)
{
+ this.nextScreen = nextScreen;
ValidForResume = false;
}
@@ -146,7 +148,8 @@ namespace osu.Game.Screens.Menu
protected override void LoadComplete()
{
base.LoadComplete();
- LoadComponentAsync(intro = new Intro());
+ if (nextScreen != null)
+ LoadComponentAsync(nextScreen);
}
public override void OnEntering(IScreen last)
@@ -170,7 +173,7 @@ namespace osu.Game.Screens.Menu
.Then(5500)
.FadeOut(250)
.ScaleTo(0.9f, 250, Easing.InQuint)
- .Finally(d => this.Push(intro));
+ .Finally(d => this.Push(nextScreen));
}
}
}
diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/IntroCircles.cs
similarity index 51%
rename from osu.Game/Screens/Menu/Intro.cs
rename to osu.Game/Screens/Menu/IntroCircles.cs
index f6fbcf6498..4fa1a81123 100644
--- a/osu.Game/Screens/Menu/Intro.cs
+++ b/osu.Game/Screens/Menu/IntroCircles.cs
@@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
-using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
@@ -12,41 +11,24 @@ using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.IO.Archives;
-using osu.Game.Screens.Backgrounds;
-using osuTK;
-using osuTK.Graphics;
namespace osu.Game.Screens.Menu
{
- public class Intro : StartupScreen
+ public class IntroCircles : IntroScreen
{
private const string menu_music_beatmap_hash = "3c8b1fcc9434dbb29e2fb613d3b9eada9d7bb6c125ceb32396c3b53437280c83";
- ///
- /// Whether we have loaded the menu previously.
- ///
- public bool DidLoadMenu;
-
- private MainMenu mainMenu;
private SampleChannel welcome;
- private SampleChannel seeya;
- protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
-
- private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
-
- [Resolved]
- private AudioManager audio { get; set; }
-
- private Bindable menuVoice;
private Bindable menuMusic;
+
private Track track;
+
private WorkingBeatmap introBeatmap;
[BackgroundDependencyLoader]
- private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
+ private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, ISampleStore samples)
{
- menuVoice = config.GetBindable(OsuSetting.MenuVoice);
menuMusic = config.GetBindable(OsuSetting.MenuMusic);
BeatmapSetInfo setInfo = null;
@@ -75,15 +57,13 @@ namespace osu.Game.Screens.Menu
introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
track = introBeatmap.Track;
- welcome = audio.Samples.Get(@"welcome");
- seeya = audio.Samples.Get(@"seeya");
+ if (config.Get(OsuSetting.MenuVoice))
+ welcome = samples.Get(@"welcome");
}
private const double delay_step_one = 2300;
private const double delay_step_two = 600;
- public const int EXIT_DELAY = 3000;
-
protected override void LogoArriving(OsuLogo logo, bool resuming)
{
base.LogoArriving(logo, resuming);
@@ -93,86 +73,34 @@ namespace osu.Game.Screens.Menu
Beatmap.Value = introBeatmap;
introBeatmap = null;
- if (menuVoice.Value)
- welcome.Play();
+ welcome?.Play();
Scheduler.AddDelayed(delegate
{
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Manu.
if (menuMusic.Value)
{
- track.Start();
+ track.Restart();
track = null;
}
- LoadComponentAsync(mainMenu = new MainMenu());
+ PrepareMenuLoad();
- Scheduler.AddDelayed(delegate
- {
- DidLoadMenu = true;
- this.Push(mainMenu);
- }, delay_step_one);
+ Scheduler.AddDelayed(LoadMenu, delay_step_one);
}, delay_step_two);
- }
- logo.Colour = Color4.White;
- logo.Ripple = false;
-
- const int quick_appear = 350;
-
- int initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
-
- logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint);
-
- if (!resuming)
- {
logo.ScaleTo(1);
logo.FadeIn();
logo.PlayIntro();
}
- else
- {
- logo.Triangles = false;
-
- logo
- .ScaleTo(1, initialMovementTime, Easing.OutQuint)
- .FadeIn(quick_appear, Easing.OutQuint)
- .Then()
- .RotateTo(20, EXIT_DELAY * 1.5f)
- .FadeOut(EXIT_DELAY);
- }
}
public override void OnSuspending(IScreen next)
{
+ track = null;
+
this.FadeOut(300);
base.OnSuspending(next);
}
-
- public override bool OnExiting(IScreen next)
- {
- //cancel exiting if we haven't loaded the menu yet.
- return !DidLoadMenu;
- }
-
- public override void OnResuming(IScreen last)
- {
- this.FadeIn(300);
-
- double fadeOutTime = EXIT_DELAY;
- //we also handle the exit transition.
- if (menuVoice.Value)
- seeya.Play();
- else
- fadeOutTime = 500;
-
- audio.AddAdjustment(AdjustableProperty.Volume, exitingVolumeFade);
- this.TransformBindableTo(exitingVolumeFade, 0, fadeOutTime).OnComplete(_ => this.Exit());
-
- //don't want to fade out completely else we will stop running updates.
- Game.FadeTo(0.01f, fadeOutTime);
-
- base.OnResuming(last);
- }
}
}
diff --git a/osu.Game/Screens/Menu/IntroScreen.cs b/osu.Game/Screens/Menu/IntroScreen.cs
new file mode 100644
index 0000000000..27f3c9a45b
--- /dev/null
+++ b/osu.Game/Screens/Menu/IntroScreen.cs
@@ -0,0 +1,114 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Audio;
+using osu.Framework.Audio.Sample;
+using osu.Framework.Bindables;
+using osu.Framework.Graphics;
+using osu.Framework.Screens;
+using osu.Game.Beatmaps;
+using osu.Game.Configuration;
+using osu.Game.Screens.Backgrounds;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Screens.Menu
+{
+ public abstract class IntroScreen : StartupScreen
+ {
+ private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
+
+ public const int EXIT_DELAY = 3000;
+
+ [Resolved]
+ private AudioManager audio { get; set; }
+
+ private SampleChannel seeya;
+
+ private Bindable menuVoice;
+
+ protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
+
+ [BackgroundDependencyLoader]
+ private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
+ {
+ menuVoice = config.GetBindable(OsuSetting.MenuVoice);
+ seeya = audio.Samples.Get(@"seeya");
+ }
+
+ ///
+ /// Whether we have loaded the menu previously.
+ ///
+ public bool DidLoadMenu { get; private set; }
+
+ public override bool OnExiting(IScreen next)
+ {
+ //cancel exiting if we haven't loaded the menu yet.
+ return !DidLoadMenu;
+ }
+
+ public override void OnResuming(IScreen last)
+ {
+ this.FadeIn(300);
+
+ double fadeOutTime = EXIT_DELAY;
+ //we also handle the exit transition.
+ if (menuVoice.Value)
+ seeya.Play();
+ else
+ fadeOutTime = 500;
+
+ audio.AddAdjustment(AdjustableProperty.Volume, exitingVolumeFade);
+ this.TransformBindableTo(exitingVolumeFade, 0, fadeOutTime).OnComplete(_ => this.Exit());
+
+ //don't want to fade out completely else we will stop running updates.
+ Game.FadeTo(0.01f, fadeOutTime);
+
+ base.OnResuming(last);
+ }
+
+ protected override void LogoArriving(OsuLogo logo, bool resuming)
+ {
+ base.LogoArriving(logo, resuming);
+
+ logo.Colour = Color4.White;
+ logo.Triangles = false;
+ logo.Ripple = false;
+
+ if (!resuming)
+ {
+ logo.MoveTo(new Vector2(0.5f));
+ logo.ScaleTo(Vector2.One);
+ logo.Hide();
+ }
+ else
+ {
+ const int quick_appear = 350;
+ int initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
+
+ logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint);
+
+ logo
+ .ScaleTo(1, initialMovementTime, Easing.OutQuint)
+ .FadeIn(quick_appear, Easing.OutQuint)
+ .Then()
+ .RotateTo(20, EXIT_DELAY * 1.5f)
+ .FadeOut(EXIT_DELAY);
+ }
+ }
+
+ private MainMenu mainMenu;
+
+ protected void PrepareMenuLoad()
+ {
+ LoadComponentAsync(mainMenu = new MainMenu());
+ }
+
+ protected void LoadMenu()
+ {
+ DidLoadMenu = true;
+ this.Push(mainMenu);
+ }
+ }
+}
diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs
index 5999cbdfb5..499b5089f6 100644
--- a/osu.Game/Screens/Menu/MainMenu.cs
+++ b/osu.Game/Screens/Menu/MainMenu.cs
@@ -14,7 +14,6 @@ using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Charts;
-using osu.Game.Screens.Direct;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Multi;
using osu.Game.Screens.Select;
@@ -65,7 +64,6 @@ namespace osu.Game.Screens.Menu
buttons = new ButtonSystem
{
OnChart = delegate { this.Push(new ChartListing()); },
- OnDirect = delegate { this.Push(new OnlineListing()); },
OnEdit = delegate { this.Push(new Editor()); },
OnSolo = onSolo,
OnMulti = delegate { this.Push(new Multiplayer()); },
@@ -123,7 +121,7 @@ namespace osu.Game.Screens.Menu
var track = Beatmap.Value.Track;
var metadata = Beatmap.Value.Metadata;
- if (last is Intro && track != null)
+ if (last is IntroScreen && track != null)
{
if (!track.IsRunning)
{
diff --git a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs
index 8e14f76e4b..d0d983bbff 100644
--- a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs
+++ b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs
@@ -14,6 +14,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
{
protected override Color4 BackgroundColour => OsuColour.FromHex(@"362e42");
protected override PrimaryFilter DefaultTab => PrimaryFilter.Open;
+ protected override SecondaryFilter DefaultCategory => SecondaryFilter.Public;
protected override float ContentHorizontalPadding => base.ContentHorizontalPadding + OsuScreen.HORIZONTAL_OVERFLOW_PADDING;
diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs
index 9ffd620e55..90806bab6e 100644
--- a/osu.Game/Screens/Multi/Multiplayer.cs
+++ b/osu.Game/Screens/Multi/Multiplayer.cs
@@ -212,7 +212,7 @@ namespace osu.Game.Screens.Multi
public override bool OnExiting(IScreen next)
{
- if (!(screenStack.CurrentScreen is LoungeSubScreen))
+ if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen))
{
screenStack.Exit();
return true;
diff --git a/osu.Game/Screens/Play/BreakOverlay.cs b/osu.Game/Screens/Play/BreakOverlay.cs
index 2b401778a6..6fdee85f45 100644
--- a/osu.Game/Screens/Play/BreakOverlay.cs
+++ b/osu.Game/Screens/Play/BreakOverlay.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using osu.Framework.Allocation;
+using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@@ -15,7 +16,11 @@ namespace osu.Game.Screens.Play
{
public class BreakOverlay : Container
{
- private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
+ ///
+ /// The duration of the break overlay fading.
+ ///
+ public const double BREAK_FADE_DURATION = BreakPeriod.MIN_BREAK_DURATION / 2;
+
private const float remaining_time_container_max_size = 0.3f;
private const int vertical_margin = 25;
@@ -29,12 +34,27 @@ namespace osu.Game.Screens.Play
set
{
breaks = value;
- initializeBreaks();
+
+ // reset index in case the new breaks list is smaller than last one
+ isBreakTime.Value = false;
+ CurrentBreakIndex = 0;
+
+ if (IsLoaded)
+ initializeBreaks();
}
}
public override bool RemoveCompletedTransforms => false;
+ ///
+ /// Whether the gameplay is currently in a break.
+ ///
+ public IBindable IsBreakTime => isBreakTime;
+
+ protected int CurrentBreakIndex;
+
+ private readonly BindableBool isBreakTime = new BindableBool();
+
private readonly Container remainingTimeAdjustmentBox;
private readonly Container remainingTimeBox;
private readonly RemainingTimeCounter remainingTimeCounter;
@@ -109,10 +129,36 @@ namespace osu.Game.Screens.Play
initializeBreaks();
}
+ protected override void Update()
+ {
+ base.Update();
+ updateBreakTimeBindable();
+ }
+
+ private void updateBreakTimeBindable()
+ {
+ if (breaks == null || breaks.Count == 0)
+ return;
+
+ var time = Clock.CurrentTime;
+
+ if (time > breaks[CurrentBreakIndex].EndTime)
+ {
+ while (time > breaks[CurrentBreakIndex].EndTime && CurrentBreakIndex < breaks.Count - 1)
+ CurrentBreakIndex++;
+ }
+ else
+ {
+ while (time < breaks[CurrentBreakIndex].StartTime && CurrentBreakIndex > 0)
+ CurrentBreakIndex--;
+ }
+
+ var currentBreak = breaks[CurrentBreakIndex];
+ isBreakTime.Value = currentBreak.HasEffect && currentBreak.Contains(time);
+ }
+
private void initializeBreaks()
{
- if (!IsLoaded) return; // we need a clock.
-
FinishTransforms(true);
Scheduler.CancelDelayedTasks();
@@ -125,25 +171,25 @@ namespace osu.Game.Screens.Play
using (BeginAbsoluteSequence(b.StartTime, true))
{
- fadeContainer.FadeIn(fade_duration);
- breakArrows.Show(fade_duration);
+ fadeContainer.FadeIn(BREAK_FADE_DURATION);
+ breakArrows.Show(BREAK_FADE_DURATION);
remainingTimeAdjustmentBox
- .ResizeWidthTo(remaining_time_container_max_size, fade_duration, Easing.OutQuint)
- .Delay(b.Duration - fade_duration)
+ .ResizeWidthTo(remaining_time_container_max_size, BREAK_FADE_DURATION, Easing.OutQuint)
+ .Delay(b.Duration - BREAK_FADE_DURATION)
.ResizeWidthTo(0);
remainingTimeBox
- .ResizeWidthTo(0, b.Duration - fade_duration)
+ .ResizeWidthTo(0, b.Duration - BREAK_FADE_DURATION)
.Then()
.ResizeWidthTo(1);
remainingTimeCounter.CountTo(b.Duration).CountTo(0, b.Duration);
- using (BeginDelayedSequence(b.Duration - fade_duration, true))
+ using (BeginDelayedSequence(b.Duration - BREAK_FADE_DURATION, true))
{
- fadeContainer.FadeOut(fade_duration);
- breakArrows.Hide(fade_duration);
+ fadeContainer.FadeOut(BREAK_FADE_DURATION);
+ breakArrows.Hide(BREAK_FADE_DURATION);
}
}
}
diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs
index 8dc16af575..e7398be176 100644
--- a/osu.Game/Screens/Play/Player.cs
+++ b/osu.Game/Screens/Play/Player.cs
@@ -66,6 +66,8 @@ namespace osu.Game.Screens.Play
private SampleChannel sampleRestart;
+ private BreakOverlay breakOverlay;
+
protected ScoreProcessor ScoreProcessor { get; private set; }
protected DrawableRuleset DrawableRuleset { get; private set; }
@@ -134,7 +136,7 @@ namespace osu.Game.Screens.Play
}
}
},
- new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
+ breakOverlay = new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@@ -255,7 +257,7 @@ namespace osu.Game.Screens.Play
private void performImmediateExit()
{
// if a restart has been requested, cancel any pending completion (user has shown intent to restart).
- onCompletionEvent = null;
+ completionProgressDelegate?.Cancel();
ValidForResume = false;
@@ -275,20 +277,16 @@ namespace osu.Game.Screens.Play
sampleRestart?.Play();
- // if a restart has been requested, cancel any pending completion (user has shown intent to restart).
- onCompletionEvent = null;
-
- ValidForResume = false;
RestartRequested?.Invoke();
- this.Exit();
+ performImmediateExit();
}
- private ScheduledDelegate onCompletionEvent;
+ private ScheduledDelegate completionProgressDelegate;
private void onCompletion()
{
// Only show the completion screen if the player hasn't failed
- if (ScoreProcessor.HasFailed || onCompletionEvent != null)
+ if (ScoreProcessor.HasFailed || completionProgressDelegate != null)
return;
ValidForResume = false;
@@ -297,7 +295,7 @@ namespace osu.Game.Screens.Play
using (BeginDelayedSequence(1000))
{
- onCompletionEvent = Schedule(delegate
+ completionProgressDelegate = Schedule(delegate
{
if (!this.IsCurrentScreen()) return;
@@ -306,8 +304,6 @@ namespace osu.Game.Screens.Play
scoreManager.Import(score).Wait();
this.Push(CreateResults(score));
-
- onCompletionEvent = null;
});
}
}
@@ -417,8 +413,7 @@ namespace osu.Game.Screens.Play
PauseOverlay.Hide();
// breaks and time-based conditions may allow instant resume.
- double time = GameplayClockContainer.GameplayClock.CurrentTime;
- if (Beatmap.Value.Beatmap.Breaks.Any(b => b.Contains(time)) || time < Beatmap.Value.Beatmap.HitObjects.First().StartTime)
+ if (breakOverlay.IsBreakTime.Value || GameplayClockContainer.GameplayClock.CurrentTime < Beatmap.Value.Beatmap.HitObjects.First().StartTime)
completeResume();
else
DrawableRuleset.RequestResume(completeResume);
@@ -471,10 +466,10 @@ namespace osu.Game.Screens.Play
public override bool OnExiting(IScreen next)
{
- if (onCompletionEvent != null)
+ if (completionProgressDelegate != null && !completionProgressDelegate.Cancelled && !completionProgressDelegate.Completed)
{
- // Proceed to result screen if beatmap already finished playing
- onCompletionEvent.RunTask();
+ // proceed to result screen if beatmap already finished playing
+ completionProgressDelegate.RunTask();
return true;
}
diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs
index 5b7a9574b6..9c56725c4e 100644
--- a/osu.Game/Screens/Play/SquareGraph.cs
+++ b/osu.Game/Screens/Play/SquareGraph.cs
@@ -75,7 +75,7 @@ namespace osu.Game.Screens.Play
return base.Invalidate(invalidation, source, shallPropagate);
}
- private Cached layout = new Cached();
+ private readonly Cached layout = new Cached();
private ScheduledDelegate scheduledCreate;
protected override void Update()
diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs
index cf88b697d9..7366fa8c17 100644
--- a/osu.Game/Screens/Select/BeatmapCarousel.cs
+++ b/osu.Game/Screens/Select/BeatmapCarousel.cs
@@ -93,8 +93,8 @@ namespace osu.Game.Screens.Select
}
private readonly List yPositions = new List();
- private Cached itemsCache = new Cached();
- private Cached scrollPositionCache = new Cached();
+ private readonly Cached itemsCache = new Cached();
+ private readonly Cached scrollPositionCache = new Cached();
private readonly Container scrollableContent;
diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs
index 23dd87d8ea..577d999388 100644
--- a/osu.Game/Screens/Select/BeatmapDetails.cs
+++ b/osu.Game/Screens/Select/BeatmapDetails.cs
@@ -35,7 +35,7 @@ namespace osu.Game.Screens.Select
private readonly MetadataSection description, source, tags;
private readonly Container failRetryContainer;
private readonly FailRetryGraph failRetryGraph;
- private readonly DimmedLoadingAnimation loading;
+ private readonly DimmedLoadingLayer loading;
private IAPIProvider api;
@@ -156,10 +156,7 @@ namespace osu.Game.Screens.Select
},
},
},
- loading = new DimmedLoadingAnimation
- {
- RelativeSizeAxes = Axes.Both,
- },
+ loading = new DimmedLoadingLayer(),
};
}
@@ -365,35 +362,5 @@ namespace osu.Game.Screens.Select
});
}
}
-
- private class DimmedLoadingAnimation : VisibilityContainer
- {
- private readonly LoadingAnimation loading;
-
- public DimmedLoadingAnimation()
- {
- Children = new Drawable[]
- {
- new Box
- {
- RelativeSizeAxes = Axes.Both,
- Colour = Color4.Black.Opacity(0.5f),
- },
- loading = new LoadingAnimation(),
- };
- }
-
- protected override void PopIn()
- {
- this.FadeIn(transition_duration, Easing.OutQuint);
- loading.Show();
- }
-
- protected override void PopOut()
- {
- this.FadeOut(transition_duration, Easing.OutQuint);
- loading.Hide();
- }
- }
}
}
diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs
index 2551ffe2fc..a9e4eaa9b3 100644
--- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs
+++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs
@@ -141,6 +141,7 @@ namespace osu.Game.Screens.Select
private readonly RulesetInfo ruleset;
public BufferedWedgeInfo(WorkingBeatmap beatmap, RulesetInfo userRuleset)
+ : base(pixelSnapping: true)
{
this.beatmap = beatmap;
ruleset = userRuleset ?? beatmap.BeatmapInfo.Ruleset;
@@ -152,7 +153,6 @@ namespace osu.Game.Screens.Select
var beatmapInfo = beatmap.BeatmapInfo;
var metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
- PixelSnapping = true;
CacheDrawnFrameBuffer = true;
RelativeSizeAxes = Axes.Both;
diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs
index 0680711f1c..1dc7081c1c 100644
--- a/osu.Game/Screens/Select/Footer.cs
+++ b/osu.Game/Screens/Select/Footer.cs
@@ -94,7 +94,7 @@ namespace osu.Game.Screens.Select
buttons = new FillFlowContainer
{
Direction = FillDirection.Horizontal,
- Spacing = new Vector2(0.2f, 0),
+ Spacing = new Vector2(-FooterButton.SHEAR_WIDTH, 0),
AutoSizeAxes = Axes.Both,
}
}
diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs
index e18a086a10..c1478aa4ce 100644
--- a/osu.Game/Screens/Select/FooterButton.cs
+++ b/osu.Game/Screens/Select/FooterButton.cs
@@ -17,7 +17,9 @@ namespace osu.Game.Screens.Select
{
public class FooterButton : OsuClickableContainer
{
- private static readonly Vector2 shearing = new Vector2(0.15f, 0);
+ public static readonly float SHEAR_WIDTH = 7.5f;
+
+ protected static readonly Vector2 SHEAR = new Vector2(SHEAR_WIDTH / Footer.HEIGHT, 0);
public string Text
{
@@ -59,37 +61,35 @@ namespace osu.Game.Screens.Select
private readonly Box box;
private readonly Box light;
- public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos);
-
public FooterButton()
{
AutoSizeAxes = Axes.Both;
+ Shear = SHEAR;
Children = new Drawable[]
{
- TextContainer = new Container
- {
- Size = new Vector2(100, 50),
- Child = SpriteText = new OsuSpriteText
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- }
- },
box = new Box
{
RelativeSizeAxes = Axes.Both,
- Shear = shearing,
EdgeSmoothness = new Vector2(2, 0),
Colour = Color4.White,
Alpha = 0,
},
light = new Box
{
- Shear = shearing,
Height = 4,
EdgeSmoothness = new Vector2(2, 0),
RelativeSizeAxes = Axes.X,
},
+ TextContainer = new Container
+ {
+ Size = new Vector2(100 - SHEAR_WIDTH, 50),
+ Shear = -SHEAR,
+ Child = SpriteText = new OsuSpriteText
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ }
+ },
};
}
diff --git a/osu.Game/Screens/Select/FooterButtonMods.cs b/osu.Game/Screens/Select/FooterButtonMods.cs
index fce4d1b2e2..29b1364944 100644
--- a/osu.Game/Screens/Select/FooterButtonMods.cs
+++ b/osu.Game/Screens/Select/FooterButtonMods.cs
@@ -32,6 +32,7 @@ namespace osu.Game.Screens.Select
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
+ Shear = -SHEAR,
Child = modDisplay = new FooterModDisplay
{
DisplayUnrankedText = false,
diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs
index 513a024a36..3eda76e40f 100644
--- a/osu.Game/Skinning/LegacySkin.cs
+++ b/osu.Game/Skinning/LegacySkin.cs
@@ -6,15 +6,23 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
+using osu.Framework.Bindables;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Game.Database;
+using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
+using osu.Game.Rulesets.Objects.Drawables;
+using osu.Game.Rulesets.Objects.Types;
+using osu.Game.Rulesets.UI;
using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Skinning
{
@@ -24,11 +32,20 @@ namespace osu.Game.Skinning
protected IResourceStore Samples;
+ ///
+ /// On osu-stable, hitcircles have 5 pixels of transparent padding on each side to allow for shadows etc.
+ /// Their hittable area is 128px, but the actual circle portion is 118px.
+ /// We must account for some gameplay elements such as slider bodies, where this padding is not present.
+ ///
+ private const float legacy_circle_radius = 64 - 5;
+
public LegacySkin(SkinInfo skin, IResourceStore storage, AudioManager audioManager)
: this(skin, new LegacySkinResourceStore(skin, storage), audioManager, "skin.ini")
{
}
+ private readonly bool hasHitCircle;
+
protected LegacySkin(SkinInfo skin, IResourceStore storage, AudioManager audioManager, string filename)
: base(skin)
{
@@ -41,6 +58,14 @@ namespace osu.Game.Skinning
Samples = audioManager.GetSampleStore(storage);
Textures = new TextureStore(new TextureLoaderStore(storage));
+
+ using (var testStream = storage.GetStream("hitcircle"))
+ hasHitCircle |= testStream != null;
+
+ if (hasHitCircle)
+ {
+ Configuration.SliderPathRadius = legacy_circle_radius;
+ }
}
protected override void Dispose(bool isDisposing)
@@ -54,6 +79,24 @@ namespace osu.Game.Skinning
{
switch (componentName)
{
+ case "Play/osu/cursor":
+ if (GetTexture("cursor") != null)
+ return new LegacyCursor();
+
+ return null;
+
+ case "Play/osu/sliderball":
+ if (GetTexture("sliderb") != null)
+ return new LegacySliderBall();
+
+ return null;
+
+ case "Play/osu/hitcircle":
+ if (hasHitCircle)
+ return new LegacyMainCirclePiece();
+
+ return null;
+
case "Play/Miss":
componentName = "hit0";
break;
@@ -92,10 +135,19 @@ namespace osu.Game.Skinning
return new Sprite { Texture = texture };
}
+ public class LegacySliderBall : Sprite
+ {
+ [BackgroundDependencyLoader]
+ private void load(ISkinSource skin)
+ {
+ Texture = skin.GetTexture("sliderb");
+ Colour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Color4.White;
+ }
+ }
+
public override Texture GetTexture(string componentName)
{
float ratio = 2;
-
var texture = Textures.Get($"{componentName}@2x");
if (texture == null)
@@ -105,7 +157,7 @@ namespace osu.Game.Skinning
}
if (texture != null)
- texture.ScaleAdjust = ratio / 0.72f; // brings sizing roughly in-line with stable
+ texture.ScaleAdjust = ratio;
return texture;
}
@@ -215,5 +267,117 @@ namespace osu.Game.Skinning
return texture;
}
}
+
+ public class LegacyCursor : CompositeDrawable
+ {
+ public LegacyCursor()
+ {
+ Size = new Vector2(50);
+
+ Anchor = Anchor.Centre;
+ Origin = Anchor.Centre;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(ISkinSource skin)
+ {
+ InternalChildren = new Drawable[]
+ {
+ new NonPlayfieldSprite
+ {
+ Texture = skin.GetTexture("cursormiddle"),
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ },
+ new NonPlayfieldSprite
+ {
+ Texture = skin.GetTexture("cursor"),
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ }
+ };
+ }
+ }
+
+ public class LegacyMainCirclePiece : CompositeDrawable
+ {
+ public LegacyMainCirclePiece()
+ {
+ Size = new Vector2(128);
+ }
+
+ private readonly IBindable state = new Bindable();
+
+ private readonly Bindable accentColour = new Bindable();
+
+ [BackgroundDependencyLoader]
+ private void load(DrawableHitObject drawableObject, ISkinSource skin)
+ {
+ Sprite hitCircleSprite;
+
+ InternalChildren = new Drawable[]
+ {
+ hitCircleSprite = new Sprite
+ {
+ Texture = skin.GetTexture("hitcircle"),
+ Colour = drawableObject.AccentColour.Value,
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ },
+ new SkinnableSpriteText("Play/osu/number-text", _ => new OsuSpriteText
+ {
+ Font = OsuFont.Numeric.With(size: 40),
+ UseFullGlyphHeight = false,
+ }, confineMode: ConfineMode.NoScaling)
+ {
+ Text = (((IHasComboInformation)drawableObject.HitObject).IndexInCurrentCombo + 1).ToString()
+ },
+ new Sprite
+ {
+ Texture = skin.GetTexture("hitcircleoverlay"),
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ }
+ };
+
+ state.BindTo(drawableObject.State);
+ state.BindValueChanged(updateState, true);
+
+ accentColour.BindTo(drawableObject.AccentColour);
+ accentColour.BindValueChanged(colour => hitCircleSprite.Colour = colour.NewValue, true);
+ }
+
+ private void updateState(ValueChangedEvent state)
+ {
+ const double legacy_fade_duration = 240;
+
+ switch (state.NewValue)
+ {
+ case ArmedState.Hit:
+ this.FadeOut(legacy_fade_duration, Easing.Out);
+ this.ScaleTo(1.4f, legacy_fade_duration, Easing.Out);
+ break;
+ }
+ }
+ }
+
+ ///
+ /// A sprite which is displayed within the playfield, but historically was not considered part of the playfield.
+ /// Performs scale adjustment to undo the scale applied by (osu! ruleset specifically).
+ ///
+ private class NonPlayfieldSprite : Sprite
+ {
+ public override Texture Texture
+ {
+ get => base.Texture;
+ set
+ {
+ if (value != null)
+ // stable "magic ratio". see OsuPlayfieldAdjustmentContainer for full explanation.
+ value.ScaleAdjust *= 1.6f;
+ base.Texture = value;
+ }
+ }
+ }
}
}
diff --git a/osu.Game/Skinning/SkinConfiguration.cs b/osu.Game/Skinning/SkinConfiguration.cs
index 043622f8ce..93b599f9f6 100644
--- a/osu.Game/Skinning/SkinConfiguration.cs
+++ b/osu.Game/Skinning/SkinConfiguration.cs
@@ -27,6 +27,8 @@ namespace osu.Game.Skinning
public float? SliderBorderSize { get; set; }
+ public float? SliderPathRadius { get; set; }
+
public bool? CursorExpand { get; set; } = true;
}
}
diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs
index 70abfac501..19997e8844 100644
--- a/osu.Game/Skinning/SkinManager.cs
+++ b/osu.Game/Skinning/SkinManager.cs
@@ -45,7 +45,7 @@ namespace osu.Game.Skinning
CurrentSkinInfo.Value = SkinInfo.Default;
};
- CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = getSkin(skin.NewValue);
+ CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue);
CurrentSkin.ValueChanged += skin =>
{
if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value)
@@ -80,7 +80,7 @@ namespace osu.Game.Skinning
{
await base.Populate(model, archive, cancellationToken);
- Skin reference = getSkin(model);
+ Skin reference = GetSkin(model);
if (!string.IsNullOrEmpty(reference.Configuration.SkinInfo.Name))
{
@@ -99,7 +99,7 @@ namespace osu.Game.Skinning
///
/// The skin to lookup.
/// A instance correlating to the provided .
- private Skin getSkin(SkinInfo skinInfo)
+ public Skin GetSkin(SkinInfo skinInfo)
{
if (skinInfo == SkinInfo.Default)
return new DefaultSkin();
diff --git a/osu.Game/Skinning/SkinReloadableDrawable.cs b/osu.Game/Skinning/SkinReloadableDrawable.cs
index c09d5b1f92..4bbdeafba5 100644
--- a/osu.Game/Skinning/SkinReloadableDrawable.cs
+++ b/osu.Game/Skinning/SkinReloadableDrawable.cs
@@ -1,4 +1,4 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
@@ -36,12 +36,15 @@ namespace osu.Game.Skinning
skin.SourceChanged += onChange;
}
- private void onChange() => SkinChanged(skin, allowDefaultFallback);
+ private void onChange() =>
+ // schedule required to avoid calls after disposed.
+ // note that this has the side-effect of components only performing a skin change when they are alive.
+ Scheduler.AddOnce(() => SkinChanged(skin, allowDefaultFallback));
protected override void LoadAsyncComplete()
{
base.LoadAsyncComplete();
- onChange();
+ SkinChanged(skin, allowDefaultFallback);
}
///
diff --git a/osu.Game/Skinning/SkinnableDrawable.cs b/osu.Game/Skinning/SkinnableDrawable.cs
index 995cb15136..0c635a3d2f 100644
--- a/osu.Game/Skinning/SkinnableDrawable.cs
+++ b/osu.Game/Skinning/SkinnableDrawable.cs
@@ -1,35 +1,26 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
+using osu.Framework.Caching;
using osu.Framework.Graphics;
using osuTK;
namespace osu.Game.Skinning
{
- public class SkinnableDrawable : SkinnableDrawable
- {
- public SkinnableDrawable(string name, Func defaultImplementation, Func allowFallback = null, bool restrictSize = true)
- : base(name, defaultImplementation, allowFallback, restrictSize)
- {
- }
- }
-
///
/// A drawable which can be skinned via an .
///
- /// The type of drawable.
- public class SkinnableDrawable : SkinReloadableDrawable
- where T : Drawable
+ public class SkinnableDrawable : SkinReloadableDrawable
{
///
- /// The displayed component. May or may not be a type- member.
+ /// The displayed component.
///
protected Drawable Drawable { get; private set; }
private readonly string componentName;
- private readonly bool restrictSize;
+ private readonly ConfineMode confineMode;
///
/// Create a new skinnable drawable.
@@ -37,28 +28,32 @@ namespace osu.Game.Skinning
/// The namespace-complete resource name for this skinnable element.
/// A function to create the default skin implementation of this element.
/// A conditional to decide whether to allow fallback to the default implementation if a skinned element is not present.
- /// Whether a user-skin drawable should be limited to the size of our parent.
- public SkinnableDrawable(string name, Func defaultImplementation, Func allowFallback = null, bool restrictSize = true)
- : this(name, allowFallback, restrictSize)
+ /// How (if at all) the should be resize to fit within our own bounds.
+ public SkinnableDrawable(string name, Func defaultImplementation, Func allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
+ : this(name, allowFallback, confineMode)
{
createDefault = defaultImplementation;
}
- protected SkinnableDrawable(string name, Func allowFallback = null, bool restrictSize = true)
+ protected SkinnableDrawable(string name, Func allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
: base(allowFallback)
{
componentName = name;
- this.restrictSize = restrictSize;
+ this.confineMode = confineMode;
RelativeSizeAxes = Axes.Both;
}
- private readonly Func createDefault;
+ private readonly Func createDefault;
- protected virtual T CreateDefault(string name) => createDefault(name);
+ private readonly Cached scaling = new Cached();
+
+ private bool isDefault;
+
+ protected virtual Drawable CreateDefault(string name) => createDefault(name);
///
- /// Whether to apply size restrictions (specified via ) to the default implementation.
+ /// Whether to apply size restrictions (specified via ) to the default implementation.
///
protected virtual bool ApplySizeRestrictionsToDefault => false;
@@ -66,7 +61,7 @@ namespace osu.Game.Skinning
{
Drawable = skin.GetDrawableComponent(componentName);
- bool isDefault = false;
+ isDefault = false;
if (Drawable == null && allowFallback)
{
@@ -76,21 +71,57 @@ namespace osu.Game.Skinning
if (Drawable != null)
{
- if (restrictSize && (!isDefault || ApplySizeRestrictionsToDefault))
- {
- Drawable.RelativeSizeAxes = Axes.Both;
- Drawable.Size = Vector2.One;
- Drawable.Scale = Vector2.One;
- Drawable.FillMode = FillMode.Fit;
- }
-
+ scaling.Invalidate();
Drawable.Origin = Anchor.Centre;
Drawable.Anchor = Anchor.Centre;
-
InternalChild = Drawable;
}
else
ClearInternal();
}
+
+ protected override void Update()
+ {
+ base.Update();
+
+ if (!scaling.IsValid)
+ {
+ try
+ {
+ if (Drawable == null || (isDefault && !ApplySizeRestrictionsToDefault)) return;
+
+ switch (confineMode)
+ {
+ case ConfineMode.NoScaling:
+ return;
+
+ case ConfineMode.ScaleDownToFit:
+ if (Drawable.DrawSize.X <= DrawSize.X && Drawable.DrawSize.Y <= DrawSize.Y)
+ return;
+
+ break;
+ }
+
+ Drawable.RelativeSizeAxes = Axes.Both;
+ Drawable.Size = Vector2.One;
+ Drawable.Scale = Vector2.One;
+ Drawable.FillMode = FillMode.Fit;
+ }
+ finally
+ {
+ scaling.Validate();
+ }
+ }
+ }
+ }
+
+ public enum ConfineMode
+ {
+ ///
+ /// Don't apply any scaling. This allows the user element to be of any size, exceeding specified bounds.
+ ///
+ NoScaling,
+ ScaleDownToFit,
+ ScaleToFit,
}
}
diff --git a/osu.Game/Skinning/SkinnableSprite.cs b/osu.Game/Skinning/SkinnableSprite.cs
index ceb1ed0f70..07ba48d6ae 100644
--- a/osu.Game/Skinning/SkinnableSprite.cs
+++ b/osu.Game/Skinning/SkinnableSprite.cs
@@ -3,6 +3,7 @@
using System;
using osu.Framework.Allocation;
+using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
@@ -11,18 +12,18 @@ namespace osu.Game.Skinning
///
/// A skinnable element which uses a stable sprite and can therefore share implementation logic.
///
- public class SkinnableSprite : SkinnableDrawable
+ public class SkinnableSprite : SkinnableDrawable
{
protected override bool ApplySizeRestrictionsToDefault => true;
[Resolved]
private TextureStore textures { get; set; }
- public SkinnableSprite(string name, Func allowFallback = null, bool restrictSize = true)
- : base(name, allowFallback, restrictSize)
+ public SkinnableSprite(string name, Func allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
+ : base(name, allowFallback, confineMode)
{
}
- protected override Sprite CreateDefault(string name) => new Sprite { Texture = textures.Get(name) };
+ protected override Drawable CreateDefault(string name) => new Sprite { Texture = textures.Get(name) };
}
}
diff --git a/osu.Game/Skinning/SkinnableSpriteText.cs b/osu.Game/Skinning/SkinnableSpriteText.cs
index 36e646d743..5af6df15e1 100644
--- a/osu.Game/Skinning/SkinnableSpriteText.cs
+++ b/osu.Game/Skinning/SkinnableSpriteText.cs
@@ -6,10 +6,10 @@ using osu.Framework.Graphics.Sprites;
namespace osu.Game.Skinning
{
- public class SkinnableSpriteText : SkinnableDrawable, IHasText
+ public class SkinnableSpriteText : SkinnableDrawable, IHasText
{
- public SkinnableSpriteText(string name, Func defaultImplementation, Func allowFallback = null, bool restrictSize = true)
- : base(name, defaultImplementation, allowFallback, restrictSize)
+ public SkinnableSpriteText(string name, Func defaultImplementation, Func allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
+ : base(name, defaultImplementation, allowFallback, confineMode)
{
}
diff --git a/osu.Game/Storyboards/CommandTimeline.cs b/osu.Game/Storyboards/CommandTimeline.cs
index aa1f137cf3..bcf642b4ea 100644
--- a/osu.Game/Storyboards/CommandTimeline.cs
+++ b/osu.Game/Storyboards/CommandTimeline.cs
@@ -15,10 +15,10 @@ namespace osu.Game.Storyboards
public IEnumerable Commands => commands.OrderBy(c => c.StartTime);
public bool HasCommands => commands.Count > 0;
- private Cached startTimeBacking;
+ private readonly Cached startTimeBacking = new Cached();
public double StartTime => startTimeBacking.IsValid ? startTimeBacking : startTimeBacking.Value = HasCommands ? commands.Min(c => c.StartTime) : double.MinValue;
- private Cached endTimeBacking;
+ private readonly Cached endTimeBacking = new Cached();
public double EndTime => endTimeBacking.IsValid ? endTimeBacking : endTimeBacking.Value = HasCommands ? commands.Max(c => c.EndTime) : double.MaxValue;
public T StartValue => HasCommands ? commands.OrderBy(c => c.StartTime).First().StartValue : default;
diff --git a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs
index 6a5e17eb38..a555a52e42 100644
--- a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs
+++ b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs
@@ -4,13 +4,16 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Reflection;
using Newtonsoft.Json;
using NUnit.Framework;
-using osu.Framework.Extensions.IEnumerableExtensions;
+using osu.Framework.Audio.Track;
+using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.Rulesets;
+using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Tests.Beatmaps
@@ -25,11 +28,9 @@ namespace osu.Game.Tests.Beatmaps
protected abstract string ResourceAssembly { get; }
- protected IBeatmapConverter Converter { get; private set; }
-
- protected void Test(string name)
+ protected void Test(string name, params Type[] mods)
{
- var ourResult = convert(name);
+ var ourResult = convert(name, mods.Select(m => (Mod)Activator.CreateInstance(m)).ToArray());
var expectedResult = read(name);
Assert.Multiple(() =>
@@ -91,33 +92,40 @@ namespace osu.Game.Tests.Beatmaps
});
}
- private ConvertResult convert(string name)
+ private ConvertResult convert(string name, Mod[] mods)
{
var beatmap = getBeatmap(name);
var rulesetInstance = CreateRuleset();
beatmap.BeatmapInfo.Ruleset = beatmap.BeatmapInfo.RulesetID == rulesetInstance.RulesetInfo.ID ? rulesetInstance.RulesetInfo : new RulesetInfo();
- Converter = rulesetInstance.CreateBeatmapConverter(beatmap);
+ var converterResult = new Dictionary>();
- var result = new ConvertResult();
-
- Converter.ObjectConverted += (orig, converted) =>
+ var working = new ConversionWorkingBeatmap(beatmap)
{
- converted.ForEach(h => h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty));
-
- var mapping = CreateConvertMapping();
- mapping.StartTime = orig.StartTime;
-
- foreach (var obj in converted)
- mapping.Objects.AddRange(CreateConvertValue(obj));
- result.Mappings.Add(mapping);
+ ConversionGenerated = (o, r, c) =>
+ {
+ converterResult[o] = r;
+ OnConversionGenerated(o, r, c);
+ }
};
- IBeatmap convertedBeatmap = Converter.Convert();
- rulesetInstance.CreateBeatmapProcessor(convertedBeatmap)?.PostProcess();
+ working.GetPlayableBeatmap(rulesetInstance.RulesetInfo, mods);
- return result;
+ return new ConvertResult
+ {
+ Mappings = converterResult.Select(r =>
+ {
+ var mapping = CreateConvertMapping(r.Key);
+ mapping.StartTime = r.Key.StartTime;
+ mapping.Objects.AddRange(r.Value.SelectMany(CreateConvertValue));
+ return mapping;
+ }).ToList()
+ };
+ }
+
+ protected virtual void OnConversionGenerated(HitObject original, IEnumerable result, IBeatmapConverter beatmapConverter)
+ {
}
private ConvertResult read(string name)
@@ -154,7 +162,7 @@ namespace osu.Game.Tests.Beatmaps
/// This should be used to validate the integrity of the conversion process after a conversion has occurred.
///
///
- protected virtual TConvertMapping CreateConvertMapping() => new TConvertMapping();
+ protected virtual TConvertMapping CreateConvertMapping(HitObject source) => new TConvertMapping();
///
/// Creates the conversion value for a . A conversion value stores information about the converted .
@@ -176,6 +184,32 @@ namespace osu.Game.Tests.Beatmaps
[JsonProperty]
public List Mappings = new List();
}
+
+ private class ConversionWorkingBeatmap : WorkingBeatmap
+ {
+ public Action, IBeatmapConverter> ConversionGenerated;
+
+ private readonly IBeatmap beatmap;
+
+ public ConversionWorkingBeatmap(IBeatmap beatmap)
+ : base(beatmap.BeatmapInfo, null)
+ {
+ this.beatmap = beatmap;
+ }
+
+ protected override IBeatmap GetBeatmap() => beatmap;
+
+ protected override Texture GetBackground() => throw new NotImplementedException();
+
+ protected override Track GetTrack() => throw new NotImplementedException();
+
+ protected override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
+ {
+ var converter = base.CreateBeatmapConverter(beatmap, ruleset);
+ converter.ObjectConverted += (orig, converted) => ConversionGenerated?.Invoke(orig, converted, converter);
+ return converter;
+ }
+ }
}
public abstract class BeatmapConversionTest : BeatmapConversionTest, TConvertValue>
diff --git a/osu.Game.Tests/Visual/UserInterface/OsuGridTestScene.cs b/osu.Game/Tests/Visual/OsuGridTestScene.cs
similarity index 97%
rename from osu.Game.Tests/Visual/UserInterface/OsuGridTestScene.cs
rename to osu.Game/Tests/Visual/OsuGridTestScene.cs
index 096ac951de..c09f4d6218 100644
--- a/osu.Game.Tests/Visual/UserInterface/OsuGridTestScene.cs
+++ b/osu.Game/Tests/Visual/OsuGridTestScene.cs
@@ -5,7 +5,7 @@ using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-namespace osu.Game.Tests.Visual.UserInterface
+namespace osu.Game.Tests.Visual
{
///
/// An abstract test case which exposes small cells arranged in a grid.
diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs
index 9b3c15aa91..27d72f3950 100644
--- a/osu.Game/Tests/Visual/OsuTestScene.cs
+++ b/osu.Game/Tests/Visual/OsuTestScene.cs
@@ -15,6 +15,7 @@ using osu.Framework.Platform;
using osu.Framework.Testing;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
+using osu.Game.Database;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Tests.Beatmaps;
@@ -43,6 +44,9 @@ namespace osu.Game.Tests.Visual
private readonly Lazy localStorage;
protected Storage LocalStorage => localStorage.Value;
+ private readonly Lazy contextFactory;
+ protected DatabaseContextFactory ContextFactory => contextFactory.Value;
+
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
// This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures
@@ -59,6 +63,14 @@ namespace osu.Game.Tests.Visual
protected OsuTestScene()
{
localStorage = new Lazy(() => new NativeStorage($"{GetType().Name}-{Guid.NewGuid()}"));
+ contextFactory = new Lazy(() =>
+ {
+ var factory = new DatabaseContextFactory(LocalStorage);
+ factory.ResetDatabase();
+ using (var usage = factory.Get())
+ usage.Migrate();
+ return factory;
+ });
}
[Resolved]
@@ -85,6 +97,9 @@ namespace osu.Game.Tests.Visual
if (beatmap?.Value.TrackLoaded == true)
beatmap.Value.Track.Stop();
+ if (contextFactory.IsValueCreated)
+ contextFactory.Value.ResetDatabase();
+
if (localStorage.IsValueCreated)
{
try
diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs
index df41e194b0..a5f3578711 100644
--- a/osu.Game/Users/User.cs
+++ b/osu.Game/Users/User.cs
@@ -118,7 +118,7 @@ namespace osu.Game.Users
public int PostCount;
[JsonProperty(@"follower_count")]
- public int[] FollowerCount;
+ public int FollowerCount;
[JsonProperty]
private string[] playstyle
@@ -159,7 +159,10 @@ namespace osu.Game.Users
}
[JsonProperty(@"rankHistory")]
- public RankHistoryData RankHistory;
+ private RankHistoryData rankHistory
+ {
+ set => Statistics.RankHistory = value;
+ }
[JsonProperty("badges")]
public Badge[] Badges;
@@ -184,6 +187,7 @@ namespace osu.Game.Users
public static readonly User SYSTEM_USER = new User
{
Username = "system",
+ Colour = @"9c0101",
Id = 0
};
diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs
index 7afbef01c5..032ec2e05f 100644
--- a/osu.Game/Users/UserStatistics.cs
+++ b/osu.Game/Users/UserStatistics.cs
@@ -4,6 +4,7 @@
using System;
using Newtonsoft.Json;
using osu.Game.Scoring;
+using static osu.Game.Users.User;
namespace osu.Game.Users
{
@@ -113,5 +114,7 @@ namespace osu.Game.Users
[JsonProperty(@"country")]
public int? Country;
}
+
+ public RankHistoryData RankHistory;
}
}
diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs
index 7f4faa60ae..16178e63bd 100644
--- a/osu.Game/Utils/RavenLogger.cs
+++ b/osu.Game/Utils/RavenLogger.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Net;
using System.Threading.Tasks;
using osu.Framework.Logging;
using SharpRaven;
@@ -36,31 +37,50 @@ namespace osu.Game.Utils
if (exception != null)
{
- if (exception is IOException ioe)
- {
- // disk full exceptions, see https://stackoverflow.com/a/9294382
- const int hr_error_handle_disk_full = unchecked((int)0x80070027);
- const int hr_error_disk_full = unchecked((int)0x80070070);
-
- if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full)
- return;
- }
+ if (!shouldSubmitException(exception))
+ return;
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.
if (lastException != null &&
lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace))
- {
return;
- }
lastException = exception;
- queuePendingTask(raven.CaptureAsync(new SentryEvent(exception)));
+ queuePendingTask(raven.CaptureAsync(new SentryEvent(exception) { Message = entry.Message }));
}
else
raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message });
};
}
+ private bool shouldSubmitException(Exception exception)
+ {
+ switch (exception)
+ {
+ case IOException ioe:
+ // disk full exceptions, see https://stackoverflow.com/a/9294382
+ const int hr_error_handle_disk_full = unchecked((int)0x80070027);
+ const int hr_error_disk_full = unchecked((int)0x80070070);
+
+ if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full)
+ return false;
+
+ break;
+
+ case WebException we:
+ switch (we.Status)
+ {
+ // more statuses may need to be blocked as we come across them.
+ case WebExceptionStatus.Timeout:
+ return false;
+ }
+
+ break;
+ }
+
+ return true;
+ }
+
private void queuePendingTask(Task task)
{
lock (tasks) tasks.Add(task);
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 0b2baa982b..1dd19ac7ed 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -11,11 +11,11 @@
-
-
+
+
-
-
+
+
diff --git a/osu.iOS.props b/osu.iOS.props
index 55d1afa645..1c3faeed39 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -104,9 +104,9 @@
-
-
-
+
+
+