diff --git a/osu.Android.props b/osu.Android.props
index 7b22b76e0e..98f9bf1a42 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -11,7 +11,7 @@
Off
True
Xamarin.Android.Net.AndroidClientHandler
- v8.1
+ v9.0
false
@@ -63,6 +63,6 @@
-
+
diff --git a/osu.Android/Properties/AndroidManifest.xml b/osu.Android/Properties/AndroidManifest.xml
index 326d32f7ab..acd21f9587 100644
--- a/osu.Android/Properties/AndroidManifest.xml
+++ b/osu.Android/Properties/AndroidManifest.xml
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/osu.Android/osu.Android.csproj b/osu.Android/osu.Android.csproj
index 42a3185cd1..ac3905a372 100644
--- a/osu.Android/osu.Android.csproj
+++ b/osu.Android/osu.Android.csproj
@@ -14,6 +14,11 @@
Properties\AndroidManifest.xml
armeabi-v7a;x86;arm64-v8a
+
+ cjk;mideast;other;rare;west
+ d8
+ r8
+
diff --git a/osu.Game.Rulesets.Catch.Tests.Android/Properties/AndroidManifest.xml b/osu.Game.Rulesets.Catch.Tests.Android/Properties/AndroidManifest.xml
index b04b0718f5..db95e18f13 100644
--- a/osu.Game.Rulesets.Catch.Tests.Android/Properties/AndroidManifest.xml
+++ b/osu.Game.Rulesets.Catch.Tests.Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Catch.Tests.iOS/Application.cs b/osu.Game.Rulesets.Catch.Tests.iOS/Application.cs
index 44817c1304..beca477943 100644
--- a/osu.Game.Rulesets.Catch.Tests.iOS/Application.cs
+++ b/osu.Game.Rulesets.Catch.Tests.iOS/Application.cs
@@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Catch.Tests.iOS
{
public static void Main(string[] args)
{
- UIApplication.Main(args, null, "AppDelegate");
+ UIApplication.Main(args, "GameUIApplication", "AppDelegate");
}
}
}
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 265ecb7688..9acf47a67c 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
@@ -2,7 +2,7 @@
-
+
diff --git a/osu.Game.Rulesets.Mania.Tests.Android/Properties/AndroidManifest.xml b/osu.Game.Rulesets.Mania.Tests.Android/Properties/AndroidManifest.xml
index c315581606..e6728c801d 100644
--- a/osu.Game.Rulesets.Mania.Tests.Android/Properties/AndroidManifest.xml
+++ b/osu.Game.Rulesets.Mania.Tests.Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Mania.Tests.iOS/Application.cs b/osu.Game.Rulesets.Mania.Tests.iOS/Application.cs
index d47ac4643f..0362402320 100644
--- a/osu.Game.Rulesets.Mania.Tests.iOS/Application.cs
+++ b/osu.Game.Rulesets.Mania.Tests.iOS/Application.cs
@@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Mania.Tests.iOS
{
public static void Main(string[] args)
{
- UIApplication.Main(args, null, "AppDelegate");
+ UIApplication.Main(args, "GameUIApplication", "AppDelegate");
}
}
}
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 dbade6ff8d..df5131dd8b 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
@@ -2,7 +2,7 @@
-
+
diff --git a/osu.Game.Rulesets.Osu.Tests.Android/Properties/AndroidManifest.xml b/osu.Game.Rulesets.Osu.Tests.Android/Properties/AndroidManifest.xml
index dac9c19477..aad907b241 100644
--- a/osu.Game.Rulesets.Osu.Tests.Android/Properties/AndroidManifest.xml
+++ b/osu.Game.Rulesets.Osu.Tests.Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Osu.Tests.iOS/Application.cs b/osu.Game.Rulesets.Osu.Tests.iOS/Application.cs
index 7a0797a909..3718264a42 100644
--- a/osu.Game.Rulesets.Osu.Tests.iOS/Application.cs
+++ b/osu.Game.Rulesets.Osu.Tests.iOS/Application.cs
@@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Osu.Tests.iOS
{
public static void Main(string[] args)
{
- UIApplication.Main(args, null, "AppDelegate");
+ UIApplication.Main(args, "GameUIApplication", "AppDelegate");
}
}
}
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 a99a93c3e9..bb3e5a66f3 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
@@ -2,7 +2,7 @@
-
+
diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs
index bc5d02258f..5625028707 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs
@@ -13,13 +13,11 @@ using static osu.Game.Input.Handlers.ReplayInputHandler;
namespace osu.Game.Rulesets.Osu.Mods
{
- public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByPlayfield, IApplicableToDrawableRuleset
+ public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset
{
public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things.";
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray();
- public bool AllowFail => false;
-
public void Update(Playfield playfield)
{
bool requiresHold = false;
diff --git a/osu.Game.Rulesets.Taiko.Tests.Android/Properties/AndroidManifest.xml b/osu.Game.Rulesets.Taiko.Tests.Android/Properties/AndroidManifest.xml
index f731042a4c..cd4b74aa16 100644
--- a/osu.Game.Rulesets.Taiko.Tests.Android/Properties/AndroidManifest.xml
+++ b/osu.Game.Rulesets.Taiko.Tests.Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/osu.Game.Rulesets.Taiko.Tests.iOS/Application.cs b/osu.Game.Rulesets.Taiko.Tests.iOS/Application.cs
index 6613e9e2b4..330cb42901 100644
--- a/osu.Game.Rulesets.Taiko.Tests.iOS/Application.cs
+++ b/osu.Game.Rulesets.Taiko.Tests.iOS/Application.cs
@@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.iOS
{
public static void Main(string[] args)
{
- UIApplication.Main(args, null, "AppDelegate");
+ UIApplication.Main(args, "GameUIApplication", "AppDelegate");
}
}
}
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 216cc0222f..5510c3a9d9 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
@@ -2,7 +2,7 @@
-
+
diff --git a/osu.Game.Tests.Android/Properties/AndroidManifest.xml b/osu.Game.Tests.Android/Properties/AndroidManifest.xml
index 146f96c2a3..bb996dc5ca 100644
--- a/osu.Game.Tests.Android/Properties/AndroidManifest.xml
+++ b/osu.Game.Tests.Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/osu.Game.Tests.iOS/Application.cs b/osu.Game.Tests.iOS/Application.cs
index a23fe4e129..d96a3e27a4 100644
--- a/osu.Game.Tests.iOS/Application.cs
+++ b/osu.Game.Tests.iOS/Application.cs
@@ -9,7 +9,7 @@ namespace osu.Game.Tests.iOS
{
public static void Main(string[] args)
{
- UIApplication.Main(args, null, "AppDelegate");
+ UIApplication.Main(args, "GameUIApplication", "AppDelegate");
}
}
}
diff --git a/osu.Game.Tests/NonVisual/FramedReplayinputHandlerTest.cs b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs
similarity index 94%
rename from osu.Game.Tests/NonVisual/FramedReplayinputHandlerTest.cs
rename to osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.cs
index 73387fa5ab..18cbd4e7c5 100644
--- a/osu.Game.Tests/NonVisual/FramedReplayinputHandlerTest.cs
+++ b/osu.Game.Tests/NonVisual/FramedReplayInputHandlerTest.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 NUnit.Framework;
using osu.Game.Replays;
@@ -9,7 +10,7 @@ using osu.Game.Rulesets.Replays;
namespace osu.Game.Tests.NonVisual
{
[TestFixture]
- public class FramedReplayinputHandlerTest
+ public class FramedReplayInputHandlerTest
{
private Replay replay;
private TestInputHandler handler;
@@ -160,10 +161,7 @@ namespace osu.Game.Tests.NonVisual
[Test]
public void TestRewindInsideImportantSection()
{
- // fast forward to important section
- while (handler.SetFrameFromTime(3000) != null)
- {
- }
+ fastForwardToPoint(3000);
setTime(4000, 4000);
confirmCurrentFrame(4);
@@ -205,10 +203,7 @@ namespace osu.Game.Tests.NonVisual
[Test]
public void TestRewindOutOfImportantSection()
{
- // fast forward to important section
- while (handler.SetFrameFromTime(3500) != null)
- {
- }
+ fastForwardToPoint(3500);
confirmCurrentFrame(3);
confirmNextFrame(4);
@@ -227,6 +222,15 @@ namespace osu.Game.Tests.NonVisual
confirmNextFrame(2);
}
+ private void fastForwardToPoint(double destination)
+ {
+ for (int i = 0; i < 1000; i++)
+ if (handler.SetFrameFromTime(destination) == null)
+ return;
+
+ throw new TimeoutException("Seek was never fulfilled");
+ }
+
private void setTime(double set, double? expect)
{
Assert.AreEqual(expect, handler.SetFrameFromTime(set));
@@ -274,6 +278,7 @@ namespace osu.Game.Tests.NonVisual
public TestInputHandler(Replay replay)
: base(replay)
{
+ FrameAccuratePlayback = true;
}
protected override double AllowedImportantTimeSpan => 1000;
diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs
index daee3a520c..ab519360ac 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs
@@ -9,6 +9,7 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
+using osu.Framework.MathUtils;
using osu.Framework.Screens;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
@@ -16,12 +17,13 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens;
using osu.Game.Screens.Play;
+using osu.Game.Screens.Play.PlayerSettings;
namespace osu.Game.Tests.Visual.Gameplay
{
public class TestScenePlayerLoader : ManualInputManagerTestScene
{
- private PlayerLoader loader;
+ private TestPlayerLoader loader;
private OsuScreenStack stack;
[SetUp]
@@ -31,19 +33,29 @@ namespace osu.Game.Tests.Visual.Gameplay
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
});
+ [Test]
+ public void TestBlockLoadViaMouseMovement()
+ {
+ AddStep("load dummy beatmap", () => stack.Push(loader = new TestPlayerLoader(() => new TestPlayer(false, false))));
+ AddUntilStep("wait for current", () => loader.IsCurrentScreen());
+ AddRepeatStep("move mouse", () => InputManager.MoveMouseTo(loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft + (loader.VisualSettings.ScreenSpaceDrawQuad.BottomRight - loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft) * RNG.NextSingle()), 20);
+ AddAssert("loader still active", () => loader.IsCurrentScreen());
+ AddUntilStep("loads after idle", () => !loader.IsCurrentScreen());
+ }
+
[Test]
public void TestLoadContinuation()
{
Player player = null;
SlowLoadPlayer slowPlayer = null;
- AddStep("load dummy beatmap", () => stack.Push(loader = new PlayerLoader(() => player = new TestPlayer(false, false))));
+ AddStep("load dummy beatmap", () => stack.Push(loader = new TestPlayerLoader(() => player = new TestPlayer(false, false))));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
AddUntilStep("wait for player to be current", () => player.IsCurrentScreen());
AddStep("load slow dummy beatmap", () =>
{
- stack.Push(loader = new PlayerLoader(() => slowPlayer = new SlowLoadPlayer(false, false)));
+ stack.Push(loader = new TestPlayerLoader(() => slowPlayer = new SlowLoadPlayer(false, false)));
Scheduler.AddDelayed(() => slowPlayer.AllowLoad.Set(), 5000);
});
@@ -61,7 +73,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("load player", () =>
{
Mods.Value = new[] { gameMod = new TestMod() };
- stack.Push(loader = new PlayerLoader(() => player = new TestPlayer()));
+ stack.Push(loader = new TestPlayerLoader(() => player = new TestPlayer()));
});
AddUntilStep("wait for loader to become current", () => loader.IsCurrentScreen());
@@ -85,6 +97,16 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("player mods applied", () => playerMod2.Applied);
}
+ private class TestPlayerLoader : PlayerLoader
+ {
+ public new VisualSettings VisualSettings => base.VisualSettings;
+
+ public TestPlayerLoader(Func createPlayer)
+ : base(createPlayer)
+ {
+ }
+ }
+
private class TestMod : Mod, IApplicableToScoreProcessor
{
public override string Name => string.Empty;
diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs
index a9c44c9020..daee419b52 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs
@@ -108,6 +108,7 @@ namespace osu.Game.Tests.Visual.Online
{
StarDifficulty = 9.99,
Version = @"TEST",
+ Length = 456000,
Ruleset = maniaRuleset,
BaseDifficulty = new BeatmapDifficulty
{
@@ -118,7 +119,6 @@ namespace osu.Game.Tests.Visual.Online
},
OnlineInfo = new BeatmapOnlineInfo
{
- Length = 456000,
CircleCount = 111,
SliderCount = 12,
PlayCount = 222,
@@ -181,6 +181,7 @@ namespace osu.Game.Tests.Visual.Online
{
StarDifficulty = 5.67,
Version = @"ANOTHER TEST",
+ Length = 123000,
Ruleset = taikoRuleset,
BaseDifficulty = new BeatmapDifficulty
{
@@ -191,7 +192,6 @@ namespace osu.Game.Tests.Visual.Online
},
OnlineInfo = new BeatmapOnlineInfo
{
- Length = 123000,
CircleCount = 123,
SliderCount = 45,
PlayCount = 567,
diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs
index 0655611230..cf8bac7642 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs
@@ -24,6 +24,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(ChangelogListing),
typeof(ChangelogSingleBuild),
typeof(ChangelogBuild),
+ typeof(Comments),
};
protected override void LoadComplete()
diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs
index 364c986723..16e47c5df9 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs
@@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual.Online
});
channelTabControl.OnRequestLeave += channel => channelTabControl.RemoveChannel(channel);
- channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.NewValue.ToString();
+ channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.NewValue;
AddStep("Add random private channel", addRandomPrivateChannel);
AddAssert("There is only one channels", () => channelTabControl.Items.Count() == 2);
diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs
index 06414af865..b26de1984a 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs
@@ -3,19 +3,18 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils;
-using osu.Game.Graphics;
+using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.BeatmapSet.Scores;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Users;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Online
{
@@ -30,11 +29,9 @@ namespace osu.Game.Tests.Visual.Online
typeof(ScoreTableRowBackground),
};
- private readonly Box background;
-
public TestSceneScoresContainer()
{
- ScoresContainer scoresContainer;
+ TestScoresContainer scoresContainer;
Child = new Container
{
@@ -44,108 +41,137 @@ namespace osu.Game.Tests.Visual.Online
Width = 0.8f,
Children = new Drawable[]
{
- background = new Box { RelativeSizeAxes = Axes.Both },
- scoresContainer = new ScoresContainer(),
+ new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = Color4.Black,
+ },
+ scoresContainer = new TestScoresContainer(),
}
};
- var scores = new List
+ var allScores = new APILegacyScores
{
- new ScoreInfo
+ Scores = new List
{
- User = new User
+ new APILegacyScoreInfo
{
- Id = 6602580,
- Username = @"waaiiru",
- Country = new Country
+ User = new User
{
- FullName = @"Spain",
- FlagName = @"ES",
+ Id = 6602580,
+ Username = @"waaiiru",
+ Country = new Country
+ {
+ FullName = @"Spain",
+ FlagName = @"ES",
+ },
},
- },
- Mods = new Mod[]
- {
- new OsuModDoubleTime(),
- new OsuModHidden(),
- new OsuModFlashlight(),
- new OsuModHardRock(),
- },
- Rank = ScoreRank.XH,
- PP = 200,
- MaxCombo = 1234,
- TotalScore = 1234567890,
- Accuracy = 1,
- },
- new ScoreInfo
- {
- User = new User
- {
- Id = 4608074,
- Username = @"Skycries",
- Country = new Country
+ Mods = new Mod[]
{
- FullName = @"Brazil",
- FlagName = @"BR",
+ new OsuModDoubleTime(),
+ new OsuModHidden(),
+ new OsuModFlashlight(),
+ new OsuModHardRock(),
},
+ Rank = ScoreRank.XH,
+ PP = 200,
+ MaxCombo = 1234,
+ TotalScore = 1234567890,
+ Accuracy = 1,
},
- Mods = new Mod[]
+ new APILegacyScoreInfo
{
- new OsuModDoubleTime(),
- new OsuModHidden(),
- new OsuModFlashlight(),
- },
- Rank = ScoreRank.S,
- PP = 190,
- MaxCombo = 1234,
- TotalScore = 1234789,
- Accuracy = 0.9997,
- },
- new ScoreInfo
- {
- User = new User
- {
- Id = 1014222,
- Username = @"eLy",
- Country = new Country
+ User = new User
{
- FullName = @"Japan",
- FlagName = @"JP",
+ Id = 4608074,
+ Username = @"Skycries",
+ Country = new Country
+ {
+ FullName = @"Brazil",
+ FlagName = @"BR",
+ },
},
- },
- Mods = new Mod[]
- {
- new OsuModDoubleTime(),
- new OsuModHidden(),
- },
- Rank = ScoreRank.B,
- PP = 180,
- MaxCombo = 1234,
- TotalScore = 12345678,
- Accuracy = 0.9854,
- },
- new ScoreInfo
- {
- User = new User
- {
- Id = 1541390,
- Username = @"Toukai",
- Country = new Country
+ Mods = new Mod[]
{
- FullName = @"Canada",
- FlagName = @"CA",
+ new OsuModDoubleTime(),
+ new OsuModHidden(),
+ new OsuModFlashlight(),
},
+ Rank = ScoreRank.S,
+ PP = 190,
+ MaxCombo = 1234,
+ TotalScore = 1234789,
+ Accuracy = 0.9997,
},
- Mods = new Mod[]
+ new APILegacyScoreInfo
{
- new OsuModDoubleTime(),
+ User = new User
+ {
+ Id = 1014222,
+ Username = @"eLy",
+ Country = new Country
+ {
+ FullName = @"Japan",
+ FlagName = @"JP",
+ },
+ },
+ Mods = new Mod[]
+ {
+ new OsuModDoubleTime(),
+ new OsuModHidden(),
+ },
+ Rank = ScoreRank.B,
+ PP = 180,
+ MaxCombo = 1234,
+ TotalScore = 12345678,
+ Accuracy = 0.9854,
},
- Rank = ScoreRank.C,
- PP = 170,
- MaxCombo = 1234,
- TotalScore = 1234567,
- Accuracy = 0.8765,
- },
- new ScoreInfo
+ new APILegacyScoreInfo
+ {
+ User = new User
+ {
+ Id = 1541390,
+ Username = @"Toukai",
+ Country = new Country
+ {
+ FullName = @"Canada",
+ FlagName = @"CA",
+ },
+ },
+ Mods = new Mod[]
+ {
+ new OsuModDoubleTime(),
+ },
+ Rank = ScoreRank.C,
+ PP = 170,
+ MaxCombo = 1234,
+ TotalScore = 1234567,
+ Accuracy = 0.8765,
+ },
+ new APILegacyScoreInfo
+ {
+ User = new User
+ {
+ Id = 7151382,
+ Username = @"Mayuri Hana",
+ Country = new Country
+ {
+ FullName = @"Thailand",
+ FlagName = @"TH",
+ },
+ },
+ Rank = ScoreRank.D,
+ PP = 160,
+ MaxCombo = 1234,
+ TotalScore = 123456,
+ Accuracy = 0.6543,
+ },
+ }
+ };
+
+ var myBestScore = new APILegacyUserTopScoreInfo
+ {
+ Score = new APILegacyScoreInfo
{
User = new User
{
@@ -163,9 +189,42 @@ namespace osu.Game.Tests.Visual.Online
TotalScore = 123456,
Accuracy = 0.6543,
},
+ Position = 1337,
};
- foreach (var s in scores)
+ var oneScore = new APILegacyScores
+ {
+ Scores = new List
+ {
+ new APILegacyScoreInfo
+ {
+ User = new User
+ {
+ Id = 6602580,
+ Username = @"waaiiru",
+ Country = new Country
+ {
+ FullName = @"Spain",
+ FlagName = @"ES",
+ },
+ },
+ Mods = new Mod[]
+ {
+ new OsuModDoubleTime(),
+ new OsuModHidden(),
+ new OsuModFlashlight(),
+ new OsuModHardRock(),
+ },
+ Rank = ScoreRank.XH,
+ PP = 200,
+ MaxCombo = 1234,
+ TotalScore = 1234567890,
+ Accuracy = 1,
+ }
+ }
+ };
+
+ foreach (var s in allScores.Scores)
{
s.Statistics.Add(HitResult.Great, RNG.Next(2000));
s.Statistics.Add(HitResult.Good, RNG.Next(2000));
@@ -173,15 +232,26 @@ namespace osu.Game.Tests.Visual.Online
s.Statistics.Add(HitResult.Miss, RNG.Next(2000));
}
- AddStep("Load all scores", () => scoresContainer.Scores = scores);
+ AddStep("Load all scores", () =>
+ {
+ allScores.UserScore = null;
+ scoresContainer.Scores = allScores;
+ });
AddStep("Load null scores", () => scoresContainer.Scores = null);
- AddStep("Load only one score", () => scoresContainer.Scores = new[] { scores.First() });
+ AddStep("Load only one score", () => scoresContainer.Scores = oneScore);
+ AddStep("Load scores with my best", () =>
+ {
+ allScores.UserScore = myBestScore;
+ scoresContainer.Scores = allScores;
+ });
}
- [BackgroundDependencyLoader]
- private void load(OsuColour colours)
+ private class TestScoresContainer : ScoresContainer
{
- background.Colour = colours.Gray2;
+ public new APILegacyScores Scores
+ {
+ set => base.Scores = value;
+ }
}
}
}
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs
index 157e572606..8e358a77db 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs
@@ -4,12 +4,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
-using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Online.Leaderboards;
-using osu.Game.Rulesets;
using osu.Game.Scoring;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Users;
@@ -27,8 +24,6 @@ namespace osu.Game.Tests.Visual.SongSelect
typeof(RetrievalFailurePlaceholder),
};
- private RulesetStore rulesets;
-
private readonly FailableLeaderboard leaderboard;
public TestSceneLeaderboard()
@@ -47,13 +42,8 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep(@"No supporter", () => leaderboard.SetRetrievalState(PlaceholderState.NotSupporter));
AddStep(@"Not logged in", () => leaderboard.SetRetrievalState(PlaceholderState.NotLoggedIn));
AddStep(@"Unavailable", () => leaderboard.SetRetrievalState(PlaceholderState.Unavailable));
- AddStep(@"Real beatmap", realBeatmap);
- }
-
- [BackgroundDependencyLoader]
- private void load(RulesetStore rulesets)
- {
- this.rulesets = rulesets;
+ foreach (BeatmapSetOnlineStatus status in Enum.GetValues(typeof(BeatmapSetOnlineStatus)))
+ AddStep($"{status} beatmap", () => showBeatmapWithStatus(status));
}
private void newScores()
@@ -245,34 +235,12 @@ namespace osu.Game.Tests.Visual.SongSelect
leaderboard.Scores = scores;
}
- private void realBeatmap()
+ private void showBeatmapWithStatus(BeatmapSetOnlineStatus status)
{
leaderboard.Beatmap = new BeatmapInfo
{
- StarDifficulty = 1.36,
- Version = @"BASIC",
OnlineBeatmapID = 1113057,
- Ruleset = rulesets.GetRuleset(0),
- BaseDifficulty = new BeatmapDifficulty
- {
- CircleSize = 4,
- DrainRate = 6.5f,
- OverallDifficulty = 6.5f,
- ApproachRate = 5,
- },
- OnlineInfo = new BeatmapOnlineInfo
- {
- Length = 115000,
- CircleCount = 265,
- SliderCount = 71,
- PlayCount = 47906,
- PassCount = 19899,
- },
- Metrics = new BeatmapMetrics
- {
- Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
- Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
- },
+ Status = status,
};
}
diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
index 962e0fb362..f3255814f2 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
@@ -133,6 +133,9 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; });
AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; });
+ AddStep(@"Sort by DateAdded", delegate { songSelect.FilterControl.Sort = SortMode.DateAdded; });
+ AddStep(@"Sort by BPM", delegate { songSelect.FilterControl.Sort = SortMode.BPM; });
+ AddStep(@"Sort by Length", delegate { songSelect.FilterControl.Sort = SortMode.Length; });
AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; });
}
@@ -265,16 +268,21 @@ namespace osu.Game.Tests.Visual.SongSelect
{
int beatmapId = setId * 10 + i;
+ int length = RNG.Next(30000, 200000);
+ double bpm = RNG.NextSingle(80, 200);
+
beatmaps.Add(new BeatmapInfo
{
Ruleset = getRuleset(),
OnlineBeatmapID = beatmapId,
Path = "normal.osu",
- Version = $"{beatmapId}",
+ Version = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
+ Length = length,
+ BPM = bpm,
BaseDifficulty = new BeatmapDifficulty
{
OverallDifficulty = 3.5f,
- }
+ },
});
}
@@ -286,10 +294,11 @@ namespace osu.Game.Tests.Visual.SongSelect
{
// Create random metadata, then we can check if sorting works based on these
Artist = "Some Artist " + RNG.Next(0, 9),
- Title = $"Some Song (set id {setId})",
+ Title = $"Some Song (set id {setId}, max bpm {beatmaps.Max(b => b.BPM):0.#})",
AuthorString = "Some Guy " + RNG.Next(0, 9),
},
- Beatmaps = beatmaps
+ Beatmaps = beatmaps,
+ DateAdded = DateTimeOffset.UtcNow,
};
}
}
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs
index 867b3130c9..38a9af05d8 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs
@@ -14,8 +14,6 @@ namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneBackButton : OsuTestScene
{
- private readonly BackButton button;
-
public override IReadOnlyList RequiredTypes => new[]
{
typeof(TwoLayerButton)
@@ -23,6 +21,8 @@ namespace osu.Game.Tests.Visual.UserInterface
public TestSceneBackButton()
{
+ BackButton button;
+
Child = new Container
{
Anchor = Anchor.Centre,
@@ -40,11 +40,12 @@ namespace osu.Game.Tests.Visual.UserInterface
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
- Action = () => button.Hide(),
}
}
};
+ button.Action = () => button.Hide();
+
AddStep("show button", () => button.Show());
AddStep("hide button", () => button.Hide());
}
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs
index c8cc864089..f0e1c38525 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs
@@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Shapes;
using osu.Game.Screens.Menu;
+using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.UserInterface
@@ -23,11 +24,12 @@ namespace osu.Game.Tests.Visual.UserInterface
typeof(Button)
};
- public TestSceneButtonSystem()
- {
- OsuLogo logo;
- ButtonSystem buttons;
+ private OsuLogo logo;
+ private ButtonSystem buttons;
+ [SetUp]
+ public void SetUp() => Schedule(() =>
+ {
Children = new Drawable[]
{
new Box
@@ -36,13 +38,47 @@ namespace osu.Game.Tests.Visual.UserInterface
RelativeSizeAxes = Axes.Both,
},
buttons = new ButtonSystem(),
- logo = new OsuLogo { RelativePositionAxes = Axes.Both }
+ logo = new OsuLogo
+ {
+ RelativePositionAxes = Axes.Both,
+ Position = new Vector2(0.5f)
+ }
};
buttons.SetOsuLogo(logo);
+ });
+ [Test]
+ public void TestAllStates()
+ {
foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType().Skip(1))
AddStep($"State to {s}", () => buttons.State = s);
+
+ AddStep("Enter mode", performEnterMode);
+
+ AddStep("Return to menu", () =>
+ {
+ buttons.State = ButtonSystemState.Play;
+ buttons.FadeIn(MainMenu.FADE_IN_DURATION, Easing.OutQuint);
+ buttons.MoveTo(new Vector2(0), MainMenu.FADE_IN_DURATION, Easing.OutQuint);
+ logo.FadeColour(Color4.White, 100, Easing.OutQuint);
+ logo.FadeIn(100, Easing.OutQuint);
+ });
+ }
+
+ [Test]
+ public void TestSmoothExit()
+ {
+ AddStep("Enter mode", performEnterMode);
+ }
+
+ private void performEnterMode()
+ {
+ buttons.State = ButtonSystemState.EnteringMode;
+ buttons.FadeOut(MainMenu.FADE_OUT_DURATION, Easing.InSine);
+ buttons.MoveTo(new Vector2(-800, 0), MainMenu.FADE_OUT_DURATION, Easing.InSine);
+ logo.FadeOut(300, Easing.InSine)
+ .ScaleTo(0.2f, 300, Easing.InSine);
}
}
}
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs
index 9c83fdf96c..0cb8683d72 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs
@@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.UserInterface
},
};
- breadcrumbs.Current.ValueChanged += screen => titleText.Text = $"Changed to {screen.NewValue.ToString()}";
+ breadcrumbs.Current.ValueChanged += screen => titleText.Text = $"Changed to {screen.NewValue}";
breadcrumbs.Current.TriggerChange();
waitForCurrent();
diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj
index 11d70ee7be..659f5415c3 100644
--- a/osu.Game.Tests/osu.Game.Tests.csproj
+++ b/osu.Game.Tests/osu.Game.Tests.csproj
@@ -3,7 +3,7 @@
-
+
diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
index 1c169184fb..dad2fe0877 100644
--- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
+++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
@@ -5,9 +5,9 @@
-
+
-
+
WinExe
diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs
index c07882ddd0..7005c068ae 100644
--- a/osu.Game.Tournament/Components/SongBar.cs
+++ b/osu.Game.Tournament/Components/SongBar.cs
@@ -159,7 +159,7 @@ namespace osu.Game.Tournament.Components
}
var bpm = beatmap.BeatmapSet.OnlineInfo.BPM;
- var length = beatmap.OnlineInfo.Length;
+ var length = beatmap.Length;
string hardRockExtra = "";
string srExtra = "";
@@ -180,7 +180,7 @@ namespace osu.Game.Tournament.Components
panelContents.Children = new Drawable[]
{
- new DiffPiece(("Length", TimeSpan.FromSeconds(length).ToString(@"mm\:ss")))
+ new DiffPiece(("Length", TimeSpan.FromMilliseconds(length).ToString(@"mm\:ss")))
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.BottomLeft,
diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs
index 3c082bb71e..8042f6b4b9 100644
--- a/osu.Game/Beatmaps/BeatmapInfo.cs
+++ b/osu.Game/Beatmaps/BeatmapInfo.cs
@@ -51,6 +51,16 @@ namespace osu.Game.Beatmaps
[NotMapped]
public BeatmapOnlineInfo OnlineInfo { get; set; }
+ ///
+ /// The playable length in milliseconds of this beatmap.
+ ///
+ public double Length { get; set; }
+
+ ///
+ /// The most common BPM of this beatmap.
+ ///
+ public double BPM { get; set; }
+
public string Path { get; set; }
[JsonProperty("file_sha2")]
diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs
index 860c7fc0fa..65efcaa949 100644
--- a/osu.Game/Beatmaps/BeatmapManager.cs
+++ b/osu.Game/Beatmaps/BeatmapManager.cs
@@ -23,6 +23,7 @@ using osu.Game.IO.Archives;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Rulesets;
+using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Beatmaps
{
@@ -82,6 +83,8 @@ namespace osu.Game.Beatmaps
protected override ArchiveDownloadRequest CreateDownloadRequest(BeatmapSetInfo set, bool minimiseDownloadSize) =>
new DownloadBeatmapSetRequest(set, minimiseDownloadSize);
+ protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == ".osz";
+
protected override Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
{
if (archive != null)
@@ -176,20 +179,22 @@ namespace osu.Game.Beatmaps
if (beatmapInfo?.BeatmapSet == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
return DefaultBeatmap;
- var cached = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
+ lock (workingCache)
+ {
+ var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
- if (cached != null)
- return cached;
+ if (working == null)
+ {
+ if (beatmapInfo.Metadata == null)
+ beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
- if (beatmapInfo.Metadata == null)
- beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
+ workingCache.Add(working = new BeatmapManagerWorkingBeatmap(Files.Store,
+ new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager));
+ }
- WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(Files.Store, new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager);
-
- previous?.TransferTo(working);
- workingCache.Add(working);
-
- return working;
+ previous?.TransferTo(working);
+ return working;
+ }
}
///
@@ -297,6 +302,8 @@ namespace osu.Game.Beatmaps
beatmap.BeatmapInfo.Ruleset = ruleset;
// TODO: this should be done in a better place once we actually need to dynamically update it.
beatmap.BeatmapInfo.StarDifficulty = ruleset?.CreateInstance().CreateDifficultyCalculator(new DummyConversionBeatmap(beatmap)).Calculate().StarRating ?? 0;
+ beatmap.BeatmapInfo.Length = calculateLength(beatmap);
+ beatmap.BeatmapInfo.BPM = beatmap.ControlPointInfo.BPMMode;
beatmapInfos.Add(beatmap.BeatmapInfo);
}
@@ -305,6 +312,19 @@ namespace osu.Game.Beatmaps
return beatmapInfos;
}
+ private double calculateLength(IBeatmap b)
+ {
+ if (!b.HitObjects.Any())
+ return 0;
+
+ var lastObject = b.HitObjects.Last();
+
+ double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime;
+ double startTime = b.HitObjects.First().StartTime;
+
+ return endTime - startTime;
+ }
+
///
/// A dummy WorkingBeatmap for the purpose of retrieving a beatmap for star difficulty calculation.
///
diff --git a/osu.Game/Beatmaps/BeatmapOnlineInfo.cs b/osu.Game/Beatmaps/BeatmapOnlineInfo.cs
index faae74db88..bfeacd9bfc 100644
--- a/osu.Game/Beatmaps/BeatmapOnlineInfo.cs
+++ b/osu.Game/Beatmaps/BeatmapOnlineInfo.cs
@@ -8,11 +8,6 @@ namespace osu.Game.Beatmaps
///
public class BeatmapOnlineInfo
{
- ///
- /// The length in milliseconds of this beatmap's song.
- ///
- public double Length { get; set; }
-
///
/// The amount of circles in this beatmap.
///
diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs
index 524ed0ed56..03bc7c7312 100644
--- a/osu.Game/Beatmaps/BeatmapSetInfo.cs
+++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs
@@ -35,8 +35,21 @@ namespace osu.Game.Beatmaps
[NotMapped]
public BeatmapSetMetrics Metrics { get; set; }
+ ///
+ /// The maximum star difficulty of all beatmaps in this set.
+ ///
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0;
+ ///
+ /// The maximum playable length in milliseconds of all beatmaps in this set.
+ ///
+ public double MaxLength => Beatmaps?.Max(b => b.Length) ?? 0;
+
+ ///
+ /// The maximum BPM of all beatmaps in this set.
+ ///
+ public double MaxBPM => Beatmaps?.Max(b => b.BPM) ?? 0;
+
[NotMapped]
public bool DeletePending { get; set; }
diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs
index 1fd3502799..30346a8a96 100644
--- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs
+++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs
@@ -35,15 +35,15 @@ namespace osu.Game.Beatmaps.Drawables
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func createContentFunc, double timeBeforeLoad)
=> new DelayedLoadUnloadWrapper(createContentFunc, timeBeforeLoad, UnloadDelay);
+ protected override double TransformDuration => 400;
+
protected override Drawable CreateDrawable(BeatmapInfo model)
{
- Drawable drawable = getDrawableForModel(model);
-
+ var drawable = getDrawableForModel(model);
drawable.RelativeSizeAxes = Axes.Both;
drawable.Anchor = Anchor.Centre;
drawable.Origin = Anchor.Centre;
drawable.FillMode = FillMode.Fill;
- drawable.OnLoadComplete += d => d.FadeInFromZero(400);
return drawable;
}
diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs
index 795f0b43f7..1da7c7ec1d 100644
--- a/osu.Game/Configuration/OsuConfigManager.cs
+++ b/osu.Game/Configuration/OsuConfigManager.cs
@@ -77,6 +77,7 @@ namespace osu.Game.Configuration
Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
Set(OsuSetting.ShowInterface, true);
+ Set(OsuSetting.ShowHealthDisplayWhenCantFail, true);
Set(OsuSetting.KeyOverlay, false);
Set(OsuSetting.FloatingComments, false);
@@ -131,6 +132,7 @@ namespace osu.Game.Configuration
KeyOverlay,
FloatingComments,
ShowInterface,
+ ShowHealthDisplayWhenCantFail,
MouseDisableButtons,
MouseDisableWheel,
AudioOffset,
diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs
index 01455e7d50..ed65bdc069 100644
--- a/osu.Game/Database/ArchiveModelManager.cs
+++ b/osu.Game/Database/ArchiveModelManager.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;
@@ -114,7 +114,8 @@ namespace osu.Game.Database
lock (imported)
{
- imported.Add(model);
+ if (model != null)
+ imported.Add(model);
current++;
notification.Text = $"Imported {current} of {paths.Length} {HumanisedModelName}s";
@@ -140,7 +141,7 @@ namespace osu.Game.Database
{
notification.CompletionText = imported.Count == 1
? $"Imported {imported.First()}!"
- : $"Imported {current} {HumanisedModelName}s!";
+ : $"Imported {imported.Count} {HumanisedModelName}s!";
if (imported.Count > 0 && PresentImport != null)
{
@@ -176,7 +177,7 @@ namespace osu.Game.Database
// TODO: Add a check to prevent files from storage to be deleted.
try
{
- if (import != null && File.Exists(path))
+ if (import != null && File.Exists(path) && ShouldDeleteArchive(path))
File.Delete(path);
}
catch (Exception e)
@@ -207,7 +208,7 @@ namespace osu.Game.Database
{
model = CreateModel(archive);
- if (model == null) return null;
+ if (model == null) return Task.FromResult(null);
model.Hash = computeHash(archive);
}
@@ -498,6 +499,18 @@ namespace osu.Game.Database
///
protected virtual string ImportFromStablePath => null;
+ ///
+ /// Select paths to import from stable. Default implementation iterates all directories in .
+ ///
+ protected virtual IEnumerable GetStableImportPaths(Storage stableStoage) => stableStoage.GetDirectories(ImportFromStablePath);
+
+ ///
+ /// Whether this specified path should be removed after successful import.
+ ///
+ /// The path for consideration. May be a file or a directory.
+ /// Whether to perform deletion.
+ protected virtual bool ShouldDeleteArchive(string path) => false;
+
///
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
///
@@ -518,7 +531,7 @@ namespace osu.Game.Database
return Task.CompletedTask;
}
- return Task.Run(async () => await Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()));
+ return Task.Run(async () => await Import(GetStableImportPaths(GetStableStorage()).Select(f => stable.GetFullPath(f)).ToArray()));
}
#endregion
diff --git a/osu.Game/Database/OsuDbContext.cs b/osu.Game/Database/OsuDbContext.cs
index 538ec41b3d..ea3318598f 100644
--- a/osu.Game/Database/OsuDbContext.cs
+++ b/osu.Game/Database/OsuDbContext.cs
@@ -41,6 +41,9 @@ namespace osu.Game.Database
{
// required to initialise native SQLite libraries on some platforms.
SQLitePCL.Batteries_V2.Init();
+
+ // https://github.com/aspnet/EntityFrameworkCore/issues/9994#issuecomment-508588678
+ SQLitePCL.raw.sqlite3_config(2 /*SQLITE_CONFIG_MULTITHREAD*/);
}
///
diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
index 869005d05c..8134cfb42d 100644
--- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
@@ -37,6 +37,8 @@ namespace osu.Game.Graphics.UserInterface
text.Colour = AccentColour;
icon.Colour = AccentColour;
}
+
+ updateFade();
}
}
@@ -48,39 +50,6 @@ namespace osu.Game.Graphics.UserInterface
private const float transition_length = 500;
- private void fadeIn()
- {
- box.FadeIn(transition_length, Easing.OutQuint);
- text.FadeColour(Color4.White, transition_length, Easing.OutQuint);
- }
-
- private void fadeOut()
- {
- box.FadeOut(transition_length, Easing.OutQuint);
- text.FadeColour(AccentColour, transition_length, Easing.OutQuint);
- }
-
- protected override bool OnHover(HoverEvent e)
- {
- fadeIn();
- return base.OnHover(e);
- }
-
- protected override void OnHoverLost(HoverLostEvent e)
- {
- if (!Current.Value)
- fadeOut();
-
- base.OnHoverLost(e);
- }
-
- [BackgroundDependencyLoader]
- private void load(OsuColour colours)
- {
- if (accentColour == null)
- AccentColour = colours.Blue;
- }
-
public OsuTabControlCheckbox()
{
AutoSizeAxes = Axes.Both;
@@ -115,19 +84,34 @@ namespace osu.Game.Graphics.UserInterface
}
};
- Current.ValueChanged += selected =>
- {
- if (selected.NewValue)
- {
- fadeIn();
- icon.Icon = FontAwesome.Regular.CheckCircle;
- }
- else
- {
- fadeOut();
- icon.Icon = FontAwesome.Regular.Circle;
- }
- };
+ Current.ValueChanged += selected => { icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle; };
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ if (accentColour == null)
+ AccentColour = colours.Blue;
+ }
+
+ protected override bool OnHover(HoverEvent e)
+ {
+ updateFade();
+ return base.OnHover(e);
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e)
+ {
+ if (!Current.Value)
+ updateFade();
+
+ base.OnHoverLost(e);
+ }
+
+ private void updateFade()
+ {
+ box.FadeTo(IsHovered ? 1 : 0, transition_length, Easing.OutQuint);
+ text.FadeColour(IsHovered ? Color4.White : AccentColour, transition_length, Easing.OutQuint);
}
}
}
diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs
index 14d356f889..669fd62e45 100644
--- a/osu.Game/Input/Bindings/GlobalActionContainer.cs
+++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs
@@ -39,7 +39,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(InputKey.F4, GlobalAction.ToggleMute),
new KeyBinding(InputKey.Escape, GlobalAction.Back),
- new KeyBinding(InputKey.MouseButton1, GlobalAction.Back),
+ new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back),
new KeyBinding(InputKey.Space, GlobalAction.Select),
new KeyBinding(InputKey.Enter, GlobalAction.Select),
diff --git a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs
new file mode 100644
index 0000000000..c5fcc16f84
--- /dev/null
+++ b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.Designer.cs
@@ -0,0 +1,504 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using osu.Game.Database;
+
+namespace osu.Game.Migrations
+{
+ [DbContext(typeof(OsuDbContext))]
+ [Migration("20190708070844_AddBPMAndLengthColumns")]
+ partial class AddBPMAndLengthColumns
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
+
+ modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ApproachRate");
+
+ b.Property("CircleSize");
+
+ b.Property("DrainRate");
+
+ b.Property("OverallDifficulty");
+
+ b.Property("SliderMultiplier");
+
+ b.Property("SliderTickRate");
+
+ b.HasKey("ID");
+
+ b.ToTable("BeatmapDifficulty");
+ });
+
+ modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AudioLeadIn");
+
+ b.Property("BPM");
+
+ b.Property("BaseDifficultyID");
+
+ b.Property("BeatDivisor");
+
+ b.Property("BeatmapSetInfoID");
+
+ b.Property("Countdown");
+
+ b.Property("DistanceSpacing");
+
+ b.Property("GridSize");
+
+ b.Property("Hash");
+
+ b.Property("Hidden");
+
+ b.Property("Length");
+
+ b.Property("LetterboxInBreaks");
+
+ b.Property("MD5Hash");
+
+ b.Property("MetadataID");
+
+ b.Property("OnlineBeatmapID");
+
+ b.Property("Path");
+
+ b.Property("RulesetID");
+
+ b.Property("SpecialStyle");
+
+ b.Property("StackLeniency");
+
+ b.Property("StarDifficulty");
+
+ b.Property("Status");
+
+ b.Property("StoredBookmarks");
+
+ b.Property("TimelineZoom");
+
+ b.Property("Version");
+
+ b.Property("WidescreenStoryboard");
+
+ b.HasKey("ID");
+
+ b.HasIndex("BaseDifficultyID");
+
+ b.HasIndex("BeatmapSetInfoID");
+
+ b.HasIndex("Hash");
+
+ b.HasIndex("MD5Hash");
+
+ b.HasIndex("MetadataID");
+
+ b.HasIndex("OnlineBeatmapID")
+ .IsUnique();
+
+ b.HasIndex("RulesetID");
+
+ b.ToTable("BeatmapInfo");
+ });
+
+ modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Artist");
+
+ b.Property("ArtistUnicode");
+
+ b.Property("AudioFile");
+
+ b.Property("AuthorString")
+ .HasColumnName("Author");
+
+ b.Property("BackgroundFile");
+
+ b.Property("PreviewTime");
+
+ b.Property("Source");
+
+ b.Property("Tags");
+
+ b.Property("Title");
+
+ b.Property("TitleUnicode");
+
+ b.HasKey("ID");
+
+ b.ToTable("BeatmapMetadata");
+ });
+
+ modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("BeatmapSetInfoID");
+
+ b.Property("FileInfoID");
+
+ b.Property("Filename")
+ .IsRequired();
+
+ b.HasKey("ID");
+
+ b.HasIndex("BeatmapSetInfoID");
+
+ b.HasIndex("FileInfoID");
+
+ b.ToTable("BeatmapSetFileInfo");
+ });
+
+ modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("DateAdded");
+
+ b.Property("DeletePending");
+
+ b.Property("Hash");
+
+ b.Property("MetadataID");
+
+ b.Property("OnlineBeatmapSetID");
+
+ b.Property("Protected");
+
+ b.Property("Status");
+
+ b.HasKey("ID");
+
+ b.HasIndex("DeletePending");
+
+ b.HasIndex("Hash")
+ .IsUnique();
+
+ b.HasIndex("MetadataID");
+
+ b.HasIndex("OnlineBeatmapSetID")
+ .IsUnique();
+
+ b.ToTable("BeatmapSetInfo");
+ });
+
+ modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Key")
+ .HasColumnName("Key");
+
+ b.Property("RulesetID");
+
+ b.Property("SkinInfoID");
+
+ b.Property("StringValue")
+ .HasColumnName("Value");
+
+ b.Property("Variant");
+
+ b.HasKey("ID");
+
+ b.HasIndex("SkinInfoID");
+
+ b.HasIndex("RulesetID", "Variant");
+
+ b.ToTable("Settings");
+ });
+
+ modelBuilder.Entity("osu.Game.IO.FileInfo", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Hash");
+
+ b.Property("ReferenceCount");
+
+ b.HasKey("ID");
+
+ b.HasIndex("Hash")
+ .IsUnique();
+
+ b.HasIndex("ReferenceCount");
+
+ b.ToTable("FileInfo");
+ });
+
+ modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("IntAction")
+ .HasColumnName("Action");
+
+ b.Property("KeysString")
+ .HasColumnName("Keys");
+
+ b.Property("RulesetID");
+
+ b.Property("Variant");
+
+ b.HasKey("ID");
+
+ b.HasIndex("IntAction");
+
+ b.HasIndex("RulesetID", "Variant");
+
+ b.ToTable("KeyBinding");
+ });
+
+ modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Available");
+
+ b.Property("InstantiationInfo");
+
+ b.Property("Name");
+
+ b.Property("ShortName");
+
+ b.HasKey("ID");
+
+ b.HasIndex("Available");
+
+ b.HasIndex("ShortName")
+ .IsUnique();
+
+ b.ToTable("RulesetInfo");
+ });
+
+ modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("FileInfoID");
+
+ b.Property("Filename")
+ .IsRequired();
+
+ b.Property("ScoreInfoID");
+
+ b.HasKey("ID");
+
+ b.HasIndex("FileInfoID");
+
+ b.HasIndex("ScoreInfoID");
+
+ b.ToTable("ScoreFileInfo");
+ });
+
+ modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Accuracy")
+ .HasColumnType("DECIMAL(1,4)");
+
+ b.Property("BeatmapInfoID");
+
+ b.Property("Combo");
+
+ b.Property("Date");
+
+ b.Property("DeletePending");
+
+ b.Property("Hash");
+
+ b.Property("MaxCombo");
+
+ b.Property("ModsJson")
+ .HasColumnName("Mods");
+
+ b.Property("OnlineScoreID");
+
+ b.Property("PP");
+
+ b.Property("Rank");
+
+ b.Property("RulesetID");
+
+ b.Property("StatisticsJson")
+ .HasColumnName("Statistics");
+
+ b.Property("TotalScore");
+
+ b.Property("UserID")
+ .HasColumnName("UserID");
+
+ b.Property("UserString")
+ .HasColumnName("User");
+
+ b.HasKey("ID");
+
+ b.HasIndex("BeatmapInfoID");
+
+ b.HasIndex("OnlineScoreID")
+ .IsUnique();
+
+ b.HasIndex("RulesetID");
+
+ b.ToTable("ScoreInfo");
+ });
+
+ modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("FileInfoID");
+
+ b.Property("Filename")
+ .IsRequired();
+
+ b.Property("SkinInfoID");
+
+ b.HasKey("ID");
+
+ b.HasIndex("FileInfoID");
+
+ b.HasIndex("SkinInfoID");
+
+ b.ToTable("SkinFileInfo");
+ });
+
+ modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Creator");
+
+ b.Property("DeletePending");
+
+ b.Property("Hash");
+
+ b.Property("Name");
+
+ b.HasKey("ID");
+
+ b.HasIndex("DeletePending");
+
+ b.HasIndex("Hash")
+ .IsUnique();
+
+ b.ToTable("SkinInfo");
+ });
+
+ modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
+ {
+ b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty")
+ .WithMany()
+ .HasForeignKey("BaseDifficultyID")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet")
+ .WithMany("Beatmaps")
+ .HasForeignKey("BeatmapSetInfoID")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
+ .WithMany("Beatmaps")
+ .HasForeignKey("MetadataID");
+
+ b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
+ .WithMany()
+ .HasForeignKey("RulesetID")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
+ {
+ b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
+ .WithMany("Files")
+ .HasForeignKey("BeatmapSetInfoID")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.HasOne("osu.Game.IO.FileInfo", "FileInfo")
+ .WithMany()
+ .HasForeignKey("FileInfoID")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
+ {
+ b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
+ .WithMany("BeatmapSets")
+ .HasForeignKey("MetadataID");
+ });
+
+ modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b =>
+ {
+ b.HasOne("osu.Game.Skinning.SkinInfo")
+ .WithMany("Settings")
+ .HasForeignKey("SkinInfoID");
+ });
+
+ modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b =>
+ {
+ b.HasOne("osu.Game.IO.FileInfo", "FileInfo")
+ .WithMany()
+ .HasForeignKey("FileInfoID")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.HasOne("osu.Game.Scoring.ScoreInfo")
+ .WithMany("Files")
+ .HasForeignKey("ScoreInfoID");
+ });
+
+ modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b =>
+ {
+ b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap")
+ .WithMany("Scores")
+ .HasForeignKey("BeatmapInfoID")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
+ .WithMany()
+ .HasForeignKey("RulesetID")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b =>
+ {
+ b.HasOne("osu.Game.IO.FileInfo", "FileInfo")
+ .WithMany()
+ .HasForeignKey("FileInfoID")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.HasOne("osu.Game.Skinning.SkinInfo")
+ .WithMany("Files")
+ .HasForeignKey("SkinInfoID")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs
new file mode 100644
index 0000000000..f5963ebf5e
--- /dev/null
+++ b/osu.Game/Migrations/20190708070844_AddBPMAndLengthColumns.cs
@@ -0,0 +1,33 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace osu.Game.Migrations
+{
+ public partial class AddBPMAndLengthColumns : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "BPM",
+ table: "BeatmapInfo",
+ nullable: false,
+ defaultValue: 0.0);
+
+ migrationBuilder.AddColumn(
+ name: "Length",
+ table: "BeatmapInfo",
+ nullable: false,
+ defaultValue: 0.0);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "BPM",
+ table: "BeatmapInfo");
+
+ migrationBuilder.DropColumn(
+ name: "Length",
+ table: "BeatmapInfo");
+ }
+ }
+}
diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs
index 11b032a941..761dca2801 100644
--- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs
+++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs
@@ -45,6 +45,8 @@ namespace osu.Game.Migrations
b.Property("AudioLeadIn");
+ b.Property("BPM");
+
b.Property("BaseDifficultyID");
b.Property("BeatDivisor");
@@ -61,6 +63,8 @@ namespace osu.Game.Migrations
b.Property("Hidden");
+ b.Property("Length");
+
b.Property("LetterboxInBreaks");
b.Property("MD5Hash");
diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs
index e56df05570..50844fa256 100644
--- a/osu.Game/Online/API/Requests/GetScoresRequest.cs
+++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs
@@ -5,8 +5,10 @@ using System;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Screens.Select.Leaderboards;
-using osu.Framework.IO.Network;
using osu.Game.Online.API.Requests.Responses;
+using osu.Game.Rulesets.Mods;
+using System.Text;
+using System.Collections.Generic;
namespace osu.Game.Online.API.Requests
{
@@ -15,8 +17,9 @@ namespace osu.Game.Online.API.Requests
private readonly BeatmapInfo beatmap;
private readonly BeatmapLeaderboardScope scope;
private readonly RulesetInfo ruleset;
+ private readonly IEnumerable mods;
- public GetScoresRequest(BeatmapInfo beatmap, RulesetInfo ruleset, BeatmapLeaderboardScope scope = BeatmapLeaderboardScope.Global)
+ public GetScoresRequest(BeatmapInfo beatmap, RulesetInfo ruleset, BeatmapLeaderboardScope scope = BeatmapLeaderboardScope.Global, IEnumerable mods = null)
{
if (!beatmap.OnlineBeatmapID.HasValue)
throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.OnlineBeatmapID)}.");
@@ -27,6 +30,7 @@ namespace osu.Game.Online.API.Requests
this.beatmap = beatmap;
this.scope = scope;
this.ruleset = ruleset ?? throw new ArgumentNullException(nameof(ruleset));
+ this.mods = mods ?? Array.Empty();
Success += onSuccess;
}
@@ -38,19 +42,29 @@ namespace osu.Game.Online.API.Requests
score.Beatmap = beatmap;
score.Ruleset = ruleset;
}
+
+ var userScore = r.UserScore;
+
+ if (userScore != null)
+ {
+ userScore.Score.Beatmap = beatmap;
+ userScore.Score.Ruleset = ruleset;
+ }
}
- protected override WebRequest CreateWebRequest()
+ protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}/scores{createQueryParameters()}";
+
+ private string createQueryParameters()
{
- var req = base.CreateWebRequest();
+ StringBuilder query = new StringBuilder(@"?");
- req.Timeout = 30000;
- req.AddParameter(@"type", scope.ToString().ToLowerInvariant());
- req.AddParameter(@"mode", ruleset.ShortName);
+ query.Append($@"type={scope.ToString().ToLowerInvariant()}");
+ query.Append($@"&mode={ruleset.ShortName}");
- return req;
+ foreach (var mod in mods)
+ query.Append($@"&mods[]={mod.Acronym}");
+
+ return query.ToString();
}
-
- protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}/scores";
}
}
diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs
index bcbe060f82..f4d67a56aa 100644
--- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs
+++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.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 Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
@@ -71,6 +72,7 @@ namespace osu.Game.Online.API.Requests.Responses
StarDifficulty = starDifficulty,
OnlineBeatmapID = OnlineBeatmapID,
Version = version,
+ Length = TimeSpan.FromSeconds(length).TotalMilliseconds,
Status = Status,
BeatmapSet = set,
Metrics = metrics,
@@ -85,7 +87,6 @@ namespace osu.Game.Online.API.Requests.Responses
{
PlayCount = playCount,
PassCount = passCount,
- Length = length,
CircleCount = circleCount,
SliderCount = sliderCount,
},
diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs
index 36407c7b0e..56005e15f8 100644
--- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs
+++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs
@@ -33,6 +33,8 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty("versions")]
public VersionNavigation Versions { get; set; }
+ public string Url => $"https://osu.ppy.sh/home/changelog/{UpdateStream.Name}/{Version}";
+
public class VersionNavigation
{
[JsonProperty("next")]
diff --git a/osu.Game/Online/API/Requests/Responses/APILegacyScores.cs b/osu.Game/Online/API/Requests/Responses/APILegacyScores.cs
index c629caaa6f..318fcb00de 100644
--- a/osu.Game/Online/API/Requests/Responses/APILegacyScores.cs
+++ b/osu.Game/Online/API/Requests/Responses/APILegacyScores.cs
@@ -10,5 +10,17 @@ namespace osu.Game.Online.API.Requests.Responses
{
[JsonProperty(@"scores")]
public List Scores;
+
+ [JsonProperty(@"userScore")]
+ public APILegacyUserTopScoreInfo UserScore;
+ }
+
+ public class APILegacyUserTopScoreInfo
+ {
+ [JsonProperty(@"position")]
+ public int Position;
+
+ [JsonProperty(@"score")]
+ public APILegacyScoreInfo Score;
}
}
diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs
index 786afdf450..62d6efcb6f 100644
--- a/osu.Game/Online/DownloadTrackingComposite.cs
+++ b/osu.Game/Online/DownloadTrackingComposite.cs
@@ -11,7 +11,7 @@ using osu.Game.Online.API;
namespace osu.Game.Online
{
///
- /// A component which tracks a beatmap through potential download/import/deletion.
+ /// A component which tracks a through potential download/import/deletion.
///
public abstract class DownloadTrackingComposite : CompositeDrawable
where TModel : class, IEquatable
@@ -22,7 +22,7 @@ namespace osu.Game.Online
private TModelManager manager;
///
- /// Holds the current download state of the beatmap, whether is has already been downloaded, is in progress, or is not downloaded.
+ /// Holds the current download state of the , whether is has already been downloaded, is in progress, or is not downloaded.
///
protected readonly Bindable State = new Bindable();
diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs
index b91de93a4a..35f7ba1c1b 100644
--- a/osu.Game/Online/Leaderboards/Leaderboard.cs
+++ b/osu.Game/Online/Leaderboards/Leaderboard.cs
@@ -203,8 +203,13 @@ namespace osu.Game.Online.Leaderboards
public void APIStateChanged(IAPIProvider api, APIState state)
{
- if (state == APIState.Online)
- UpdateScores();
+ switch (state)
+ {
+ case APIState.Online:
+ case APIState.Offline:
+ UpdateScores();
+ break;
+ }
}
protected void UpdateScores()
@@ -231,12 +236,6 @@ namespace osu.Game.Online.Leaderboards
if (getScoresRequest == null)
return;
- if (api?.IsLoggedIn != true)
- {
- PlaceholderState = PlaceholderState.NotLoggedIn;
- return;
- }
-
getScoresRequest.Failure += e => Schedule(() =>
{
if (e is OperationCanceledException)
diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs
index 7087df83d7..361ff62155 100644
--- a/osu.Game/OsuGame.cs
+++ b/osu.Game/OsuGame.cs
@@ -282,11 +282,9 @@ namespace osu.Game
performFromMainMenu(() =>
{
- Ruleset.Value = databasedScoreInfo.Ruleset;
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
- Mods.Value = databasedScoreInfo.Mods;
- menuScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore)));
+ menuScreen.Push(new ReplayPlayerLoader(databasedScore));
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
}
@@ -387,6 +385,7 @@ namespace osu.Game
BeatmapManager.PresentImport = items => PresentBeatmap(items.First());
ScoreManager.PostNotification = n => notifications?.Post(n);
+ ScoreManager.GetStableStorage = GetStorageForStableInstall;
ScoreManager.PresentImport = items => PresentScore(items.First());
Container logoContainer;
diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs
index 6a583baf38..5b10c4e0bb 100644
--- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs
+++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs
@@ -60,7 +60,7 @@ namespace osu.Game.Overlays.BeatmapSet
}
else
{
- length.Value = TimeSpan.FromSeconds(beatmap.OnlineInfo.Length).ToString(@"m\:ss");
+ length.Value = TimeSpan.FromMilliseconds(beatmap.Length).ToString(@"m\:ss");
circleCount.Value = beatmap.OnlineInfo.CircleCount.ToString();
sliderCount.Value = beatmap.OnlineInfo.SliderCount.ToString();
}
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs
index 8e806c6747..d263483046 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs
@@ -23,10 +23,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private Color4 backgroundHoveredColour;
private readonly Box background;
- private readonly TopScoreUserSection userSection;
- private readonly TopScoreStatisticsSection statisticsSection;
- public DrawableTopScore()
+ public DrawableTopScore(ScoreInfo score, int position = 1)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
@@ -61,16 +59,19 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
new Drawable[]
{
- userSection = new TopScoreUserSection
+ new TopScoreUserSection
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
+ Score = score,
+ ScorePosition = position,
},
null,
- statisticsSection = new TopScoreStatisticsSection
+ new TopScoreStatisticsSection
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
+ Score = score,
}
},
},
@@ -91,18 +92,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
background.Colour = backgroundIdleColour;
}
- ///
- /// Sets the score to be displayed.
- ///
- public ScoreInfo Score
- {
- set
- {
- userSection.Score = value;
- statisticsSection.Score = value;
- }
- }
-
protected override bool OnHover(HoverEvent e)
{
background.FadeColour(backgroundHoveredColour, fade_duration, Easing.OutQuint);
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs
index 15816be327..347522fb48 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs
@@ -59,7 +59,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Content = null;
backgroundFlow.Clear();
- if (value == null || !value.Any())
+ if (value?.Any() != true)
return;
for (int i = 0; i < value.Count; i++)
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
index 3e6c938802..22d7ea9c97 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
@@ -5,15 +5,14 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
-using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
+using osuTK;
+using System.Linq;
+using osu.Game.Online.API.Requests.Responses;
+using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
-using osuTK;
-using System.Collections.Generic;
-using System.Linq;
-using osu.Game.Scoring;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
@@ -24,18 +23,65 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private readonly Box background;
private readonly ScoreTable scoreTable;
-
- private readonly DrawableTopScore topScore;
+ private readonly FillFlowContainer topScoresContainer;
private readonly LoadingAnimation loadingAnimation;
[Resolved]
private IAPIProvider api { get; set; }
+ private GetScoresRequest getScoresRequest;
+
+ private BeatmapInfo beatmap;
+
+ public BeatmapInfo Beatmap
+ {
+ get => beatmap;
+ set
+ {
+ if (beatmap == value)
+ return;
+
+ beatmap = value;
+
+ getScores(beatmap);
+ }
+ }
+
+ protected APILegacyScores Scores
+ {
+ set
+ {
+ Schedule(() =>
+ {
+ loading = false;
+
+ topScoresContainer.Clear();
+
+ if (value?.Scores.Any() != true)
+ {
+ scoreTable.Scores = null;
+ scoreTable.Hide();
+ return;
+ }
+
+ scoreTable.Scores = value.Scores;
+ scoreTable.Show();
+
+ var topScore = value.Scores.First();
+ var userScore = value.UserScore;
+
+ topScoresContainer.Add(new DrawableTopScore(topScore));
+
+ if (userScore != null && userScore.Score.OnlineScoreID != topScore.OnlineScoreID)
+ topScoresContainer.Add(new DrawableTopScore(userScore.Score, userScore.Position));
+ });
+ }
+ }
+
public ScoresContainer()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
-
InternalChildren = new Drawable[]
{
background = new Box
@@ -54,7 +100,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Margin = new MarginPadding { Vertical = spacing },
Children = new Drawable[]
{
- topScore = new DrawableTopScore(),
+ topScoresContainer = new FillFlowContainer
+ {
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Direction = FillDirection.Vertical,
+ Spacing = new Vector2(0, 5),
+ },
scoreTable = new ScoreTable
{
Anchor = Anchor.TopCentre,
@@ -65,7 +117,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
loadingAnimation = new LoadingAnimation
{
Alpha = 0,
- Margin = new MarginPadding(20)
+ Margin = new MarginPadding(20),
},
};
}
@@ -74,7 +126,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private void load(OsuColour colours)
{
background.Colour = colours.Gray2;
- updateDisplay();
}
private bool loading
@@ -82,62 +133,23 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
set => loadingAnimation.FadeTo(value ? 1 : 0, fade_duration);
}
- private GetScoresRequest getScoresRequest;
- private IReadOnlyList scores;
-
- public IReadOnlyList Scores
- {
- get => scores;
- set
- {
- getScoresRequest?.Cancel();
- scores = value;
-
- updateDisplay();
- }
- }
-
- private BeatmapInfo beatmap;
-
- public BeatmapInfo Beatmap
- {
- get => beatmap;
- set
- {
- beatmap = value;
-
- Scores = null;
-
- if (beatmap?.OnlineBeatmapID.HasValue != true)
- return;
-
- loading = true;
-
- getScoresRequest = new GetScoresRequest(beatmap, beatmap.Ruleset);
- getScoresRequest.Success += r => Schedule(() => Scores = r.Scores);
- api.Queue(getScoresRequest);
- }
- }
-
- private void updateDisplay()
- {
- loading = false;
-
- scoreTable.Scores = scores?.Count > 1 ? scores : new List();
- scoreTable.FadeTo(scores?.Count > 1 ? 1 : 0);
-
- if (scores?.Any() == true)
- {
- topScore.Score = scores.FirstOrDefault();
- topScore.Show();
- }
- else
- topScore.Hide();
- }
-
- protected override void Dispose(bool isDisposing)
+ private void getScores(BeatmapInfo beatmap)
{
getScoresRequest?.Cancel();
+ getScoresRequest = null;
+
+ Scores = null;
+
+ if (beatmap?.OnlineBeatmapID.HasValue != true)
+ {
+ loading = false;
+ return;
+ }
+
+ getScoresRequest = new GetScoresRequest(beatmap, beatmap.Ruleset);
+ getScoresRequest.Success += scores => Scores = scores;
+ api.Queue(getScoresRequest);
+ loading = true;
}
}
}
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs
index 1d9c4e7fc8..a15d3c5fd1 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs
@@ -39,19 +39,28 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
- rankText = new OsuSpriteText
+ new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
- Text = "#1",
- Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold, italics: true)
- },
- rank = new UpdateableRank(ScoreRank.D)
- {
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- Size = new Vector2(40),
- FillMode = FillMode.Fit,
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
+ {
+ rankText = new OsuSpriteText
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Font = OsuFont.GetFont(size: 24, weight: FontWeight.Bold, italics: true)
+ },
+ rank = new UpdateableRank(ScoreRank.D)
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Size = new Vector2(40),
+ FillMode = FillMode.Fit,
+ },
+ }
},
avatar = new UpdateableAvatar(hideImmediately: true)
{
@@ -109,6 +118,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
rankText.Colour = colours.Yellow;
}
+ public int ScorePosition
+ {
+ set => rankText.Text = $"#{value}";
+ }
+
///
/// Sets the score to be displayed.
///
diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs
index 19f6a3f692..c20e6368d8 100644
--- a/osu.Game/Overlays/BeatmapSetOverlay.cs
+++ b/osu.Game/Overlays/BeatmapSetOverlay.cs
@@ -21,12 +21,9 @@ namespace osu.Game.Overlays
{
public class BeatmapSetOverlay : FullscreenOverlay
{
- private const int fade_duration = 300;
-
public const float X_PADDING = 40;
public const float TOP_PADDING = 25;
public const float RIGHT_WIDTH = 275;
-
protected readonly Header Header;
private RulesetStore rulesets;
@@ -40,7 +37,7 @@ namespace osu.Game.Overlays
{
OsuScrollContainer scroll;
Info info;
- ScoresContainer scores;
+ ScoresContainer scoreContainer;
Children = new Drawable[]
{
@@ -62,7 +59,7 @@ namespace osu.Game.Overlays
{
Header = new Header(),
info = new Info(),
- scores = new ScoresContainer(),
+ scoreContainer = new ScoresContainer(),
},
},
},
@@ -74,7 +71,7 @@ namespace osu.Game.Overlays
Header.Picker.Beatmap.ValueChanged += b =>
{
info.Beatmap = b.NewValue;
- scores.Beatmap = b.NewValue;
+ scoreContainer.Beatmap = b.NewValue;
scroll.ScrollToStart();
};
@@ -101,6 +98,7 @@ namespace osu.Game.Overlays
public void FetchAndShowBeatmap(int beatmapId)
{
beatmapSet.Value = null;
+
var req = new GetBeatmapSetRequest(beatmapId, BeatmapSetLookupType.BeatmapId);
req.Success += res =>
{
@@ -108,15 +106,18 @@ namespace osu.Game.Overlays
Header.Picker.Beatmap.Value = Header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineBeatmapID == beatmapId);
};
API.Queue(req);
+
Show();
}
public void FetchAndShowBeatmapSet(int beatmapSetId)
{
beatmapSet.Value = null;
+
var req = new GetBeatmapSetRequest(beatmapSetId);
req.Success += res => beatmapSet.Value = res.ToBeatmapSet(rulesets);
API.Queue(req);
+
Show();
}
diff --git a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs
index 36ae5a756c..44552b214f 100644
--- a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs
+++ b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs
@@ -58,7 +58,11 @@ namespace osu.Game.Overlays.Changelog
}
if (build != null)
- Child = new ChangelogBuildWithNavigation(build) { SelectBuild = SelectBuild };
+ Children = new Drawable[]
+ {
+ new ChangelogBuildWithNavigation(build) { SelectBuild = SelectBuild },
+ new Comments(build)
+ };
}
public class ChangelogBuildWithNavigation : ChangelogBuild
diff --git a/osu.Game/Overlays/Changelog/Comments.cs b/osu.Game/Overlays/Changelog/Comments.cs
new file mode 100644
index 0000000000..4cf39e7b44
--- /dev/null
+++ b/osu.Game/Overlays/Changelog/Comments.cs
@@ -0,0 +1,79 @@
+// 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.Shapes;
+using osu.Framework.Graphics.Sprites;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Containers;
+using osu.Game.Online.API.Requests.Responses;
+using osuTK.Graphics;
+
+namespace osu.Game.Overlays.Changelog
+{
+ public class Comments : CompositeDrawable
+ {
+ private readonly APIChangelogBuild build;
+
+ public Comments(APIChangelogBuild build)
+ {
+ this.build = build;
+
+ RelativeSizeAxes = Axes.X;
+ AutoSizeAxes = Axes.Y;
+
+ Padding = new MarginPadding
+ {
+ Horizontal = 50,
+ Vertical = 20,
+ };
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ LinkFlowContainer text;
+
+ InternalChildren = new Drawable[]
+ {
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Masking = true,
+ CornerRadius = 10,
+ Child = new Box
+ {
+ RelativeSizeAxes = Axes.Both,
+ Colour = colours.GreyVioletDarker
+ },
+ },
+ text = new LinkFlowContainer(t =>
+ {
+ t.Colour = colours.PinkLighter;
+ t.Font = OsuFont.Default.With(size: 14);
+ })
+ {
+ Padding = new MarginPadding(20),
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ }
+ };
+
+ text.AddParagraph("Got feedback?", t =>
+ {
+ t.Colour = Color4.White;
+ t.Font = OsuFont.Default.With(italics: true, size: 20);
+ t.Padding = new MarginPadding { Bottom = 20 };
+ });
+
+ text.AddParagraph("We would love to hear what you think of this update! ");
+ text.AddIcon(FontAwesome.Regular.GrinHearts);
+
+ text.AddParagraph("Please visit the ");
+ text.AddLink("web version", $"{build.Url}#comments");
+ text.AddText(" of this changelog to leave any comments.");
+ }
+ }
+}
diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs
index 29ae5983be..abbcec5094 100644
--- a/osu.Game/Overlays/MusicController.cs
+++ b/osu.Game/Overlays/MusicController.cs
@@ -55,6 +55,8 @@ namespace osu.Game.Overlays
private Container dragContainer;
private Container playerContainer;
+ public bool IsUserPaused { get; private set; }
+
[Resolved]
private Bindable beatmap { get; set; }
@@ -157,7 +159,7 @@ namespace osu.Game.Overlays
Origin = Anchor.Centre,
Scale = new Vector2(1.4f),
IconScale = new Vector2(1.4f),
- Action = play,
+ Action = togglePause,
Icon = FontAwesome.Regular.PlayCircle,
},
nextButton = new MusicIconButton
@@ -276,7 +278,7 @@ namespace osu.Game.Overlays
}
}
- private void play()
+ private void togglePause()
{
var track = current?.Track;
@@ -288,9 +290,15 @@ namespace osu.Game.Overlays
}
if (track.IsRunning)
+ {
+ IsUserPaused = true;
track.Stop();
+ }
else
+ {
track.Start();
+ IsUserPaused = false;
+ }
}
private void prev()
diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs
index 997d1354b3..9142492610 100644
--- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs
@@ -35,6 +35,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
Bindable = config.GetBindable(OsuSetting.ShowInterface)
},
new SettingsCheckbox
+ {
+ LabelText = "Show health display even when you can't fail",
+ Bindable = config.GetBindable(OsuSetting.ShowHealthDisplayWhenCantFail),
+ },
+ new SettingsCheckbox
{
LabelText = "Always show key overlay",
Bindable = config.GetBindable(OsuSetting.KeyOverlay)
diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs
index 398a091486..832673703b 100644
--- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs
@@ -7,6 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
+using osu.Game.Scoring;
using osu.Game.Skinning;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
@@ -16,14 +17,16 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
protected override string Header => "General";
private TriangleButton importBeatmapsButton;
+ private TriangleButton importScoresButton;
private TriangleButton importSkinsButton;
- private TriangleButton deleteSkinsButton;
private TriangleButton deleteBeatmapsButton;
+ private TriangleButton deleteScoresButton;
+ private TriangleButton deleteSkinsButton;
private TriangleButton restoreButton;
private TriangleButton undeleteButton;
[BackgroundDependencyLoader]
- private void load(BeatmapManager beatmaps, SkinManager skins, DialogOverlay dialogOverlay)
+ private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, DialogOverlay dialogOverlay)
{
if (beatmaps.SupportsImportFromStable)
{
@@ -51,6 +54,32 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
}
});
+ if (scores.SupportsImportFromStable)
+ {
+ Add(importScoresButton = new SettingsButton
+ {
+ Text = "Import scores from stable",
+ Action = () =>
+ {
+ importScoresButton.Enabled.Value = false;
+ scores.ImportFromStableAsync().ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true));
+ }
+ });
+ }
+
+ Add(deleteScoresButton = new DangerousSettingsButton
+ {
+ Text = "Delete ALL scores",
+ Action = () =>
+ {
+ dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
+ {
+ deleteScoresButton.Enabled.Value = false;
+ Task.Run(() => scores.Delete(scores.GetAllUsableScores())).ContinueWith(t => Schedule(() => deleteScoresButton.Enabled.Value = true));
+ }));
+ }
+ });
+
if (skins.SupportsImportFromStable)
{
Add(importSkinsButton = new SettingsButton
diff --git a/osu.Game/Rulesets/Mods/IApplicableToHUD.cs b/osu.Game/Rulesets/Mods/IApplicableToHUD.cs
new file mode 100644
index 0000000000..4fb535a0b3
--- /dev/null
+++ b/osu.Game/Rulesets/Mods/IApplicableToHUD.cs
@@ -0,0 +1,18 @@
+// 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.Rulesets.Mods
+{
+ ///
+ /// An interface for mods that apply changes to the .
+ ///
+ public interface IApplicableToHUD : IApplicableMod
+ {
+ ///
+ /// Provide a . Called once on initialisation of a play instance.
+ ///
+ void ApplyToHUD(HUDOverlay overlay);
+ }
+}
diff --git a/osu.Game/Rulesets/Mods/ModBlockFail.cs b/osu.Game/Rulesets/Mods/ModBlockFail.cs
new file mode 100644
index 0000000000..26efc3932d
--- /dev/null
+++ b/osu.Game/Rulesets/Mods/ModBlockFail.cs
@@ -0,0 +1,29 @@
+// 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.Bindables;
+using osu.Game.Configuration;
+using osu.Game.Screens.Play;
+
+namespace osu.Game.Rulesets.Mods
+{
+ public abstract class ModBlockFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig
+ {
+ private Bindable showHealthBar;
+
+ ///
+ /// We never fail, 'yo.
+ ///
+ public bool AllowFail => false;
+
+ public void ReadFromConfig(OsuConfigManager config)
+ {
+ showHealthBar = config.GetBindable(OsuSetting.ShowHealthDisplayWhenCantFail);
+ }
+
+ public void ApplyToHUD(HUDOverlay overlay)
+ {
+ overlay.ShowHealthbar.BindTo(showHealthBar);
+ }
+ }
+}
diff --git a/osu.Game/Rulesets/Mods/ModNoFail.cs b/osu.Game/Rulesets/Mods/ModNoFail.cs
index 1ee1f92d8c..49ee3354c3 100644
--- a/osu.Game/Rulesets/Mods/ModNoFail.cs
+++ b/osu.Game/Rulesets/Mods/ModNoFail.cs
@@ -7,7 +7,7 @@ using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
- public abstract class ModNoFail : Mod, IApplicableFailOverride
+ public abstract class ModNoFail : ModBlockFail
{
public override string Name => "No Fail";
public override string Acronym => "NF";
@@ -17,10 +17,5 @@ namespace osu.Game.Rulesets.Mods
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModAutoplay) };
-
- ///
- /// We never fail, 'yo.
- ///
- public bool AllowFail => false;
}
}
diff --git a/osu.Game/Rulesets/Mods/ModRelax.cs b/osu.Game/Rulesets/Mods/ModRelax.cs
index 4feb89186c..7c355577d4 100644
--- a/osu.Game/Rulesets/Mods/ModRelax.cs
+++ b/osu.Game/Rulesets/Mods/ModRelax.cs
@@ -7,7 +7,7 @@ using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
- public abstract class ModRelax : Mod
+ public abstract class ModRelax : ModBlockFail
{
public override string Name => "Relax";
public override string Acronym => "RX";
diff --git a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs
index 3830fa5cbe..4c011388fa 100644
--- a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs
+++ b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs
@@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Replays
/// When set, we will ensure frames executed by nested drawables are frame-accurate to replay data.
/// Disabling this can make replay playback smoother (useful for autoplay, currently).
///
- public bool FrameAccuratePlayback = true;
+ public bool FrameAccuratePlayback = false;
protected bool HasFrames => Frames.Count > 0;
diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs
index 2d82987da0..8475158c78 100644
--- a/osu.Game/Scoring/ScoreManager.cs
+++ b/osu.Game/Scoring/ScoreManager.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
@@ -24,7 +25,7 @@ namespace osu.Game.Scoring
protected override string[] HashableFileTypes => new[] { ".osr" };
- protected override string ImportFromStablePath => "Replays";
+ protected override string ImportFromStablePath => Path.Combine("Data", "r");
private readonly RulesetStore rulesets;
private readonly Func beatmaps;
@@ -55,6 +56,9 @@ namespace osu.Game.Scoring
}
}
+ protected override IEnumerable GetStableImportPaths(Storage stableStorage)
+ => stableStorage.GetFiles(ImportFromStablePath).Where(p => HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.InvariantCultureIgnoreCase) ?? false));
+
public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps(), Files.Store);
public List GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending).ToList();
@@ -65,6 +69,6 @@ namespace osu.Game.Scoring
protected override ArchiveDownloadRequest CreateDownloadRequest(ScoreInfo score, bool minimiseDownload) => new DownloadReplayRequest(score);
- protected override bool CheckLocalAvailability(ScoreInfo model, IQueryable items) => items.Any(s => s.OnlineScoreID == model.OnlineScoreID);
+ protected override bool CheckLocalAvailability(ScoreInfo model, IQueryable items) => items.Any(s => s.OnlineScoreID == model.OnlineScoreID && s.Files.Any());
}
}
diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs
index 89da9ae063..8cc227d9be 100644
--- a/osu.Game/Screens/Edit/Editor.cs
+++ b/osu.Game/Screens/Edit/Editor.cs
@@ -224,30 +224,32 @@ namespace osu.Game.Screens.Edit
public override void OnResuming(IScreen last)
{
- Beatmap.Value.Track?.Stop();
base.OnResuming(last);
+ Beatmap.Value.Track?.Stop();
}
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
+
Background.FadeColour(Color4.DarkGray, 500);
- Beatmap.Value.Track?.Stop();
+ resetTrack();
}
public override bool OnExiting(IScreen next)
{
Background.FadeColour(Color4.White, 500);
-
- if (Beatmap.Value.Track != null)
- {
- Beatmap.Value.Track.Tempo.Value = 1;
- Beatmap.Value.Track.Start();
- }
+ resetTrack();
return base.OnExiting(next);
}
+ private void resetTrack()
+ {
+ Beatmap.Value.Track?.ResetSpeedAdjustments();
+ Beatmap.Value.Track?.Stop();
+ }
+
private void exportBeatmap() => host.OpenFileExternally(Beatmap.Value.Save());
private void onModeChanged(ValueChangedEvent e)
diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs
index 5aa244cc06..1a3e1213b4 100644
--- a/osu.Game/Screens/Menu/ButtonSystem.cs
+++ b/osu.Game/Screens/Menu/ButtonSystem.cs
@@ -332,7 +332,7 @@ namespace osu.Game.Screens.Menu
break;
case ButtonSystemState.EnteringMode:
- logoTrackingContainer.StartTracking(logo, 0, Easing.In);
+ logoTrackingContainer.StartTracking(logo, lastState == ButtonSystemState.Initial ? MainMenu.FADE_OUT_DURATION : 0, Easing.InSine);
break;
}
}
diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs
index dab5066c52..f6fbcf6498 100644
--- a/osu.Game/Screens/Menu/Intro.cs
+++ b/osu.Game/Screens/Menu/Intro.cs
@@ -33,13 +33,18 @@ namespace osu.Game.Screens.Menu
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(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
+ private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
{
menuVoice = config.GetBindable(OsuSetting.MenuVoice);
menuMusic = config.GetBindable(OsuSetting.MenuMusic);
@@ -161,7 +166,8 @@ namespace osu.Game.Screens.Menu
else
fadeOutTime = 500;
- Scheduler.AddDelayed(this.Exit, fadeOutTime);
+ 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);
diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs
index 7e6de54d1b..5999cbdfb5 100644
--- a/osu.Game/Screens/Menu/MainMenu.cs
+++ b/osu.Game/Screens/Menu/MainMenu.cs
@@ -23,7 +23,9 @@ namespace osu.Game.Screens.Menu
{
public class MainMenu : OsuScreen
{
- private ButtonSystem buttons;
+ public const float FADE_IN_DURATION = 300;
+
+ public const float FADE_OUT_DURATION = 400;
public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial;
@@ -35,9 +37,14 @@ namespace osu.Game.Screens.Menu
private MenuSideFlashes sideFlashes;
+ private ButtonSystem buttons;
+
[Resolved]
private GameHost host { get; set; }
+ [Resolved(canBeNull: true)]
+ private MusicController music { get; set; }
+
private BackgroundScreenDefault background;
protected override BackgroundScreen CreateBackground() => background;
@@ -141,12 +148,10 @@ namespace osu.Game.Screens.Menu
{
buttons.State = ButtonSystemState.TopLevel;
- const float length = 300;
+ this.FadeIn(FADE_IN_DURATION, Easing.OutQuint);
+ this.MoveTo(new Vector2(0, 0), FADE_IN_DURATION, Easing.OutQuint);
- this.FadeIn(length, Easing.OutQuint);
- this.MoveTo(new Vector2(0, 0), length, Easing.OutQuint);
-
- sideFlashes.Delay(length).FadeIn(64, Easing.InQuint);
+ sideFlashes.Delay(FADE_IN_DURATION).FadeIn(64, Easing.InQuint);
}
}
@@ -171,12 +176,10 @@ namespace osu.Game.Screens.Menu
{
base.OnSuspending(next);
- const float length = 400;
-
buttons.State = ButtonSystemState.EnteringMode;
- this.FadeOut(length, Easing.InSine);
- this.MoveTo(new Vector2(-800, 0), length, Easing.InSine);
+ this.FadeOut(FADE_OUT_DURATION, Easing.InSine);
+ this.MoveTo(new Vector2(-800, 0), FADE_OUT_DURATION, Easing.InSine);
sideFlashes.FadeOut(64, Easing.OutQuint);
}
@@ -189,6 +192,9 @@ namespace osu.Game.Screens.Menu
//we may have consumed our preloaded instance, so let's make another.
preloadSongSelect();
+
+ if (Beatmap.Value.Track != null && music?.IsUserPaused != true)
+ Beatmap.Value.Track.Start();
}
public override bool OnExiting(IScreen next)
diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs
index 017bf70133..43b9491750 100644
--- a/osu.Game/Screens/Play/HUDOverlay.cs
+++ b/osu.Game/Screens/Play/HUDOverlay.cs
@@ -23,7 +23,8 @@ namespace osu.Game.Screens.Play
{
public class HUDOverlay : Container
{
- private const int duration = 100;
+ private const int duration = 250;
+ private const Easing easing = Easing.OutQuint;
public readonly KeyCounterDisplay KeyCounter;
public readonly RollingCounter ComboCounter;
@@ -35,6 +36,8 @@ namespace osu.Game.Screens.Play
public readonly HoldForMenuButton HoldToQuit;
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
+ public Bindable ShowHealthbar = new Bindable(true);
+
private readonly ScoreProcessor scoreProcessor;
private readonly DrawableRuleset drawableRuleset;
private readonly IReadOnlyList mods;
@@ -47,6 +50,8 @@ namespace osu.Game.Screens.Play
public Action RequestSeek;
+ private readonly Container topScoreContainer;
+
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, IReadOnlyList mods)
{
this.scoreProcessor = scoreProcessor;
@@ -62,11 +67,10 @@ namespace osu.Game.Screens.Play
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
- new Container
+ topScoreContainer = new Container
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
- Y = 30,
AutoSizeAxes = Axes.Both,
AutoSizeDuration = 200,
AutoSizeEasing = Easing.Out,
@@ -113,8 +117,21 @@ namespace osu.Game.Screens.Play
ModDisplay.Current.Value = mods;
showHud = config.GetBindable(OsuSetting.ShowInterface);
- showHud.ValueChanged += visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration);
- showHud.TriggerChange();
+ showHud.BindValueChanged(visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration, easing), true);
+
+ ShowHealthbar.BindValueChanged(healthBar =>
+ {
+ if (healthBar.NewValue)
+ {
+ HealthDisplay.FadeIn(duration, easing);
+ topScoreContainer.MoveToY(30, duration, easing);
+ }
+ else
+ {
+ HealthDisplay.FadeOut(duration, easing);
+ topScoreContainer.MoveToY(0, duration, easing);
+ }
+ }, true);
if (!showHud.Value && !hasShownNotificationOnce)
{
diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs
index 30a3bc2fc6..0da9c77f25 100644
--- a/osu.Game/Screens/Play/Player.cs
+++ b/osu.Game/Screens/Play/Player.cs
@@ -498,6 +498,9 @@ namespace osu.Game.Screens.Play
GameplayClockContainer.Restart();
GameplayClockContainer.FadeInFromZero(750, Easing.OutQuint);
+
+ foreach (var mod in Mods.Value.OfType())
+ mod.ApplyToHUD(HUDOverlay);
}
public override void OnSuspending(IScreen next)
diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs
index 681ce701d0..5396321160 100644
--- a/osu.Game/Screens/Play/PlayerLoader.cs
+++ b/osu.Game/Screens/Play/PlayerLoader.cs
@@ -18,6 +18,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
+using osu.Game.Input;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play.HUD;
@@ -53,6 +54,8 @@ namespace osu.Game.Screens.Play
private InputManager inputManager;
+ private IdleTracker idleTracker;
+
public PlayerLoader(Func createPlayer)
{
this.createPlayer = createPlayer;
@@ -93,7 +96,8 @@ namespace osu.Game.Screens.Play
VisualSettings = new VisualSettings(),
new InputSettings()
}
- }
+ },
+ idleTracker = new IdleTracker(750)
});
loadNewPlayer();
@@ -193,7 +197,7 @@ namespace osu.Game.Screens.Play
// Here because IsHovered will not update unless we do so.
public override bool HandlePositionalInput => true;
- private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null;
+ private bool readyForPush => player.LoadState == LoadState.Ready && (IsHovered || idleTracker.IsIdle.Value) && inputManager?.DraggedDrawable == null;
private void pushWhenLoaded()
{
diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs
index 748fe8cc90..290e00f287 100644
--- a/osu.Game/Screens/Play/ReplayDownloadButton.cs
+++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs
@@ -86,11 +86,7 @@ namespace osu.Game.Screens.Play
}
}, true);
- if (replayAvailability == ReplayAvailability.NotAvailable)
- {
- button.Enabled.Value = false;
- button.Alpha = 0.6f;
- }
+ button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable;
}
private enum ReplayAvailability
diff --git a/osu.Game/Screens/Play/ReplayPlayerLoader.cs b/osu.Game/Screens/Play/ReplayPlayerLoader.cs
new file mode 100644
index 0000000000..86179ef067
--- /dev/null
+++ b/osu.Game/Screens/Play/ReplayPlayerLoader.cs
@@ -0,0 +1,34 @@
+// 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.Game.Scoring;
+
+namespace osu.Game.Screens.Play
+{
+ public class ReplayPlayerLoader : PlayerLoader
+ {
+ private readonly ScoreInfo scoreInfo;
+
+ public ReplayPlayerLoader(Score score)
+ : base(() => new ReplayPlayer(score))
+ {
+ if (score.Replay == null)
+ throw new ArgumentNullException(nameof(score.Replay), $"{nameof(score)} must have a non-null {nameof(score.Replay)}.");
+
+ scoreInfo = score.ScoreInfo;
+ }
+
+ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
+ {
+ var dependencies = base.CreateChildDependencies(parent);
+
+ // these will be reverted thanks to PlayerLoader's lease.
+ Mods.Value = scoreInfo.Mods;
+ Ruleset.Value = scoreInfo.Ruleset;
+
+ return dependencies;
+ }
+ }
+}
diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs
index 477037355c..b66a2ffe0f 100644
--- a/osu.Game/Screens/Select/BeatmapDetailArea.cs
+++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs
@@ -41,6 +41,8 @@ namespace osu.Game.Screens.Select
RelativeSizeAxes = Axes.X,
OnFilter = (tab, mods) =>
{
+ Leaderboard.FilterMods = mods;
+
switch (tab)
{
case BeatmapDetailTab.Details:
diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs
index fa9ffd0706..2551ffe2fc 100644
--- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs
+++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs
@@ -18,8 +18,6 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
-using osu.Game.Rulesets.Objects;
-using osu.Game.Rulesets.Objects.Types;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Effects;
@@ -289,14 +287,11 @@ namespace osu.Game.Screens.Select
if (b?.HitObjects?.Any() == true)
{
- HitObject lastObject = b.HitObjects.LastOrDefault();
- double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0;
-
labels.Add(new InfoLabel(new BeatmapStatistic
{
Name = "Length",
Icon = FontAwesome.Regular.Clock,
- Content = TimeSpan.FromMilliseconds(endTime - b.HitObjects.First().StartTime).ToString(@"m\:ss"),
+ Content = TimeSpan.FromMilliseconds(b.BeatmapInfo.Length).ToString(@"m\:ss"),
}));
labels.Add(new InfoLabel(new BeatmapStatistic
diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
index f1951e27ab..5a3996bb49 100644
--- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
+++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
@@ -48,6 +48,12 @@ namespace osu.Game.Screens.Select.Carousel
case SortMode.DateAdded:
return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
+ case SortMode.BPM:
+ return BeatmapSet.MaxBPM.CompareTo(otherSet.BeatmapSet.MaxBPM);
+
+ case SortMode.Length:
+ return BeatmapSet.MaxLength.CompareTo(otherSet.BeatmapSet.MaxLength);
+
case SortMode.Difficulty:
return BeatmapSet.MaxStarDifficulty.CompareTo(otherSet.BeatmapSet.MaxStarDifficulty);
}
diff --git a/osu.Game/Screens/Select/EditSongSelect.cs b/osu.Game/Screens/Select/EditSongSelect.cs
deleted file mode 100644
index bdf5f905fe..0000000000
--- a/osu.Game/Screens/Select/EditSongSelect.cs
+++ /dev/null
@@ -1,18 +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.Screens;
-
-namespace osu.Game.Screens.Select
-{
- public class EditSongSelect : SongSelect
- {
- protected override bool ShowFooter => false;
-
- protected override bool OnStart()
- {
- this.Exit();
- return true;
- }
- }
-}
diff --git a/osu.Game/Screens/Select/ImportFromStablePopup.cs b/osu.Game/Screens/Select/ImportFromStablePopup.cs
index 54e4c096f6..20494829ae 100644
--- a/osu.Game/Screens/Select/ImportFromStablePopup.cs
+++ b/osu.Game/Screens/Select/ImportFromStablePopup.cs
@@ -12,7 +12,7 @@ namespace osu.Game.Screens.Select
public ImportFromStablePopup(Action importFromStable)
{
HeaderText = @"You have no beatmaps!";
- BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps (and skins)?";
+ BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps, skins and scores?";
Icon = FontAwesome.Solid.Plane;
diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs
index 62f93afbbb..0f6d4f3188 100644
--- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs
+++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs
@@ -11,6 +11,7 @@ using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets;
+using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
namespace osu.Game.Screens.Select.Leaderboards
@@ -36,12 +37,34 @@ namespace osu.Game.Screens.Select.Leaderboards
}
}
+ private bool filterMods;
+
+ ///
+ /// Whether to apply the game's currently selected mods as a filter when retrieving scores.
+ ///
+ public bool FilterMods
+ {
+ get => filterMods;
+ set
+ {
+ if (value == filterMods)
+ return;
+
+ filterMods = value;
+
+ UpdateScores();
+ }
+ }
+
[Resolved]
private ScoreManager scoreManager { get; set; }
[Resolved]
private IBindable ruleset { get; set; }
+ [Resolved]
+ private IBindable> mods { get; set; }
+
[Resolved]
private IAPIProvider api { get; set; }
@@ -49,32 +72,66 @@ namespace osu.Game.Screens.Select.Leaderboards
private void load()
{
ruleset.ValueChanged += _ => UpdateScores();
+ mods.ValueChanged += _ =>
+ {
+ if (filterMods)
+ UpdateScores();
+ };
}
protected override APIRequest FetchScores(Action> scoresCallback)
{
if (Scope == BeatmapLeaderboardScope.Local)
{
- Scores = scoreManager
- .QueryScores(s => !s.DeletePending && s.Beatmap.ID == Beatmap.ID && s.Ruleset.ID == ruleset.Value.ID)
- .OrderByDescending(s => s.TotalScore).ToArray();
+ var scores = scoreManager
+ .QueryScores(s => !s.DeletePending && s.Beatmap.ID == Beatmap.ID && s.Ruleset.ID == ruleset.Value.ID);
+
+ if (filterMods && !mods.Value.Any())
+ {
+ // we need to filter out all scores that have any mods to get all local nomod scores
+ scores = scores.Where(s => !s.Mods.Any());
+ }
+ else if (filterMods)
+ {
+ // otherwise find all the scores that have *any* of the currently selected mods (similar to how web applies mod filters)
+ // we're creating and using a string list representation of selected mods so that it can be translated into the DB query itself
+ var selectedMods = mods.Value.Select(m => m.Acronym);
+ scores = scores.Where(s => s.Mods.Any(m => selectedMods.Contains(m.Acronym)));
+ }
+
+ Scores = scores.OrderByDescending(s => s.TotalScore).ToArray();
PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores;
+
return null;
}
- if (Beatmap?.OnlineBeatmapID == null)
+ if (api?.IsLoggedIn != true)
+ {
+ PlaceholderState = PlaceholderState.NotLoggedIn;
+ return null;
+ }
+
+ if (Beatmap?.OnlineBeatmapID == null || Beatmap?.Status <= BeatmapSetOnlineStatus.Pending)
{
PlaceholderState = PlaceholderState.Unavailable;
return null;
}
- if (Scope != BeatmapLeaderboardScope.Global && !api.LocalUser.Value.IsSupporter)
+ if (!api.LocalUser.Value.IsSupporter && (Scope != BeatmapLeaderboardScope.Global || filterMods))
{
PlaceholderState = PlaceholderState.NotSupporter;
return null;
}
- var req = new GetScoresRequest(Beatmap, ruleset.Value ?? Beatmap.Ruleset, Scope);
+ IReadOnlyList requestMods = null;
+
+ if (filterMods && !mods.Value.Any())
+ // add nomod for the request
+ requestMods = new Mod[] { new ModNoMod() };
+ else if (filterMods)
+ requestMods = mods.Value;
+
+ var req = new GetScoresRequest(Beatmap, ruleset.Value ?? Beatmap.Ruleset, Scope, requestMods);
req.Success += r => scoresCallback?.Invoke(r.Scores);
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 3581ed5534..0eeffda5eb 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -35,6 +35,7 @@ using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
+using osu.Game.Scoring;
namespace osu.Game.Screens.Select
{
@@ -86,6 +87,9 @@ namespace osu.Game.Screens.Select
private readonly Bindable decoupledRuleset = new Bindable();
+ [Resolved(canBeNull: true)]
+ private MusicController music { get; set; }
+
[Cached]
[Cached(Type = typeof(IBindable>))]
private readonly Bindable> mods = new Bindable>(Array.Empty()); // Bound to the game's mods, but is not reset on exiting
@@ -215,7 +219,7 @@ namespace osu.Game.Screens.Select
}
[BackgroundDependencyLoader(true)]
- private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins)
+ private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
{
mods.BindTo(Mods);
@@ -252,7 +256,7 @@ namespace osu.Game.Screens.Select
if (!beatmaps.GetAllUsableBeatmapSets().Any() && beatmaps.StableInstallationAvailable)
dialogOverlay.Push(new ImportFromStablePopup(() =>
{
- Task.Run(beatmaps.ImportFromStableAsync);
+ Task.Run(beatmaps.ImportFromStableAsync).ContinueWith(_ => scores.ImportFromStableAsync(), TaskContinuationOptions.OnlyOnRanToCompletion);
Task.Run(skins.ImportFromStableAsync);
}));
});
@@ -569,7 +573,7 @@ namespace osu.Game.Screens.Select
{
Track track = Beatmap.Value.Track;
- if (!track.IsRunning || restart)
+ if ((!track.IsRunning || restart) && music?.IsUserPaused != true)
{
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
track.Restart();
diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs
index 73cc47ea47..70abfac501 100644
--- a/osu.Game/Skinning/SkinManager.cs
+++ b/osu.Game/Skinning/SkinManager.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
@@ -54,6 +55,8 @@ namespace osu.Game.Skinning
};
}
+ protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == ".osk";
+
///
/// Returns a list of all usable s. Includes the special default skin plus all skins from .
///
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index e872cd1387..436ba90a88 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/osu.iOS.props b/osu.iOS.props
index a319094cb1..c24349bcb5 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -105,8 +105,8 @@
-
-
+
+