diff --git a/osu-framework b/osu-framework index c6fd291492..fe49ccb3c8 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit c6fd2914926f2a6df23eda536c0310f072581b1b +Subproject commit fe49ccb3c8f8661d653752d225ae1dc183944bb4 diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 0e4935aa7a..7126b6586d 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps protected override IEnumerable ConvertHitObject(HitObject obj, Beatmap beatmap) { var curveData = obj as IHasCurve; - var positionData = obj as IHasPosition; + var positionData = obj as IHasXPosition; var comboData = obj as IHasCombo; if (positionData == null) diff --git a/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs b/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs index 802d4cc99d..aab784f177 100644 --- a/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs @@ -26,8 +26,6 @@ namespace osu.Game.Rulesets.Mania.Tests private const double start_time = 500; private const double duration = 500; - public override string Description => @"Mania playfield"; - protected override double TimePerAction => 200; private RulesetInfo maniaRuleset; diff --git a/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs index 059d297401..555f9bb0da 100644 --- a/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs @@ -30,8 +30,6 @@ namespace osu.Game.Rulesets.Taiko.Tests private const double default_duration = 1000; private const float scroll_time = 1000; - public override string Description => "Taiko playfield"; - protected override double TimePerAction => default_duration * 2; private readonly Random rng = new Random(1337); diff --git a/osu.Game.Tests/Visual/TestCaseAllPlayers.cs b/osu.Game.Tests/Visual/TestCaseAllPlayers.cs index 8c63e1a274..62b99487a9 100644 --- a/osu.Game.Tests/Visual/TestCaseAllPlayers.cs +++ b/osu.Game.Tests/Visual/TestCaseAllPlayers.cs @@ -5,6 +5,5 @@ namespace osu.Game.Tests.Visual { public class TestCaseAllPlayers : TestCasePlayer { - public override string Description => @"Showing everything to play the game."; } } diff --git a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs index a5156c155b..18555574ba 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs @@ -19,8 +19,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseBeatSyncedContainer : OsuTestCase { - public override string Description => @"Tests beat synced containers."; - private readonly MusicController mc; public TestCaseBeatSyncedContainer() diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs b/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs index 7dffa6d590..1a64994d0e 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs @@ -9,10 +9,9 @@ using OpenTK; namespace osu.Game.Tests.Visual { [TestFixture] + [System.ComponentModel.Description("PlaySongSelect leaderboard/details area")] internal class TestCaseBeatmapDetailArea : OsuTestCase { - public override string Description => @"Beatmap details in song select"; - public TestCaseBeatmapDetailArea() { Add(new BeatmapDetailArea @@ -23,4 +22,4 @@ namespace osu.Game.Tests.Visual }); } } -} \ No newline at end of file +} diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs b/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs index b31eded9a0..248ec6d43d 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; using System.Linq; using osu.Framework.Graphics; using osu.Game.Beatmaps; @@ -8,10 +9,9 @@ using osu.Game.Screens.Select; namespace osu.Game.Tests.Visual { + [Description("PlaySongSelect beatmap details")] internal class TestCaseBeatmapDetails : OsuTestCase { - public override string Description => "BeatmapDetails tab of BeatmapDetailArea"; - public TestCaseBeatmapDetails() { BeatmapDetails details; diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs b/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs index bdc2e0e105..e114fac96e 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; using osu.Game.Graphics; using osu.Game.Screens.Select.Options; using OpenTK.Graphics; @@ -8,10 +9,9 @@ using OpenTK.Input; namespace osu.Game.Tests.Visual { + [Description("bottom beatmap details")] internal class TestCaseBeatmapOptionsOverlay : OsuTestCase { - public override string Description => @"Beatmap options in song select"; - public TestCaseBeatmapOptionsOverlay() { var overlay = new BeatmapOptionsOverlay(); diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs index 8cae3feae2..cef8797f20 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs @@ -3,7 +3,6 @@ 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; @@ -14,13 +13,13 @@ using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Users; using System.Collections.Generic; +using osu.Framework.Graphics.Containers; namespace osu.Game.Tests.Visual { + [System.ComponentModel.Description("in BeatmapOverlay")] public class TestCaseBeatmapScoresContainer : OsuTestCase { - public override string Description => "BeatmapOverlay scores container"; - private readonly IEnumerable scores; private readonly IEnumerable anotherScores; private readonly OnlineScore topScore; diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs index c2de4ec05d..c24e13b7fb 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs @@ -14,8 +14,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseBeatmapSetOverlay : OsuTestCase { - public override string Description => @"view online beatmap sets"; - private readonly BeatmapSetOverlay overlay; public TestCaseBeatmapSetOverlay() diff --git a/osu.Game.Tests/Visual/TestCaseBreadcrumbs.cs b/osu.Game.Tests/Visual/TestCaseBreadcrumbs.cs index 97c343f8ac..50abd11e79 100644 --- a/osu.Game.Tests/Visual/TestCaseBreadcrumbs.cs +++ b/osu.Game.Tests/Visual/TestCaseBreadcrumbs.cs @@ -8,8 +8,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseBreadcrumbs : OsuTestCase { - public override string Description => @"breadcrumb > control"; - public TestCaseBreadcrumbs() { BreadcrumbControl c; diff --git a/osu.Game.Tests/Visual/TestCaseBreakOverlay.cs b/osu.Game.Tests/Visual/TestCaseBreakOverlay.cs index 206ca308cf..dcb3b74654 100644 --- a/osu.Game.Tests/Visual/TestCaseBreakOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseBreakOverlay.cs @@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseBreakOverlay : OsuTestCase { - public override string Description => @"Tests breaks behavior"; - private readonly BreakOverlay breakOverlay; public TestCaseBreakOverlay() @@ -88,4 +86,4 @@ namespace osu.Game.Tests.Visual }; } } -} \ No newline at end of file +} diff --git a/osu.Game.Tests/Visual/TestCaseButtonSystem.cs b/osu.Game.Tests/Visual/TestCaseButtonSystem.cs new file mode 100644 index 0000000000..d260de69f1 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseButtonSystem.cs @@ -0,0 +1,33 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Shapes; +using osu.Game.Screens.Menu; +using OpenTK.Graphics; + +namespace osu.Game.Tests.Visual +{ + internal class TestCaseButtonSystem : OsuTestCase + { + public TestCaseButtonSystem() + { + OsuLogo logo; + ButtonSystem buttons; + + Children = new Drawable[] + { + new Box + { + Colour = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke), + RelativeSizeAxes = Axes.Both, + }, + buttons = new ButtonSystem(), + logo = new OsuLogo() + }; + + buttons.SetOsuLogo(logo); + } + } +} diff --git a/osu.Game.Tests/Visual/TestCaseChatDisplay.cs b/osu.Game.Tests/Visual/TestCaseChatDisplay.cs index 847593fcec..85ee224a5e 100644 --- a/osu.Game.Tests/Visual/TestCaseChatDisplay.cs +++ b/osu.Game.Tests/Visual/TestCaseChatDisplay.cs @@ -1,15 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; using osu.Framework.Graphics.Containers; using osu.Game.Overlays; namespace osu.Game.Tests.Visual { + [Description("Testing chat api and overlay")] internal class TestCaseChatDisplay : OsuTestCase { - public override string Description => @"Testing chat api and overlay"; - public TestCaseChatDisplay() { Add(new ChatOverlay diff --git a/osu.Game.Tests/Visual/TestCaseContextMenu.cs b/osu.Game.Tests/Visual/TestCaseContextMenu.cs index 91a766f8c7..6f5cb398d7 100644 --- a/osu.Game.Tests/Visual/TestCaseContextMenu.cs +++ b/osu.Game.Tests/Visual/TestCaseContextMenu.cs @@ -15,8 +15,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseContextMenu : OsuTestCase { - public override string Description => @"Menu visible on right click"; - private const int start_time = 0; private const int duration = 1000; diff --git a/osu.Game.Tests/Visual/TestCaseDialogOverlay.cs b/osu.Game.Tests/Visual/TestCaseDialogOverlay.cs index a031125b3a..f1aba908f0 100644 --- a/osu.Game.Tests/Visual/TestCaseDialogOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseDialogOverlay.cs @@ -9,8 +9,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseDialogOverlay : OsuTestCase { - public override string Description => @"Display dialogs"; - public TestCaseDialogOverlay() { DialogOverlay overlay; diff --git a/osu.Game.Tests/Visual/TestCaseDirect.cs b/osu.Game.Tests/Visual/TestCaseDirect.cs index 2d8677c391..ede17fa775 100644 --- a/osu.Game.Tests/Visual/TestCaseDirect.cs +++ b/osu.Game.Tests/Visual/TestCaseDirect.cs @@ -11,8 +11,6 @@ namespace osu.Game.Tests.Visual { public class TestCaseDirect : OsuTestCase { - public override string Description => @"osu!direct overlay"; - private DirectOverlay direct; private RulesetStore rulesets; diff --git a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs index 7113bcbff5..a51cf8ca95 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs +++ b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs @@ -14,8 +14,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseDrawableRoom : OsuTestCase { - public override string Description => @"Select your favourite room"; - private RulesetStore rulesets; protected override void LoadComplete() diff --git a/osu.Game.Tests/Visual/TestCaseDrawings.cs b/osu.Game.Tests/Visual/TestCaseDrawings.cs index c805d88cb4..e5692b29de 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawings.cs +++ b/osu.Game.Tests/Visual/TestCaseDrawings.cs @@ -2,15 +2,15 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.ComponentModel; using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament.Teams; namespace osu.Game.Tests.Visual { + [Description("for tournament use")] internal class TestCaseDrawings : OsuTestCase { - public override string Description => "Tournament drawings"; - public TestCaseDrawings() { Add(new Drawings diff --git a/osu.Game.Tests/Visual/TestCaseGamefield.cs b/osu.Game.Tests/Visual/TestCaseGamefield.cs index af86b6ec06..0d8f4cb5f7 100644 --- a/osu.Game.Tests/Visual/TestCaseGamefield.cs +++ b/osu.Game.Tests/Visual/TestCaseGamefield.cs @@ -7,8 +7,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseGamefield : OsuTestCase { - public override string Description => @"Showing hitobjects and what not."; - protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game.Tests/Visual/TestCaseGraph.cs b/osu.Game.Tests/Visual/TestCaseGraph.cs index 714f284879..fb1a3ef3f6 100644 --- a/osu.Game.Tests/Visual/TestCaseGraph.cs +++ b/osu.Game.Tests/Visual/TestCaseGraph.cs @@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseGraph : OsuTestCase { - public override string Description => "graph"; - public TestCaseGraph() { BarGraph graph; @@ -36,4 +34,4 @@ namespace osu.Game.Tests.Visual AddStep("Right to left", () => graph.Direction = BarDirection.RightToLeft); } } -} \ No newline at end of file +} diff --git a/osu.Game.Tests/Visual/TestCaseIconButton.cs b/osu.Game.Tests/Visual/TestCaseIconButton.cs index acde9df4a9..345316708e 100644 --- a/osu.Game.Tests/Visual/TestCaseIconButton.cs +++ b/osu.Game.Tests/Visual/TestCaseIconButton.cs @@ -14,8 +14,6 @@ namespace osu.Game.Tests.Visual { public class TestCaseIconButton : OsuTestCase { - public override string Description => "Various display modes of icon buttons"; - public TestCaseIconButton() { Child = new FillFlowContainer diff --git a/osu.Game.Tests/Visual/TestCaseKeyConfiguration.cs b/osu.Game.Tests/Visual/TestCaseKeyConfiguration.cs index e473ce8778..d39ac12a60 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyConfiguration.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyConfiguration.cs @@ -9,8 +9,6 @@ namespace osu.Game.Tests.Visual { private readonly KeyBindingOverlay overlay; - public override string Description => @"Key configuration"; - public TestCaseKeyConfiguration() { Child = overlay = new KeyBindingOverlay(); diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index 622fb15f4f..df122b7132 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseKeyCounter : OsuTestCase { - public override string Description => @"Tests key counter"; - public TestCaseKeyCounter() { KeyCounterCollection kc = new KeyCounterCollection diff --git a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs b/osu.Game.Tests/Visual/TestCaseLeaderboard.cs index 832003e6ab..9d6fb3a4ec 100644 --- a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs +++ b/osu.Game.Tests/Visual/TestCaseLeaderboard.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; using osu.Framework.Graphics; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Select.Leaderboards; @@ -9,10 +10,9 @@ using OpenTK; namespace osu.Game.Tests.Visual { + [Description("PlaySongSelect leaderboard")] internal class TestCaseLeaderboard : OsuTestCase { - public override string Description => @"From song select"; - private readonly Leaderboard leaderboard; private void newScores() diff --git a/osu.Game.Tests/Visual/TestCaseMedalOverlay.cs b/osu.Game.Tests/Visual/TestCaseMedalOverlay.cs index 9a26eefd63..fbee27668c 100644 --- a/osu.Game.Tests/Visual/TestCaseMedalOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseMedalOverlay.cs @@ -11,8 +11,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseMedalOverlay : OsuTestCase { - public override string Description => @"medal get!"; - public override IReadOnlyList RequiredTypes => new[] { typeof(MedalOverlay), diff --git a/osu.Game.Tests/Visual/TestCaseMenuButtonSystem.cs b/osu.Game.Tests/Visual/TestCaseMenuButtonSystem.cs deleted file mode 100644 index 0b50c9cf47..0000000000 --- a/osu.Game.Tests/Visual/TestCaseMenuButtonSystem.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Shapes; -using osu.Game.Screens.Menu; -using OpenTK.Graphics; - -namespace osu.Game.Tests.Visual -{ - internal class TestCaseMenuButtonSystem : OsuTestCase - { - public override string Description => @"Main menu button system"; - - public TestCaseMenuButtonSystem() - { - Add(new Box - { - Colour = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke), - RelativeSizeAxes = Framework.Graphics.Axes.Both, - }); - Add(new ButtonSystem()); - } - } -} diff --git a/osu.Game.Tests/Visual/TestCaseMenuOverlays.cs b/osu.Game.Tests/Visual/TestCaseMenuOverlays.cs index e27de96bee..94a69f0029 100644 --- a/osu.Game.Tests/Visual/TestCaseMenuOverlays.cs +++ b/osu.Game.Tests/Visual/TestCaseMenuOverlays.cs @@ -1,16 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; using osu.Framework.Graphics.Containers; using osu.Framework.Logging; using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual { + [Description("player pause/fail screens")] internal class TestCaseMenuOverlays : OsuTestCase { - public override string Description => @"Tests pause and fail overlays"; - public TestCaseMenuOverlays() { FailOverlay failOverlay; diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index 0447d6582d..5270ac0dc9 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Overlays.Mods; @@ -10,10 +11,9 @@ using OpenTK; namespace osu.Game.Tests.Visual { + [Description("mod select and icon display")] internal class TestCaseMods : OsuTestCase { - public override string Description => @"Mod select overlay and in-game display"; - private ModSelectOverlay modSelect; private ModDisplay modDisplay; diff --git a/osu.Game.Tests/Visual/TestCaseMusicController.cs b/osu.Game.Tests/Visual/TestCaseMusicController.cs index 323c32bf10..3c544bb968 100644 --- a/osu.Game.Tests/Visual/TestCaseMusicController.cs +++ b/osu.Game.Tests/Visual/TestCaseMusicController.cs @@ -13,8 +13,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseMusicController : OsuTestCase { - public override string Description => @"Tests music controller ui."; - private readonly Bindable beatmapBacking = new Bindable(); public TestCaseMusicController() diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index ed331076b2..3dca860909 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -15,8 +15,6 @@ namespace osu.Game.Tests.Visual [TestFixture] internal class TestCaseNotificationOverlay : OsuTestCase { - public override string Description => @"I handle notifications"; - private readonly NotificationOverlay manager; public TestCaseNotificationOverlay() diff --git a/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs b/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs index 8749d240f8..c3a755f3ca 100644 --- a/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs +++ b/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs @@ -12,8 +12,6 @@ namespace osu.Game.Tests.Visual private FrameworkConfigManager config; private Bindable frameSyncMode; - public override string Description => @"Make it easier to see setting changes"; - protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 37dd60a25c..7c070fd3df 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -22,8 +22,6 @@ namespace osu.Game.Tests.Visual { private BeatmapManager manager; - public override string Description => @"with fake data"; - private RulesetStore rulesets; private DependencyContainer dependencies; diff --git a/osu.Game.Tests/Visual/TestCaseReplay.cs b/osu.Game.Tests/Visual/TestCaseReplay.cs index 2e56daccfc..62c8a64916 100644 --- a/osu.Game.Tests/Visual/TestCaseReplay.cs +++ b/osu.Game.Tests/Visual/TestCaseReplay.cs @@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseReplay : TestCasePlayer { - public override string Description => @"Testing replay playback."; - protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) { beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() }); diff --git a/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs b/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs index 3105a7d588..22a2d717e4 100644 --- a/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs @@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseReplaySettingsOverlay : OsuTestCase { - public override string Description => @"Settings visible in replay/auto"; - public TestCaseReplaySettingsOverlay() { ExampleContainer container; diff --git a/osu.Game.Tests/Visual/TestCaseResults.cs b/osu.Game.Tests/Visual/TestCaseResults.cs index 62154a535a..f1bbb8fed6 100644 --- a/osu.Game.Tests/Visual/TestCaseResults.cs +++ b/osu.Game.Tests/Visual/TestCaseResults.cs @@ -15,8 +15,6 @@ namespace osu.Game.Tests.Visual { private BeatmapManager beatmaps; - public override string Description => @"Results after playing."; - [BackgroundDependencyLoader] private void load(BeatmapManager beatmaps) { diff --git a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs index e6b57c970b..51b6ae8e50 100644 --- a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs +++ b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs @@ -13,8 +13,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseRoomInspector : OsuTestCase { - public override string Description => @"from the multiplayer lobby"; - private RulesetStore rulesets; protected override void LoadComplete() diff --git a/osu.Game.Tests/Visual/TestCaseScoreCounter.cs b/osu.Game.Tests/Visual/TestCaseScoreCounter.cs index 543ff12fcb..5a04000900 100644 --- a/osu.Game.Tests/Visual/TestCaseScoreCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseScoreCounter.cs @@ -12,8 +12,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseScoreCounter : OsuTestCase { - public override string Description => @"Tests multiple counters"; - public TestCaseScoreCounter() { int numerator = 0, denominator = 0; diff --git a/osu.Game.Tests/Visual/TestCaseSettings.cs b/osu.Game.Tests/Visual/TestCaseSettings.cs index dfc0b66e21..63d798cd53 100644 --- a/osu.Game.Tests/Visual/TestCaseSettings.cs +++ b/osu.Game.Tests/Visual/TestCaseSettings.cs @@ -7,8 +7,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseSettings : OsuTestCase { - public override string Description => @"Tests the settings overlay"; - private readonly SettingsOverlay settings; public TestCaseSettings() diff --git a/osu.Game.Tests/Visual/TestCaseSkipButton.cs b/osu.Game.Tests/Visual/TestCaseSkipButton.cs index 49be015adf..40c8baaac8 100644 --- a/osu.Game.Tests/Visual/TestCaseSkipButton.cs +++ b/osu.Game.Tests/Visual/TestCaseSkipButton.cs @@ -7,8 +7,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseSkipButton : OsuTestCase { - public override string Description => @"Skip skip skippediskip"; - protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game.Tests/Visual/TestCaseSocial.cs b/osu.Game.Tests/Visual/TestCaseSocial.cs index 4f90e4ceff..ff0707c8ab 100644 --- a/osu.Game.Tests/Visual/TestCaseSocial.cs +++ b/osu.Game.Tests/Visual/TestCaseSocial.cs @@ -8,8 +8,6 @@ namespace osu.Game.Tests.Visual { public class TestCaseSocial : OsuTestCase { - public override string Description => @"social browser overlay"; - public TestCaseSocial() { SocialOverlay s = new SocialOverlay diff --git a/osu.Game.Tests/Visual/TestCaseSongProgress.cs b/osu.Game.Tests/Visual/TestCaseSongProgress.cs index 96ff76e9c6..1e6886cda9 100644 --- a/osu.Game.Tests/Visual/TestCaseSongProgress.cs +++ b/osu.Game.Tests/Visual/TestCaseSongProgress.cs @@ -12,8 +12,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseSongProgress : OsuTestCase { - public override string Description => @"With fake data"; - private readonly SongProgress progress; private readonly SongProgressGraph graph; diff --git a/osu.Game.Tests/Visual/TestCaseStoryboard.cs b/osu.Game.Tests/Visual/TestCaseStoryboard.cs index c6ef3f4ecf..1dad106cbe 100644 --- a/osu.Game.Tests/Visual/TestCaseStoryboard.cs +++ b/osu.Game.Tests/Visual/TestCaseStoryboard.cs @@ -16,8 +16,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseStoryboard : OsuTestCase { - public override string Description => @"Tests storyboards."; - private readonly Bindable beatmapBacking = new Bindable(); private readonly Container storyboardContainer; diff --git a/osu.Game.Tests/Visual/TestCaseTabControl.cs b/osu.Game.Tests/Visual/TestCaseTabControl.cs index 6db74f2cfb..44a1732e16 100644 --- a/osu.Game.Tests/Visual/TestCaseTabControl.cs +++ b/osu.Game.Tests/Visual/TestCaseTabControl.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -9,10 +10,9 @@ using OpenTK; namespace osu.Game.Tests.Visual { + [Description("SongSelect filter control")] public class TestCaseTabControl : OsuTestCase { - public override string Description => @"Filter for song select"; - public TestCaseTabControl() { OsuSpriteText text; diff --git a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs b/osu.Game.Tests/Visual/TestCaseTextAwesome.cs index beec5ab271..37905a1883 100644 --- a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs +++ b/osu.Game.Tests/Visual/TestCaseTextAwesome.cs @@ -12,8 +12,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseTextAwesome : OsuTestCase { - public override string Description => @"Tests display of icons"; - public TestCaseTextAwesome() { FillFlowContainer flow; diff --git a/osu.Game.Tests/Visual/TestCaseTwoLayerButton.cs b/osu.Game.Tests/Visual/TestCaseTwoLayerButton.cs index 83e0e4b442..bd5c10d147 100644 --- a/osu.Game.Tests/Visual/TestCaseTwoLayerButton.cs +++ b/osu.Game.Tests/Visual/TestCaseTwoLayerButton.cs @@ -1,14 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; using osu.Game.Graphics.UserInterface; namespace osu.Game.Tests.Visual { + [Description("mostly back button")] internal class TestCaseTwoLayerButton : OsuTestCase { - public override string Description => @"Mostly back button"; - public TestCaseTwoLayerButton() { Add(new BackButton()); diff --git a/osu.Game.Tests/Visual/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/TestCaseUserPanel.cs index 8523a754f8..8d94a0c90f 100644 --- a/osu.Game.Tests/Visual/TestCaseUserPanel.cs +++ b/osu.Game.Tests/Visual/TestCaseUserPanel.cs @@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseUserPanel : OsuTestCase { - public override string Description => @"Panels for displaying a user's status"; - public TestCaseUserPanel() { UserPanel flyte; diff --git a/osu.Game.Tests/Visual/TestCaseUserProfile.cs b/osu.Game.Tests/Visual/TestCaseUserProfile.cs index f5fced2915..90daf1e996 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Game.Tests/Visual/TestCaseUserProfile.cs @@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseUserProfile : OsuTestCase { - public override string Description => "Tests user's profile page."; - public TestCaseUserProfile() { var profile = new UserProfileOverlay(); diff --git a/osu.Game.Tests/Visual/TestCaseUserRanks.cs b/osu.Game.Tests/Visual/TestCaseUserRanks.cs index e17f0e1a46..eb0678203c 100644 --- a/osu.Game.Tests/Visual/TestCaseUserRanks.cs +++ b/osu.Game.Tests/Visual/TestCaseUserRanks.cs @@ -15,8 +15,6 @@ namespace osu.Game.Tests.Visual { internal class TestCaseUserRanks : OsuTestCase { - public override string Description => "showing your latest achievements"; - public override IReadOnlyList RequiredTypes => new[] { typeof(DrawableScore), typeof(RanksSection) }; public TestCaseUserRanks() diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 9bba09b1a7..312a564f71 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -116,7 +116,7 @@ - + diff --git a/osu.Game/Beatmaps/BeatmapMetrics.cs b/osu.Game/Beatmaps/BeatmapMetrics.cs index 730cf635da..e0cd5f10e7 100644 --- a/osu.Game/Beatmaps/BeatmapMetrics.cs +++ b/osu.Game/Beatmaps/BeatmapMetrics.cs @@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps public class BeatmapMetrics { /// - /// Total vote counts of user ratings on a scale of 0..length. + /// Total vote counts of user ratings on a scale of 0..10 where 0 is unused (probably will be fixed at API?). /// public IEnumerable Ratings { get; set; } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 917376969b..85daefea57 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -64,11 +64,7 @@ namespace osu.Game.Beatmaps.Drawables { RelativeSizeAxes = Axes.Both, OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), - } - ) - { - TimeBeforeLoad = 300, - }, + }, 300), new FillFlowContainer { Direction = FillDirection.Vertical, diff --git a/osu.Game/Database/DatabaseBackedStore.cs b/osu.Game/Database/DatabaseBackedStore.cs index bc1b7132eb..d8c3ce6694 100644 --- a/osu.Game/Database/DatabaseBackedStore.cs +++ b/osu.Game/Database/DatabaseBackedStore.cs @@ -35,6 +35,7 @@ namespace osu.Game.Database var id = obj.ID; obj = lookupSource?.SingleOrDefault(t => t.ID == id) ?? context.Find(id); + context.Entry(obj).Reload(); } /// diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 20df553142..c25a9bf5e9 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -20,6 +20,7 @@ namespace osu.Game.Graphics.UserInterface private const Easing easing = Easing.InOutCubic; private float length; + /// /// Length of the bar, ranges from 0 to 1 /// @@ -134,4 +135,4 @@ namespace osu.Game.Graphics.UserInterface Vertical = TopToBottom | BottomToTop, Horizontal = LeftToRight | RightToLeft, } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 27ef6208be..af59b21713 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -56,20 +56,17 @@ namespace osu.Game.Overlays.BeatmapSet videoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 1 : 0, transition_duration); cover?.FadeOut(400, Easing.Out); - coverContainer.Add(cover = new DelayedLoadWrapper(new BeatmapSetCover(BeatmapSet) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fill, - OnLoadComplete = d => + coverContainer.Add(cover = new DelayedLoadWrapper( + new BeatmapSetCover(BeatmapSet) { - d.FadeInFromZero(400, Easing.Out); - }, - }) + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), + }, 300) { RelativeSizeAxes = Axes.Both, - TimeBeforeLoad = 300 }); } } @@ -232,7 +229,7 @@ namespace osu.Game.Overlays.BeatmapSet protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - beatmaps.BeatmapSetAdded -= handleBeatmapAdd; + if (beatmaps != null) beatmaps.BeatmapSetAdded -= handleBeatmapAdd; } private void handleBeatmapAdd(BeatmapSetInfo beatmap) diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index b8a8528962..a55de951f1 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -212,21 +212,21 @@ namespace osu.Game.Overlays.Direct return icons; } - protected Drawable CreateBackground() => new DelayedLoadWrapper(new BeatmapSetCover(SetInfo) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fill, - OnLoadComplete = d => + protected Drawable CreateBackground() => new DelayedLoadWrapper( + new BeatmapSetCover(SetInfo) { - d.FadeInFromZero(400, Easing.Out); - BlackBackground.Delay(400).FadeOut(); - }, - }) + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fill, + OnLoadComplete = d => + { + d.FadeInFromZero(400, Easing.Out); + BlackBackground.Delay(400).FadeOut(); + }, + }, 300) { RelativeSizeAxes = Axes.Both, - TimeBeforeLoad = 300 }; public class Statistic : FillFlowContainer diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 9317bc06cf..75a3358d51 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -146,18 +146,17 @@ namespace osu.Game.Overlays.Direct loading = true; - Add(new AsyncLoadWrapper(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.OnlineBeatmapSetID}.mp3") - { - OnLoadComplete = d => + LoadComponentAsync(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.OnlineBeatmapSetID}.mp3"), + d => { - // we may have been replaced by another loader + // We may have been replaced by another loader if (trackLoader != d) return; - Preview = (d as TrackLoader)?.Preview; + Preview = d?.Preview; Playing.TriggerChange(); loading = false; - }, - })); + Add(trackLoader); + }); } private class TrackLoader : Drawable diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 22e34be34c..c7bc5c1d93 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -316,19 +316,16 @@ namespace osu.Game.Overlays.Profile private void loadUser() { - coverContainer.Add(new AsyncLoadWrapper(new UserCoverBackground(user) + LoadComponentAsync(new UserCoverBackground(user) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(200) - }) - { - Masking = true, - RelativeSizeAxes = Axes.Both, - Depth = float.MaxValue - }); + OnLoadComplete = d => d.FadeInFromZero(200), + Depth = float.MaxValue, + }, + coverContainer.Add); if (user.IsSupporter) supporterTag.Show(); diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs new file mode 100644 index 0000000000..8a835634b8 --- /dev/null +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -0,0 +1,134 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Users; + +namespace osu.Game.Overlays.Profile.Sections.Kudosu +{ + public class KudosuInfo : Container + { + private readonly Bindable user = new Bindable(); + + public KudosuInfo(Bindable user) + { + this.user.BindTo(user); + + CountSection total; + CountSection avaliable; + + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Masking = true; + CornerRadius = 3; + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Offset = new Vector2(0f, 1f), + Radius = 3f, + Colour = Color4.Black.Opacity(0.2f), + }; + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.2f) + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new[] + { + total = new CountSection( + "Total Kudosu Earned", + "Based on how much of a contribution the user has made to beatmap moderation. See this link for more information." + ), + avaliable = new CountSection( + "Kudosu Avaliable", + "Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet." + ), + } + } + }; + + this.user.ValueChanged += newUser => + { + total.Count = newUser?.Kudosu.Total ?? 0; + avaliable.Count = newUser?.Kudosu.Available ?? 0; + }; + } + + protected override bool OnClick(InputState state) => true; + + private class CountSection : Container + { + private readonly OsuSpriteText valueText; + + public int Count + { + set { valueText.Text = value.ToString(); } + } + + public CountSection(string header, string description) + { + RelativeSizeAxes = Axes.X; + Width = 0.5f; + AutoSizeAxes = Axes.Y; + Padding = new MarginPadding { Horizontal = 10, Top = 10, Bottom = 20 }; + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Text = header + ":", + TextSize = 20, + Font = @"Exo2.0-RegularItalic", + }, + valueText = new OsuSpriteText + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Text = "0", + TextSize = 40, + UseFullGlyphHeight = false, + Font = @"Exo2.0-RegularItalic" + } + } + }, + new TextFlowContainer(t => { t.TextSize = 19; }) + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Text = description + } + } + }; + } + } + } +} diff --git a/osu.Game/Overlays/Profile/Sections/KudosuSection.cs b/osu.Game/Overlays/Profile/Sections/KudosuSection.cs index 3c36368fd7..907c26e5e8 100644 --- a/osu.Game/Overlays/Profile/Sections/KudosuSection.cs +++ b/osu.Game/Overlays/Profile/Sections/KudosuSection.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Overlays.Profile.Sections.Kudosu; + namespace osu.Game.Overlays.Profile.Sections { public class KudosuSection : ProfileSection @@ -8,5 +10,13 @@ namespace osu.Game.Overlays.Profile.Sections public override string Title => "Kudosu!"; public override string Identifier => "kudosu"; + + public KudosuSection() + { + Children = new[] + { + new KudosuInfo(User), + }; + } } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index dd31a43290..7374a9aa44 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -97,7 +97,7 @@ namespace osu.Game.Overlays //new MedalsSection(), new HistoricalSection(), new BeatmapsSection(), - //new KudosuSection() + new KudosuSection() }; tabs = new ProfileTabControl { diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index d2f88224c2..0ba4aaa364 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -228,16 +228,16 @@ namespace osu.Game.Screens.Multiplayer if (value != null) { coverContainer.FadeIn(transition_duration); - coverContainer.Children = new[] + + + LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet) { - new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), - }) { RelativeSizeAxes = Axes.Both }, - }; + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), + }, + coverContainer.Add); beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 66ce51b428..8d7401500f 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -329,17 +329,16 @@ namespace osu.Game.Screens.Multiplayer if (value != null) { coverContainer.FadeIn(transition_duration); - coverContainer.Children = new[] + + LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet) { - new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet) - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), - }) { RelativeSizeAxes = Axes.Both }, - }; + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), + }, + coverContainer.Add); beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index cd2818398d..a19305778c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -46,6 +46,8 @@ namespace osu.Game.Screens.Play public bool HasFailed { get; private set; } + public bool AllowPause { get; set; } = true; + public int RestartCount; private IAdjustableClock adjustableSourceClock; @@ -158,7 +160,7 @@ namespace osu.Game.Screens.Play FramedClock = offsetClock, OnRetry = Restart, OnQuit = Exit, - CheckCanPause = () => ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, + CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, Retries = RestartCount, OnPause = () => { hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused; @@ -248,7 +250,10 @@ namespace osu.Game.Screens.Play storyboard = beatmap.Storyboard.CreateDrawable(Beatmap.Value); storyboard.Masking = true; - storyboardContainer.Add(asyncLoad ? new AsyncLoadWrapper(storyboard) { RelativeSizeAxes = Axes.Both } : (Drawable)storyboard); + if (asyncLoad) + LoadComponentAsync(storyboard, storyboardContainer.Add); + else + storyboardContainer.Add(storyboard); } public void Restart() @@ -352,7 +357,7 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { - if (HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || RulesetContainer?.HasReplayLoaded != false) + if (!AllowPause || HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || RulesetContainer?.HasReplayLoaded != false) { // In the case of replays, we may have changed the playback rate. applyRateFromMods(); diff --git a/osu.Game/Screens/Select/Details/UserRatings.cs b/osu.Game/Screens/Select/Details/UserRatings.cs index 2153eb150c..997e0baec3 100644 --- a/osu.Game/Screens/Select/Details/UserRatings.cs +++ b/osu.Game/Screens/Select/Details/UserRatings.cs @@ -29,11 +29,17 @@ namespace osu.Game.Screens.Select.Details if (value == metrics) return; metrics = value; - var ratings = Metrics.Ratings.ToList(); - negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2 + 1).Sum().ToString(); - positiveRatings.Text = ratings.GetRange(ratings.Count / 2 + 1, ratings.Count / 2).Sum().ToString(); - ratingsBar.Length = (float)ratings.GetRange(0, ratings.Count / 2 + 1).Sum() / ratings.Sum(); - graph.Values = Metrics.Ratings.Select(r => (float)r); + const int rating_range = 10; + + var ratings = Metrics.Ratings.ToList().GetRange(1, rating_range); // adjust for API returning weird empty data at 0. + + var negativeCount = ratings.GetRange(0, rating_range / 2).Sum(); + var totalCount = ratings.Sum(); + + negativeRatings.Text = negativeCount.ToString(); + positiveRatings.Text = (totalCount - negativeCount).ToString(); + ratingsBar.Length = totalCount == 0 ? 0 : (float)negativeCount / totalCount; + graph.Values = ratings.GetRange(0, rating_range).Select(r => (float)r); } } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 7b50d36b44..03466439ad 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Select.Leaderboards private Box background; private Container content; - private Container avatar; + private Drawable avatar; private DrawableRank scoreRank; private OsuSpriteText nameLabel; private GlowingSpriteText scoreLabel; @@ -97,7 +97,7 @@ namespace osu.Game.Screens.Select.Leaderboards { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(edge_margin), - Children = new Drawable[] + Children = new[] { avatar = new DelayedLoadWrapper( new Avatar(Score.User) @@ -114,7 +114,6 @@ namespace osu.Game.Screens.Select.Leaderboards }, }) { - TimeBeforeLoad = 500, RelativeSizeAxes = Axes.None, Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), }, @@ -211,7 +210,7 @@ namespace osu.Game.Screens.Select.Leaderboards public override void Show() { - foreach (var d in new Drawable[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, maxCombo, accuracy, modsContainer }) + foreach (var d in new[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, maxCombo, accuracy, modsContainer }) d.FadeOut(); Alpha = 0; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 5500d06136..24a7b3db90 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -203,8 +203,8 @@ namespace osu.Game.Screens.Select Push(new Editor()); } - private void onBeatmapRestored(BeatmapInfo b) => carousel.UpdateBeatmap(b); - private void onBeatmapHidden(BeatmapInfo b) => carousel.UpdateBeatmap(b); + private void onBeatmapRestored(BeatmapInfo b) => Schedule(() => carousel.UpdateBeatmap(b)); + private void onBeatmapHidden(BeatmapInfo b) => Schedule(() => carousel.UpdateBeatmap(b)); private void carouselBeatmapsLoaded() { diff --git a/osu.Game/Tests/Visual/ScreenTestCase.cs b/osu.Game/Tests/Visual/ScreenTestCase.cs new file mode 100644 index 0000000000..2f0831d84a --- /dev/null +++ b/osu.Game/Tests/Visual/ScreenTestCase.cs @@ -0,0 +1,48 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Screens; +using osu.Game.Screens; + +namespace osu.Game.Tests.Visual +{ + /// + /// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions). + /// + public abstract class ScreenTestCase : OsuTestCase + { + private readonly TestOsuScreen baseScreen; + + protected ScreenTestCase() + { + Add(baseScreen = new TestOsuScreen()); + } + + protected void LoadScreen(OsuScreen screen) => baseScreen.LoadScreen(screen); + + public class TestOsuScreen : OsuScreen + { + private OsuScreen nextScreen; + + public void LoadScreen(OsuScreen screen) => Schedule(() => + { + nextScreen = screen; + + if (IsCurrentScreen) + { + Push(screen); + nextScreen = null; + } + else + MakeCurrent(); + }); + + protected override void OnResuming(Screen last) + { + base.OnResuming(last); + if (nextScreen != null) + LoadScreen(nextScreen); + } + } + } +} diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 5965be9717..f3a6d1efc3 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -17,14 +17,12 @@ using OpenTK.Graphics; namespace osu.Game.Tests.Visual { - public abstract class TestCasePlayer : OsuTestCase + public abstract class TestCasePlayer : ScreenTestCase { private readonly Type ruleset; protected Player Player; - public override string Description => @"Showing everything to play the game."; - /// /// Create a TestCase which runs through the Player screen. /// @@ -46,6 +44,7 @@ namespace osu.Game.Tests.Visual { RelativeSizeAxes = Framework.Graphics.Axes.Both, Colour = Color4.Black, + Depth = int.MaxValue }); string instantiation = ruleset?.AssemblyQualifiedName; @@ -79,19 +78,17 @@ namespace osu.Game.Tests.Visual if (Player != null) Remove(Player); - Add(Player = CreatePlayer(working, instance)); + LoadScreen(CreatePlayer(working, instance)); } - protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) + protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player { - return new Player - { - InitialBeatmap = beatmap - }; - } + InitialBeatmap = beatmap, + AllowPause = false + }; private const string test_beatmap_data = -@"osu file format v14 + @"osu file format v14 [General] AudioLeadIn: 500 diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index 7c020fce91..d55c0caad7 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -11,7 +11,7 @@ namespace osu.Game.Users /// public class UpdateableAvatar : Container { - private Container displayedAvatar; + private Drawable displayedAvatar; private User user; @@ -40,11 +40,13 @@ namespace osu.Game.Users { displayedAvatar?.FadeOut(300); displayedAvatar?.Expire(); - Add(displayedAvatar = new DelayedLoadWrapper(new Avatar(user) - { - RelativeSizeAxes = Axes.Both, - OnLoadComplete = d => d.FadeInFromZero(200), - })); + Add(displayedAvatar = new DelayedLoadWrapper( + new Avatar(user) + { + RelativeSizeAxes = Axes.Both, + OnLoadComplete = d => d.FadeInFromZero(200), + }) + ); } } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index ab4d55027d..1f235e3893 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -58,14 +58,14 @@ namespace osu.Game.Users Children = new Drawable[] { - new AsyncLoadWrapper(new UserCoverBackground(user) + new DelayedLoadWrapper(new UserCoverBackground(user) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(200), - }) { RelativeSizeAxes = Axes.Both }, + }, 0) { RelativeSizeAxes = Axes.Both }, new Box { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0752b31495..2aefde2916 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -292,6 +292,7 @@ + @@ -783,6 +784,7 @@ +