From 214154c5124a67670337cfed99b688420b81ac38 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 21 Dec 2017 20:23:10 +0100 Subject: [PATCH 01/69] hide unnecessary lines on empty BeatmapInfoWedge adding back deleted line ooops meh --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 34 +++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 3ef6ceeaeb..d18aebe43b 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -95,7 +95,7 @@ namespace osu.Game.Screens.Select List labels = new List(); - if (beatmap != null) + if (beatmap != null && !(working is DummyWorkingBeatmap)) { HitObject lastObject = beatmap.HitObjects.LastOrDefault(); double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; @@ -200,21 +200,7 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, - Children = new[] - { - new OsuSpriteText - { - Font = @"Exo2.0-Medium", - Text = "mapped by ", - TextSize = 15, - }, - new OsuSpriteText - { - Font = @"Exo2.0-Bold", - Text = metadata.Author.Username, - TextSize = 15, - }, - } + Children = working is DummyWorkingBeatmap ? Array.Empty() : getMapper(metadata) }, new FillFlowContainer { @@ -228,6 +214,22 @@ namespace osu.Game.Screens.Select }; } + private OsuSpriteText[] getMapper(BeatmapMetadata metadata) => new[] + { + new OsuSpriteText + { + Font = @"Exo2.0-Medium", + Text = "mapped by ", + TextSize = 15, + }, + new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = metadata.Author.Username, + TextSize = 15, + } + }; + private string getBPMRange(Beatmap beatmap) { double bpmMax = beatmap.ControlPointInfo.BPMMaximum; From 07f55a2a606a7d8a12973b637aa7e875c692b105 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 22 Dec 2017 10:18:25 +0100 Subject: [PATCH 02/69] remove references to DummyWorkingBeatmap determine content by data that is present instead --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 106 +++++++++++--------- 1 file changed, 60 insertions(+), 46 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d18aebe43b..9b9a009ac0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -89,34 +89,8 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load() { - BeatmapInfo beatmapInfo = working.BeatmapInfo; - BeatmapMetadata metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); - Beatmap beatmap = working.Beatmap; - - List labels = new List(); - - if (beatmap != null && !(working is DummyWorkingBeatmap)) - { - HitObject lastObject = beatmap.HitObjects.LastOrDefault(); - double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; - - labels.Add(new InfoLabel(new BeatmapStatistic - { - Name = "Length", - Icon = FontAwesome.fa_clock_o, - Content = beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), - })); - - labels.Add(new InfoLabel(new BeatmapStatistic - { - Name = "BPM", - Icon = FontAwesome.fa_circle, - Content = getBPMRange(beatmap), - })); - - //get statistics from the current ruleset. - labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(working).Select(s => new InfoLabel(s))); - } + var beatmapInfo = working.BeatmapInfo; + var metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); PixelSnapping = true; CacheDrawnFrameBuffer = true; @@ -186,7 +160,7 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Font = @"Exo2.0-MediumItalic", - Text = !string.IsNullOrEmpty(metadata.Source) ? metadata.Source + " — " + metadata.Title : metadata.Title, + Text = string.IsNullOrEmpty(metadata.Source) ? metadata.Title : metadata.Source + " — " + metadata.Title, TextSize = 28, }, new OsuSpriteText @@ -200,46 +174,86 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, - Children = working is DummyWorkingBeatmap ? Array.Empty() : getMapper(metadata) + Children = getMapper(metadata) }, new FillFlowContainer { Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(20, 0), AutoSizeAxes = Axes.Both, - Children = labels - }, + Children = getInfoLabels() + } } - }, + } }; } - private OsuSpriteText[] getMapper(BeatmapMetadata metadata) => new[] + private InfoLabel[] getInfoLabels() { - new OsuSpriteText + var beatmap = working.Beatmap; + var info = working.BeatmapInfo; + + List labels = new List(); + + if (beatmap?.HitObjects?.Count > 0) { - Font = @"Exo2.0-Medium", - Text = "mapped by ", - TextSize = 15, - }, - new OsuSpriteText - { - Font = @"Exo2.0-Bold", - Text = metadata.Author.Username, - TextSize = 15, + HitObject lastObject = beatmap.HitObjects.LastOrDefault(); + double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; + + labels.Add(new InfoLabel(new BeatmapStatistic + { + Name = "Length", + Icon = FontAwesome.fa_clock_o, + Content = beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), + })); + + labels.Add(new InfoLabel(new BeatmapStatistic + { + Name = "BPM", + Icon = FontAwesome.fa_circle, + Content = getBPMRange(beatmap), + })); + + //get statistics from the current ruleset. + labels.AddRange(info.Ruleset.CreateInstance().GetBeatmapStatistics(working).Select(s => new InfoLabel(s))); } - }; + + return labels.ToArray(); + } private string getBPMRange(Beatmap beatmap) { double bpmMax = beatmap.ControlPointInfo.BPMMaximum; double bpmMin = beatmap.ControlPointInfo.BPMMinimum; - if (Precision.AlmostEquals(bpmMin, bpmMax)) return $"{bpmMin:0}"; + if (Precision.AlmostEquals(bpmMin, bpmMax)) + return $"{bpmMin:0}"; return $"{bpmMin:0}-{bpmMax:0} (mostly {beatmap.ControlPointInfo.BPMMode:0})"; } + private OsuSpriteText[] getMapper(BeatmapMetadata metadata) + { + if (string.IsNullOrEmpty(metadata.Author?.Username)) + return Array.Empty(); + + return new[] + { + new OsuSpriteText + { + Font = @"Exo2.0-Medium", + Text = "mapped by ", + TextSize = 15, + }, + new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = metadata.Author.Username, + TextSize = 15, + } + }; + } + public class InfoLabel : Container, IHasTooltip { public string TooltipText { get; private set; } From ed827d5424fcadfa24e76a13cfbe1100916cfb00 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 22 Dec 2017 12:33:52 +0100 Subject: [PATCH 03/69] more visual tests for BeatmapInfoWedge also fix Author showing when not wanted --- .../Visual/TestCaseBeatmapInfoWedge.cs | 117 ++++++++++++++---- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 3 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 25 ++-- 3 files changed, 109 insertions(+), 36 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 0168cedc86..353f351a54 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -1,36 +1,48 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; +using System.Collections.Generic; +using System.Linq; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; +using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu; using osu.Game.Screens.Select; +using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual { public class TestCaseBeatmapInfoWedge : OsuTestCase { - private BeatmapManager beatmaps; - private readonly Random random; - private readonly BeatmapInfoWedge infoWedge; + private TestBeatmapInfoWedge infoWedge; + private readonly List beatmaps = new List(); private readonly Bindable beatmap = new Bindable(); - public TestCaseBeatmapInfoWedge() + [BackgroundDependencyLoader] + private void load(OsuGameBase game, RulesetStore rulesets) { - random = new Random(0123); + beatmap.BindTo(game.Beatmap); - Add(infoWedge = new BeatmapInfoWedge + Add(infoWedge = new TestBeatmapInfoWedge { Size = new Vector2(0.5f, 245), RelativeSizeAxes = Axes.X, Margin = new MarginPadding { Top = 20, - }, + } + }); + + AddStep("hide", () => + { + infoWedge.State = Visibility.Hidden; + Content.FadeOut(100); }); AddStep("show", () => @@ -39,31 +51,88 @@ namespace osu.Game.Tests.Visual infoWedge.State = Visibility.Visible; infoWedge.UpdateBeatmap(beatmap); }); - AddStep("hide", () => + + foreach (var rulesetInfo in rulesets.AvailableRulesets) { - infoWedge.State = Visibility.Hidden; - Content.FadeOut(100); + var ruleset = rulesetInfo.CreateInstance(); + beatmaps.Add(createTestBeatmap(rulesetInfo)); + + var name = rulesetInfo.ShortName; + selectBeatmap(name); + + // TODO: check InfoLabels of other rulesets + switch (ruleset) + { + case OsuRuleset osu: + testOsuBeatmap(osu); + break; + } + } + + testNullBeatmap(); + } + + private void testOsuBeatmap(OsuRuleset ruleset) + { + AddAssert("check version", () => infoWedge.Info.VersionLabel.Text == $"{ruleset.ShortName}Version"); + AddAssert("check title", () => infoWedge.Info.TitleLabel.Text == $"{ruleset.ShortName}Source — {ruleset.ShortName}Title"); + AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Text == $"{ruleset.ShortName}Artist"); + AddAssert("check author", () => infoWedge.Info.MapperContainer.Children.OfType().Any(s => s.Text == $"{ruleset.ShortName}Author")); + // TODO: check InfoLabels + } + + private void testNullBeatmap() + { + selectNullBeatmap(); + AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Text)); + AddAssert("check default title", () => infoWedge.Info.TitleLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Title); + AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Artist); + AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any()); + AddAssert("check empty infos", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); + } + + private void selectBeatmap(string name) + { + AddStep($"select {name} beatmap", () => + { + beatmap.Value = new TestWorkingBeatmap(beatmaps.First(b => b.BeatmapInfo.Ruleset.ShortName == name)); + infoWedge.UpdateBeatmap(beatmap); }); - AddStep("random beatmap", randomBeatmap); - AddStep("null beatmap", () => infoWedge.UpdateBeatmap(beatmap.Default)); } - [BackgroundDependencyLoader] - private void load(OsuGameBase game, BeatmapManager beatmaps) + private void selectNullBeatmap() { - this.beatmaps = beatmaps; - beatmap.BindTo(game.Beatmap); + AddStep("select null beatmap", () => + { + beatmap.Value = beatmap.Default; + infoWedge.UpdateBeatmap(beatmap); + }); } - private void randomBeatmap() + private Beatmap createTestBeatmap(RulesetInfo ruleset) { - var sets = beatmaps.GetAllUsableBeatmapSets(); - if (sets.Count == 0) - return; + return new Beatmap + { + BeatmapInfo = new BeatmapInfo + { + Metadata = new BeatmapMetadata + { + AuthorString = $"{ruleset.ShortName}Author", + Artist = $"{ruleset.ShortName}Artist", + Source = $"{ruleset.ShortName}Source", + Title = $"{ruleset.ShortName}Title" + }, + Ruleset = ruleset, + StarDifficulty = 6, + Version = $"{ruleset.ShortName}Version" + }, + HitObjects = new List() // TODO: Fill it with something depending on ruleset? + }; + } - var b = sets[random.Next(0, sets.Count)].Beatmaps[0]; - beatmap.Value = beatmaps.GetWorkingBeatmap(b); - infoWedge.UpdateBeatmap(beatmap); + private class TestBeatmapInfoWedge : BeatmapInfoWedge + { + public new BufferedWedgeInfo Info => base.Info; } } } diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 1434943da0..3ec83ed8d5 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -21,8 +21,7 @@ namespace osu.Game.Beatmaps Metadata = new BeatmapMetadata { Artist = "please load a beatmap!", - Title = "no beatmaps available!", - AuthorString = "no one", + Title = "no beatmaps available!" }, BeatmapSet = new BeatmapSetInfo(), BaseDifficulty = new BeatmapDifficulty diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 9b9a009ac0..5d4f950a51 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Select { private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); - private Drawable info; + protected BufferedWedgeInfo Info; public BeatmapInfoWedge() { @@ -63,23 +63,28 @@ namespace osu.Game.Screens.Select LoadComponentAsync(new BufferedWedgeInfo(beatmap) { Shear = -Shear, - Depth = info?.Depth + 1 ?? 0, + Depth = Info?.Depth + 1 ?? 0, }, newInfo => { // ensure we ourselves are visible if not already. if (!IsPresent) this.FadeIn(250); - info?.FadeOut(250); - info?.Expire(); + Info?.FadeOut(250); + Info?.Expire(); - Add(info = newInfo); + Add(Info = newInfo); }); } public class BufferedWedgeInfo : BufferedContainer { private readonly WorkingBeatmap working; + public OsuSpriteText VersionLabel { get; private set; } + public OsuSpriteText TitleLabel { get; private set; } + public OsuSpriteText ArtistLabel { get; private set; } + public FillFlowContainer MapperContainer { get; private set; } + public FillFlowContainer InfoLabelContainer { get; private set; } public BufferedWedgeInfo(WorkingBeatmap working) { @@ -139,7 +144,7 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new OsuSpriteText + VersionLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = beatmapInfo.Version, @@ -157,26 +162,26 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new OsuSpriteText + TitleLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = string.IsNullOrEmpty(metadata.Source) ? metadata.Title : metadata.Source + " — " + metadata.Title, TextSize = 28, }, - new OsuSpriteText + ArtistLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = metadata.Artist, TextSize = 17, }, - new FillFlowContainer + MapperContainer = new FillFlowContainer { Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, Children = getMapper(metadata) }, - new FillFlowContainer + InfoLabelContainer = new FillFlowContainer { Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(20, 0), From 2313ff0ddbe0b04c04beda6fe4df5947ec32711f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Dec 2017 22:19:11 +0900 Subject: [PATCH 04/69] Fix beatmap info wedge not showing up when zero beatmaps are loaded Closes #1722. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ osu.Game/Screens/Select/SongSelect.cs | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index ff1dd95eac..e0fcba5b3c 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -509,7 +509,7 @@ namespace osu.Game.Screens.Select currentY += DrawHeight / 2; scrollableContent.Height = currentY; - if (selectedBeatmapSet != null && selectedBeatmapSet.State.Value != CarouselItemState.Selected) + if (selectedBeatmapSet == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected) { selectedBeatmapSet = null; SelectionChanged?.Invoke(null); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 3ef6ceeaeb..1baacb78ee 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -66,6 +66,8 @@ namespace osu.Game.Screens.Select Depth = info?.Depth + 1 ?? 0, }, newInfo => { + State = beatmap == null ? Visibility.Hidden : Visibility.Visible; + // ensure we ourselves are visible if not already. if (!IsPresent) this.FadeIn(250); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 68ee08e721..9a7dbf002e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -399,7 +399,6 @@ namespace osu.Game.Screens.Select backgroundModeBeatmap.FadeTo(1, 250); } - beatmapInfoWedge.State = Visibility.Visible; beatmapInfoWedge.UpdateBeatmap(beatmap); } From 6a8fd74e055bd3a35931c1112c86298e4cd6f91f Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 22 Dec 2017 17:38:22 +0100 Subject: [PATCH 05/69] fix failing tests 1) waiting for loading to finish so Drawables are all present to do asserts on 2) fix NullRef in ResultPage because of removed line in DummyWorkingBeatmap (author one) --- osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs | 8 ++++++++ osu.Game/Screens/Ranking/ResultsPageScore.cs | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 353f351a54..1ef6291ee4 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -20,6 +20,7 @@ namespace osu.Game.Tests.Visual { public class TestCaseBeatmapInfoWedge : OsuTestCase { + private RulesetStore rulesets; private TestBeatmapInfoWedge infoWedge; private readonly List beatmaps = new List(); private readonly Bindable beatmap = new Bindable(); @@ -27,7 +28,14 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load(OsuGameBase game, RulesetStore rulesets) { + this.rulesets = rulesets; + beatmap.BindTo(game.Beatmap); + } + + protected override void LoadComplete() + { + base.LoadComplete(); Add(infoWedge = new TestBeatmapInfoWedge { diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 911b688669..396d7f3c18 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -324,7 +324,14 @@ namespace osu.Game.Screens.Ranking title.Colour = artist.Colour = colours.BlueDarker; versionMapper.Colour = colours.Gray8; - versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author.Username}"; + var creator = beatmap.Metadata.Author?.Username; + if (!string.IsNullOrEmpty(creator)) { + versionMapper.Text = $"mapped by {creator}"; + + if (!string.IsNullOrEmpty(beatmap.Version)) + versionMapper.Text = $"{beatmap.Version} - " + versionMapper.Text; + } + title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); } From 49e855a29ae3d4538d618e7c6de255e4afa29741 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 23 Dec 2017 11:56:53 +0100 Subject: [PATCH 06/69] finished up visual tests --- .../Visual/TestCaseBeatmapInfoWedge.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 1ef6291ee4..61c904aa60 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -68,11 +68,15 @@ namespace osu.Game.Tests.Visual var name = rulesetInfo.ShortName; selectBeatmap(name); - // TODO: check InfoLabels of other rulesets + // TODO: adjust cases once more info is shown for other gamemodes switch (ruleset) { case OsuRuleset osu: testOsuBeatmap(osu); + testInfoLabels(5); + break; + default: + testInfoLabels(2); break; } } @@ -86,7 +90,12 @@ namespace osu.Game.Tests.Visual AddAssert("check title", () => infoWedge.Info.TitleLabel.Text == $"{ruleset.ShortName}Source — {ruleset.ShortName}Title"); AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Text == $"{ruleset.ShortName}Artist"); AddAssert("check author", () => infoWedge.Info.MapperContainer.Children.OfType().Any(s => s.Text == $"{ruleset.ShortName}Author")); - // TODO: check InfoLabels + } + + private void testInfoLabels(int expectedCount) + { + AddAssert("check infolabels exists", () => infoWedge.Info.InfoLabelContainer.Children.Any()); + AddAssert("check infolabels count", () => infoWedge.Info.InfoLabelContainer.Children.Count == expectedCount); } private void testNullBeatmap() @@ -96,7 +105,7 @@ namespace osu.Game.Tests.Visual AddAssert("check default title", () => infoWedge.Info.TitleLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Title); AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Artist); AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any()); - AddAssert("check empty infos", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); + AddAssert("check no infolabels", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); } private void selectBeatmap(string name) @@ -119,6 +128,10 @@ namespace osu.Game.Tests.Visual private Beatmap createTestBeatmap(RulesetInfo ruleset) { + List objects = new List(); + for (double i = 0; i < 50000; i += 1000) + objects.Add(new HitObject { StartTime = i }); + return new Beatmap { BeatmapInfo = new BeatmapInfo @@ -134,7 +147,7 @@ namespace osu.Game.Tests.Visual StarDifficulty = 6, Version = $"{ruleset.ShortName}Version" }, - HitObjects = new List() // TODO: Fill it with something depending on ruleset? + HitObjects = objects }; } From a6566564039ecb7e809e96eefa4b93d0649737df Mon Sep 17 00:00:00 2001 From: Shawdooow Date: Sat, 23 Dec 2017 22:47:32 -0500 Subject: [PATCH 07/69] the fix --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 4f5a44e61d..01f83ac904 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -117,11 +117,18 @@ namespace osu.Game.Rulesets.Osu.Objects var minDistanceFromEnd = Velocity * 0.01; + bool sliderStart = false; + for (var repeat = 0; repeat < RepeatCount; repeat++) { var repeatStartTime = StartTime + repeat * repeatDuration; var reversed = repeat % 2 == 1; + if (!sliderStart) + sliderStart = true; + else + sliderStart = false; + for (var d = tickDistance; d <= length; d += tickDistance) { if (d > length - minDistanceFromEnd) @@ -130,6 +137,9 @@ namespace osu.Game.Rulesets.Osu.Objects var distanceProgress = d / length; var timeProgress = reversed ? 1 - distanceProgress : distanceProgress; + if (sliderStart) + distanceProgress = 0; + AddNested(new SliderTick { RepeatIndex = repeat, From d333fc5efe4bb28a9d8c548600a15ab31e6a1451 Mon Sep 17 00:00:00 2001 From: Shawdooow Date: Sat, 23 Dec 2017 23:08:55 -0500 Subject: [PATCH 08/69] fix the fix silly me, that was configured for vitaru! --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 01f83ac904..44c7792e9c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -117,7 +117,7 @@ namespace osu.Game.Rulesets.Osu.Objects var minDistanceFromEnd = Velocity * 0.01; - bool sliderStart = false; + bool sliderStart = true; for (var repeat = 0; repeat < RepeatCount; repeat++) { From af2a2781e7126f7d5eeb40f578cd7c4faf8ecd47 Mon Sep 17 00:00:00 2001 From: Shawdooow Date: Sat, 23 Dec 2017 23:12:10 -0500 Subject: [PATCH 09/69] fix the fix harder --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 44c7792e9c..800573f991 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -117,18 +117,11 @@ namespace osu.Game.Rulesets.Osu.Objects var minDistanceFromEnd = Velocity * 0.01; - bool sliderStart = true; - for (var repeat = 0; repeat < RepeatCount; repeat++) { var repeatStartTime = StartTime + repeat * repeatDuration; var reversed = repeat % 2 == 1; - if (!sliderStart) - sliderStart = true; - else - sliderStart = false; - for (var d = tickDistance; d <= length; d += tickDistance) { if (d > length - minDistanceFromEnd) @@ -137,9 +130,6 @@ namespace osu.Game.Rulesets.Osu.Objects var distanceProgress = d / length; var timeProgress = reversed ? 1 - distanceProgress : distanceProgress; - if (sliderStart) - distanceProgress = 0; - AddNested(new SliderTick { RepeatIndex = repeat, @@ -165,13 +155,20 @@ namespace osu.Game.Rulesets.Osu.Objects var repeatPointDistance = Math.Min(Distance, length); var repeatDuration = length / Velocity; + bool sliderStart = true; + for (var repeat = 1; repeat < RepeatCount; repeat++) { + sliderStart = !sliderStart; + for (var d = repeatPointDistance; d <= length; d += repeatPointDistance) { var repeatStartTime = StartTime + repeat * repeatDuration; var distanceProgress = d / length; + if (sliderStart) + distanceProgress = 0; + AddNested(new RepeatPoint { RepeatIndex = repeat, From 72b5a370da6fbc7702c80857e64476674f061c89 Mon Sep 17 00:00:00 2001 From: Shawdooow Date: Sat, 23 Dec 2017 23:13:53 -0500 Subject: [PATCH 10/69] dont play the same sound twice at once --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index befe84e3e9..d8a22d94ca 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -117,11 +117,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables progress = slider.ProgressAt(progress); if (repeat > currentRepeat) - { - if (repeat < slider.RepeatCount && ball.Tracking) - PlaySamples(); currentRepeat = repeat; - } //todo: we probably want to reconsider this before adding scoring, but it looks and feels nice. if (!initialCircle.Judgements.Any(j => j.IsHit)) From cf316b3c51661a7a21ae1b47c90b9f169c19b8f6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Dec 2017 15:39:25 +0900 Subject: [PATCH 11/69] Add tests for initial load states of PlaySongSelect --- .../Visual/TestCasePlaySongSelect.cs | 48 ++++++++++++++++--- osu.Game/Screens/Select/BeatmapCarousel.cs | 1 - osu.Game/Screens/Select/SongSelect.cs | 34 ++++++------- 3 files changed, 59 insertions(+), 24 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 6435df7c2c..34b99c6ca6 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -26,6 +26,7 @@ namespace osu.Game.Tests.Visual private RulesetStore rulesets; private DependencyContainer dependencies; + private WorkingBeatmap defaultBeatmap; public override IReadOnlyList RequiredTypes => new[] { @@ -47,10 +48,16 @@ namespace osu.Game.Tests.Visual protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent); + private class TestSongSelect : PlaySongSelect + { + public WorkingBeatmap CurrentBeatmap => Beatmap.Value; + public new BeatmapCarousel Carousel => base.Carousel; + } + [BackgroundDependencyLoader] private void load(BeatmapManager baseManager) { - PlaySongSelect songSelect; + TestSongSelect songSelect = null; if (manager == null) { @@ -64,14 +71,43 @@ namespace osu.Game.Tests.Visual dependencies.Cache(rulesets = new RulesetStore(contextFactory)); dependencies.Cache(manager = new BeatmapManager(storage, contextFactory, rulesets, null) { - DefaultBeatmap = baseManager.GetWorkingBeatmap(null) + DefaultBeatmap = defaultBeatmap = baseManager.GetWorkingBeatmap(null) }); - - for (int i = 0; i < 100; i += 10) - manager.Import(createTestBeatmapSet(i)); } - Add(songSelect = new PlaySongSelect()); + void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () => + { + if (deleteMaps) manager.DeleteAll(); + + if (songSelect != null) + { + Remove(songSelect); + songSelect.Dispose(); + } + + Add(songSelect = new TestSongSelect()); + }); + + loadNewSongSelect(true); + + AddWaitStep(1); + + AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); + + AddStep("import test maps", () => + { + for (int i = 0; i < 100; i += 10) + manager.Import(createTestBeatmapSet(i)); + }); + + AddWaitStep(1); + AddStep("select random", () => songSelect.Carousel.SelectNextRandom()); + + AddWaitStep(1); + AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); + + loadNewSongSelect(); + AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; }); diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index bfba9a7d6b..b4ca6f10f9 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -142,7 +142,6 @@ namespace osu.Game.Screens.Select if (newSet == null) { itemsCache.Invalidate(); - SelectNext(); return; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9a7dbf002e..a15699d97a 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select protected Container LeftContent; - private readonly BeatmapCarousel carousel; + protected readonly BeatmapCarousel Carousel; private readonly BeatmapInfoWedge beatmapInfoWedge; private DialogOverlay dialogOverlay; private BeatmapManager beatmaps; @@ -103,7 +103,7 @@ namespace osu.Game.Screens.Select Right = left_area_padding * 2, } }, - carousel = new BeatmapCarousel + Carousel = new BeatmapCarousel { RelativeSizeAxes = Axes.Y, Size = new Vector2(carousel_width, 1), @@ -116,7 +116,7 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.X, Height = filter_height, - FilterChanged = c => carousel.Filter(c), + FilterChanged = c => Carousel.Filter(c), Exit = Exit, }, beatmapInfoWedge = new BeatmapInfoWedge @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select Right = left_area_padding, }, }, - new ResetScrollContainer(() => carousel.ScrollToSelected()) + new ResetScrollContainer(() => Carousel.ScrollToSelected()) { RelativeSizeAxes = Axes.Y, Width = 250, @@ -190,15 +190,15 @@ namespace osu.Game.Screens.Select initialAddSetsTask = new CancellationTokenSource(); - carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSets(); + Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSets(); - Beatmap.DisabledChanged += disabled => carousel.AllowSelection = !disabled; + Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled; Beatmap.TriggerChange(); Beatmap.ValueChanged += b => { if (IsCurrentScreen) - carousel.SelectBeatmap(b?.BeatmapInfo); + Carousel.SelectBeatmap(b?.BeatmapInfo); }; } @@ -212,9 +212,9 @@ namespace osu.Game.Screens.Select { // if we have a pending filter operation, we want to run it now. // it could change selection (ie. if the ruleset has been changed). - carousel.FlushPendingFilterOperations(); + Carousel.FlushPendingFilterOperations(); - carousel.SelectBeatmap(beatmap); + Carousel.SelectBeatmap(beatmap); if (selectionChangedDebounce?.Completed == false) { @@ -282,9 +282,9 @@ namespace osu.Game.Screens.Select private void triggerRandom() { if (GetContainingInputManager().CurrentState.Keyboard.ShiftPressed) - carousel.SelectPreviousRandom(); + Carousel.SelectPreviousRandom(); else - carousel.SelectNextRandom(); + Carousel.SelectNextRandom(); } protected override void OnEntering(Screen last) @@ -416,17 +416,17 @@ namespace osu.Game.Screens.Select } } - private void onBeatmapSetAdded(BeatmapSetInfo s) => carousel.UpdateBeatmapSet(s); - private void onBeatmapSetRemoved(BeatmapSetInfo s) => carousel.RemoveBeatmapSet(s); - private void onBeatmapRestored(BeatmapInfo b) => carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); - private void onBeatmapHidden(BeatmapInfo b) => carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); + private void onBeatmapSetAdded(BeatmapSetInfo s) => Carousel.UpdateBeatmapSet(s); + private void onBeatmapSetRemoved(BeatmapSetInfo s) => Carousel.RemoveBeatmapSet(s); + private void onBeatmapRestored(BeatmapInfo b) => Carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); + private void onBeatmapHidden(BeatmapInfo b) => Carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); private void carouselBeatmapsLoaded() { if (Beatmap.Value.BeatmapSetInfo?.DeletePending == false) - carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo); + Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo); else - carousel.SelectNextRandom(); + Carousel.SelectNextRandom(); } private void delete(BeatmapSetInfo beatmap) From a04ebd0595e423c02e38b57b5e386020d19f7157 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Dec 2017 15:39:44 +0900 Subject: [PATCH 12/69] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..64e04b9ff2 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit 64e04b9ff2d5ba53e5c3a46cfa42a79baeffc014 From 482e10966cfb5fd80c892695bfda6f250b6ae4ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Dec 2017 17:02:46 +0900 Subject: [PATCH 13/69] Ensure a selection is made on entering song select if no selection is current --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 3 --- osu.Game/Screens/Select/BeatmapCarousel.cs | 4 +++- osu.Game/Screens/Select/SongSelect.cs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 34b99c6ca6..87f71d215b 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -100,9 +100,6 @@ namespace osu.Game.Tests.Visual manager.Import(createTestBeatmapSet(i)); }); - AddWaitStep(1); - AddStep("select random", () => songSelect.Carousel.SelectNextRandom()); - AddWaitStep(1); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index b4ca6f10f9..c33993c68c 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -75,7 +75,8 @@ namespace osu.Game.Screens.Select scrollableContent.Clear(false); itemsCache.Invalidate(); scrollPositionCache.Invalidate(); - BeatmapSetsChanged?.Invoke(); + + Schedule(() => BeatmapSetsChanged?.Invoke()); })); } } @@ -154,6 +155,7 @@ namespace osu.Game.Screens.Select select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == selectedBeatmap?.Beatmap.ID) ?? newSet); itemsCache.Invalidate(); + Schedule(() => BeatmapSetsChanged?.Invoke()); }); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index a15699d97a..75c4a68388 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -423,7 +423,7 @@ namespace osu.Game.Screens.Select private void carouselBeatmapsLoaded() { - if (Beatmap.Value.BeatmapSetInfo?.DeletePending == false) + if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false) Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo); else Carousel.SelectNextRandom(); From a7ee6985b050fbf6df3f2880c87f7a1085cec863 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 01:06:33 +0900 Subject: [PATCH 14/69] Add wait step --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 87f71d215b..e27e786a05 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -104,6 +104,7 @@ namespace osu.Game.Tests.Visual AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); loadNewSongSelect(); + AddWaitStep(1); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); From 320a6b0480036653aa0e3f976918c00422ccedff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 17:12:21 +0900 Subject: [PATCH 15/69] Reduce notification output when exceptions are encountered --- osu.Game/OsuGame.cs | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 67f6e6f4e2..95a7e696ea 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -220,15 +220,7 @@ namespace osu.Game Depth = -6, }, overlayContent.Add); - Logger.NewEntry += entry => - { - if (entry.Level < LogLevel.Important) return; - - notifications.Post(new SimpleNotification - { - Text = $@"{entry.Level}: {entry.Message}" - }); - }; + forwardLoggedErrorsToNotifications(); dependencies.Cache(settings); dependencies.Cache(social); @@ -290,6 +282,36 @@ namespace osu.Game Cursor.State = Visibility.Hidden; } + private void forwardLoggedErrorsToNotifications() + { + int recentErrorCount = 0; + + const double debounce = 5000; + + Logger.NewEntry += entry => + { + if (entry.Level < LogLevel.Error || entry.Target == null) return; + + if (recentErrorCount < 2) + { + notifications.Post(new SimpleNotification + { + Icon = FontAwesome.fa_bomb, + Text = (recentErrorCount == 0 ? entry.Message : "Subsequent errors occurred and have been logged.") + "\nClick to view log files.", + Activated = () => + { + Host.Storage.GetStorageForDirectory("logs").OpenInNativeExplorer(); + return true; + } + }); + } + + recentErrorCount++; + + Scheduler.AddDelayed(() => recentErrorCount--, debounce); + }; + } + private Task asyncLoadStream; private void loadComponentSingleFile(T d, Action add) From 6f5f4f76e5f548ac35c256122c5b23be3b8a647f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:21:15 +0900 Subject: [PATCH 16/69] Use Logger.Error when exceptions are involved --- osu.Game/OsuGameBase.cs | 3 +-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 0ddff5e5aa..ea0bf22112 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -177,8 +177,7 @@ namespace osu.Game } catch (MigrationFailedException e) { - Logger.Log((e.InnerException ?? e).ToString(), LoggingTarget.Database, LogLevel.Error); - Logger.Log("Migration failed! We'll be starting with a fresh database.", LoggingTarget.Database, LogLevel.Error); + Logger.Error(e.InnerException ?? e, "Migration failed! We'll be starting with a fresh database.", LoggingTarget.Database); // if we failed, let's delete the database and start fresh. // todo: we probably want a better (non-destructive) migrations/recovery process at a later point than this. diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 4487f74364..36740b96cb 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Edit } catch (Exception e) { - Logger.Log($"Could not load this beatmap sucessfully ({e})!", LoggingTarget.Runtime, LogLevel.Error); + Logger.Error(e, "Could not load beatmap sucessfully!"); return; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 340fc39d52..2cbb203c37 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -125,7 +125,7 @@ namespace osu.Game.Screens.Play } catch (Exception e) { - Logger.Log($"Could not load this beatmap sucessfully ({e})!", LoggingTarget.Runtime, LogLevel.Error); + Logger.Error(e, "Could not load beatmap sucessfully!"); //couldn't load, hard abort! Exit(); From 96e4518e606d2282820c7bbceb8057fc049df94c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:22:58 +0900 Subject: [PATCH 17/69] Add thread safety --- osu.Game/OsuGame.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 95a7e696ea..750808a291 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -16,6 +16,7 @@ using osu.Game.Screens; using osu.Game.Screens.Menu; using OpenTK; using System.Linq; +using System.Threading; using System.Threading.Tasks; using osu.Framework.Input.Bindings; using osu.Framework.Platform; @@ -306,9 +307,9 @@ namespace osu.Game }); } - recentErrorCount++; + Interlocked.Increment(ref recentErrorCount); - Scheduler.AddDelayed(() => recentErrorCount--, debounce); + Scheduler.AddDelayed(() => Interlocked.Decrement(ref recentErrorCount), debounce); }; } From 40dd66cb974fe56d80cc7de451573a118e8afa6e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:31:19 +0900 Subject: [PATCH 18/69] Make TestCaseNotificationOverlay dynamically testable --- osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index b93c2d812f..40d7a77c10 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.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; using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; @@ -15,6 +16,15 @@ namespace osu.Game.Tests.Visual private readonly NotificationOverlay manager; private readonly List progressingNotifications = new List(); + public override IReadOnlyList RequiredTypes => new[] + { + typeof(Notification), + typeof(ProgressNotification), + typeof(ProgressCompletionNotification), + typeof(SimpleNotification), + typeof(IHasCompletionTarget), + }; + public TestCaseNotificationOverlay() { progressingNotifications.Clear(); From 861bf55773a153a35cc68c190236851608377ec3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:31:32 +0900 Subject: [PATCH 19/69] Adjust notification padding a touch --- osu.Game/Overlays/Notifications/Notification.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 422051364e..dc2dcf2d74 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -91,7 +91,6 @@ namespace osu.Game.Overlays.Notifications AutoSizeAxes = Axes.Y, Padding = new MarginPadding { - Top = 5, Left = 45, Right = 30 }, @@ -261,4 +260,4 @@ namespace osu.Game.Overlays.Notifications } } } -} \ No newline at end of file +} From 71a94d6b44d427f24b8da0391baf7f602a4cdd2a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:52:09 +0900 Subject: [PATCH 20/69] Add a bindable Enabled flag to NotificationManager Also better handles delays before notifications are displayed. --- osu.Desktop/Overlays/VersionManager.cs | 2 +- osu.Game/OsuGame.cs | 29 ++++++++++------ osu.Game/Overlays/NotificationOverlay.cs | 43 ++++++++++++++++++++++-- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Loader.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 14 ++++---- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Menu/MainMenu.cs | 2 +- osu.Game/Screens/OsuScreen.cs | 14 +++++++- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Tournament/Drawings.cs | 2 +- 13 files changed, 89 insertions(+), 29 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 9e13003c3f..c46b0e3d12 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -110,7 +110,7 @@ namespace osu.Desktop.Overlays // only show a notification if we've previously saved a version to the config file (ie. not the first run). if (!string.IsNullOrEmpty(lastVersion)) - Scheduler.AddDelayed(() => notificationOverlay.Post(new UpdateCompleteNotification(version)), 5000); + notificationOverlay.Post(new UpdateCompleteNotification(version)); } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 67f6e6f4e2..391a9ee19a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -64,6 +64,8 @@ namespace osu.Game public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight; + public readonly BindableBool ShowOverlays = new BindableBool(); + private OsuScreen screenStack; private VolumeControl volume; @@ -287,6 +289,21 @@ namespace osu.Game settings.StateChanged += stateChanged; notifications.StateChanged += stateChanged; + notifications.Enabled.BindTo(ShowOverlays); + + ShowOverlays.ValueChanged += visible => + { + //central game screen change logic. + if (!visible) + { + hideAllOverlays(); + musicController.State = Visibility.Hidden; + Toolbar.State = Visibility.Hidden; + } + else + Toolbar.State = Visibility.Visible; + }; + Cursor.State = Visibility.Hidden; } @@ -357,6 +374,8 @@ namespace osu.Game notifications.State = Visibility.Hidden; } + private ScheduledDelegate notificationsEnabler; + private void screenChanged(Screen newScreen) { currentScreen = newScreen as OsuScreen; @@ -367,16 +386,6 @@ namespace osu.Game return; } - //central game screen change logic. - if (!currentScreen.ShowOverlays) - { - hideAllOverlays(); - musicController.State = Visibility.Hidden; - Toolbar.State = Visibility.Hidden; - } - else - Toolbar.State = Visibility.Visible; - ScreenChanged?.Invoke(newScreen); } diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index a4b5486596..75e2ad0bdc 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; -using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -11,6 +10,9 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using System; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Threading; namespace osu.Game.Overlays { @@ -20,6 +22,11 @@ namespace osu.Game.Overlays public const float TRANSITION_LENGTH = 600; + /// + /// Whether posted notifications should be processed. + /// + public readonly BindableBool Enabled = new BindableBool(true); + private FlowContainer sections; /// @@ -27,6 +34,27 @@ namespace osu.Game.Overlays /// public Func GetToolbarHeight; + public NotificationOverlay() + { + ScheduledDelegate notificationsEnabler = null; + Enabled.ValueChanged += v => + { + if (!IsLoaded) + { + processingPosts = v; + return; + } + + notificationsEnabler?.Cancel(); + + if (v) + // we want a slight delay before toggling notifications on to avoid the user becoming overwhelmed. + notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, 1000); + else + processingPosts = false; + }; + } + [BackgroundDependencyLoader] private void load() { @@ -84,9 +112,13 @@ namespace osu.Game.Overlays State = Visibility.Hidden; } + private readonly Scheduler postScheduler = new Scheduler(); + + private bool processingPosts = true; + public void Post(Notification notification) { - Schedule(() => + postScheduler.Add(() => { State = Visibility.Visible; @@ -104,6 +136,13 @@ namespace osu.Game.Overlays }); } + protected override void Update() + { + base.Update(); + if (processingPosts) + postScheduler.Update(); + } + protected override void PopIn() { base.PopIn(); diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 19d00f3477..76f51d1c33 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Edit { protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; private readonly Box bottomBackground; private readonly Container screenContainer; diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index ec2e8e0cb1..c96194f63d 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens { private bool showDisclaimer; - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; public Loader() { diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index ce7856c5a9..c82d90d16c 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -11,12 +11,12 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics; -using osu.Game.Overlays.Toolbar; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Audio.Sample; using osu.Framework.Audio; +using osu.Framework.Configuration; using osu.Framework.Threading; namespace osu.Game.Screens.Menu @@ -25,6 +25,8 @@ namespace osu.Game.Screens.Menu { public event Action StateChanged; + private readonly BindableBool showOverlays = new BindableBool(); + public Action OnEdit; public Action OnExit; public Action OnDirect; @@ -34,8 +36,6 @@ namespace osu.Game.Screens.Menu public Action OnChart; public Action OnTest; - private Toolbar toolbar; - private readonly FlowContainerWithOrigin buttonFlow; //todo: make these non-internal somehow. @@ -131,9 +131,9 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, OsuGame game = null) + private void load(AudioManager audio, OsuGame game) { - toolbar = game?.Toolbar; + if (game != null) showOverlays.BindTo(game.ShowOverlays); sampleBack = audio.Sample.Get(@"Menu/button-back-select"); } @@ -300,7 +300,7 @@ namespace osu.Game.Screens.Menu logoDelayedAction = Scheduler.AddDelayed(() => { - toolbar?.Hide(); + showOverlays.Value = false; logo.ClearTransforms(targetMember: nameof(Position)); logo.RelativePositionAxes = Axes.Both; @@ -329,7 +329,7 @@ namespace osu.Game.Screens.Menu logoTracking = true; logo.Impact(); - toolbar?.Show(); + showOverlays.Value = true; }, 200); break; default: diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 532ee71b72..d0ad613640 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.Menu private readonly SpriteIcon icon; private Color4 iconColour; - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; public override bool HasLocalCursorDisplayed => true; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index d7beb34a2f..a6a1afa320 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Menu public override bool HasLocalCursorDisplayed => true; - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty(); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 90f68ba9f1..fac0ec1422 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Menu { private readonly ButtonSystem buttons; - public override bool ShowOverlays => buttons.State != MenuState.Initial; + public override bool ShowOverlaysOnEnter => buttons.State != MenuState.Initial; private readonly BackgroundScreenDefault background; private Screen songSelect; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 4a27c7f1ea..0013d1a882 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -28,7 +28,12 @@ namespace osu.Game.Screens /// protected virtual BackgroundScreen CreateBackground() => null; - public virtual bool ShowOverlays => true; + protected BindableBool ShowOverlays = new BindableBool(); + + /// + /// Whether overlays should be shown when this screen is entered or resumed. + /// + public virtual bool ShowOverlaysOnEnter => true; protected new OsuGameBase Game => base.Game as OsuGameBase; @@ -70,7 +75,10 @@ namespace osu.Game.Screens } if (osuGame != null) + { Ruleset.BindTo(osuGame.Ruleset); + ShowOverlays.BindTo(osuGame.ShowOverlays); + } sampleExit = audio.Sample.Get(@"UI/screen-back"); } @@ -94,6 +102,8 @@ namespace osu.Game.Screens base.OnResuming(last); logo.AppendAnimatingAction(() => LogoArriving(logo, true), true); sampleExit?.Play(); + + ShowOverlays.Value = ShowOverlaysOnEnter; } protected override void OnSuspending(Screen next) @@ -139,6 +149,8 @@ namespace osu.Game.Screens logo.AppendAnimatingAction(() => LogoArriving(logo, false), true); base.OnEntering(last); + + ShowOverlays.Value = ShowOverlaysOnEnter; } protected override bool OnExiting(Screen next) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 340fc39d52..d5cd89c386 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play { protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; public override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && RulesetContainer.ProvidingUserCursor; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index de67bef004..c2a8f13207 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play private BeatmapMetadataDisplay info; private bool showOverlays = true; - public override bool ShowOverlays => showOverlays; + public override bool ShowOverlaysOnEnter => showOverlays; public override bool AllowBeatmapRulesetChange => false; diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 3e7ab56c99..fbf24eb609 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Tournament { private const string results_filename = "drawings_results.txt"; - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); From 9fb958eadc39a914acaec1317ad04339e6e9c51b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 14:00:58 +0900 Subject: [PATCH 21/69] Make TestCasePlayer more usable No results screen crash, no unnecessary leadin time. --- osu.Game/Screens/Play/Player.cs | 9 ++++++++- osu.Game/Tests/Visual/TestCasePlayer.cs | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 340fc39d52..531913470f 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 bool AllowLeadIn { get; set; } = true; + public bool AllowResults { get; set; } = true; public int RestartCount; @@ -136,7 +138,10 @@ namespace osu.Game.Screens.Play decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; var firstObjectTime = RulesetContainer.Objects.First().StartTime; - decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn))); + decoupledClock.Seek(AllowLeadIn + ? Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn)) + : firstObjectTime); + decoupledClock.ProcessFrame(); offsetClock = new FramedOffsetClock(decoupledClock); @@ -273,6 +278,8 @@ namespace osu.Game.Screens.Play ValidForResume = false; + if (!AllowResults) return; + using (BeginDelayedSequence(1000)) { onCompletionEvent = Schedule(delegate diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 106f0fa8f3..c71c1de499 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -91,7 +91,9 @@ namespace osu.Game.Tests.Visual protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player { InitialBeatmap = beatmap, - AllowPause = false + AllowPause = false, + AllowLeadIn = false, + AllowResults = false, }; private const string test_beatmap_data = From 99a44e6d79618374318ba0fac8a104603ec6a9e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:02:01 +0900 Subject: [PATCH 22/69] Allow testbrowser's rate adjust to affect TestCasePlayer --- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 2 +- osu.Game/Tests/Visual/TestCasePlayer.cs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index da139775b1..82248c2cb8 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -19,6 +19,6 @@ namespace osu.Game.Tests.Beatmaps protected override Beatmap GetBeatmap() => beatmap; protected override Texture GetBackground() => null; - protected override Track GetTrack() => null; + protected override Track GetTrack() => new TrackVirtual(); } } diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index c71c1de499..933781890f 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -22,6 +22,8 @@ namespace osu.Game.Tests.Visual protected Player Player; + private TestWorkingBeatmap working; + /// /// Create a TestCase which runs through the Player screen. /// @@ -75,7 +77,7 @@ namespace osu.Game.Tests.Visual var instance = r.CreateInstance(); - WorkingBeatmap working = new TestWorkingBeatmap(beatmap); + working = new TestWorkingBeatmap(beatmap); working.Mods.Value = new[] { instance.GetAllMods().First(m => m is ModNoFail) }; if (Player != null) @@ -88,6 +90,15 @@ namespace osu.Game.Tests.Visual return player; } + protected override void Update() + { + base.Update(); + + if (working != null) + // note that this will override any mod rate application + working.Track.Rate = Clock.Rate; + } + protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player { InitialBeatmap = beatmap, From 9ccc49c9b5a2b61c73e30a9cea35118614f5f4fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:32:39 +0900 Subject: [PATCH 23/69] Make selection triggering more liberal --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index e3566f3206..9d7867659d 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -513,7 +513,7 @@ namespace osu.Game.Screens.Select currentY += DrawHeight / 2; scrollableContent.Height = currentY; - if (selectedBeatmapSet != null && (selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected)) + if (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected) { selectedBeatmapSet = null; SelectionChanged?.Invoke(null); From e14ad31a071cacfc10f4ab8668f3d00634776c68 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:32:53 +0900 Subject: [PATCH 24/69] Increase wait durations for test stability --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index e27e786a05..69aa371958 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual loadNewSongSelect(true); - AddWaitStep(1); + AddWaitStep(3); AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); @@ -100,11 +100,11 @@ namespace osu.Game.Tests.Visual manager.Import(createTestBeatmapSet(i)); }); - AddWaitStep(1); + AddWaitStep(3); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); loadNewSongSelect(); - AddWaitStep(1); + AddWaitStep(3); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); From 024d9a6850c9071225cba706b77e8f21d9f426e6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:33:02 +0900 Subject: [PATCH 25/69] Remove unnecessary null check --- .../Visual/TestCasePlaySongSelect.cs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 69aa371958..18e40db064 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -59,21 +59,18 @@ namespace osu.Game.Tests.Visual { TestSongSelect songSelect = null; - if (manager == null) + var storage = new TestStorage(@"TestCasePlaySongSelect"); + + // this is by no means clean. should be replacing inside of OsuGameBase somehow. + var context = new OsuDbContext(); + + Func contextFactory = () => context; + + dependencies.Cache(rulesets = new RulesetStore(contextFactory)); + dependencies.Cache(manager = new BeatmapManager(storage, contextFactory, rulesets, null) { - var storage = new TestStorage(@"TestCasePlaySongSelect"); - - // this is by no means clean. should be replacing inside of OsuGameBase somehow. - var context = new OsuDbContext(); - - Func contextFactory = () => context; - - dependencies.Cache(rulesets = new RulesetStore(contextFactory)); - dependencies.Cache(manager = new BeatmapManager(storage, contextFactory, rulesets, null) - { - DefaultBeatmap = defaultBeatmap = baseManager.GetWorkingBeatmap(null) - }); - } + DefaultBeatmap = defaultBeatmap = baseManager.GetWorkingBeatmap(null) + }); void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () => { From c15b2382a218a7171258f6b3aa0a1013fef9b311 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:56:32 +0900 Subject: [PATCH 26/69] Remove unused variable --- osu.Game/OsuGame.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 391a9ee19a..4342b020a8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -374,8 +374,6 @@ namespace osu.Game notifications.State = Visibility.Hidden; } - private ScheduledDelegate notificationsEnabler; - private void screenChanged(Screen newScreen) { currentScreen = newScreen as OsuScreen; From f737a64189ea85a0e316e9034c5c21749346e375 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 16:09:40 +0900 Subject: [PATCH 27/69] Remove ScreenChanged --- osu.Game/OsuGame.cs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4342b020a8..b45a9f41ea 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -355,8 +355,6 @@ namespace osu.Game public bool OnReleased(GlobalAction action) => false; - public event Action ScreenChanged; - private Container mainContent; private Container overlayContent; @@ -374,19 +372,6 @@ namespace osu.Game notifications.State = Visibility.Hidden; } - private void screenChanged(Screen newScreen) - { - currentScreen = newScreen as OsuScreen; - - if (currentScreen == null) - { - Exit(); - return; - } - - ScreenChanged?.Invoke(newScreen); - } - protected override bool OnExiting() { if (screenStack.ChildScreen == null) return false; @@ -434,13 +419,12 @@ namespace osu.Game { newScreen.ModePushed += screenAdded; newScreen.Exited += screenRemoved; - - screenChanged(newScreen); } private void screenRemoved(Screen newScreen) { - screenChanged(newScreen); + if (newScreen == null) + Exit(); } } } From 3f1ced618ae6db07f71ad6ba05b81f477c617334 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 16:15:15 +0900 Subject: [PATCH 28/69] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..46d4704b0a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit 46d4704b0a3f140fa8ad10ca0b1553b67d8385ab From 836d807f4ff122480e9a029d0606aae669f62945 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:32:20 +0900 Subject: [PATCH 29/69] Give SampleControlPoint a 100% volume by default --- osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index 40e45da13c..c2c13e1909 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -17,7 +17,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The default sample volume at this control point. /// - public int SampleVolume; + public int SampleVolume = 100; /// /// Create a SampleInfo based on the sample settings in this control point. From 3113a55a988be6fe7112f73d1c905edd0cd787ab Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:33:01 +0900 Subject: [PATCH 30/69] Make ControlPointInfo return a set default control point --- .../ControlPoints/ControlPointInfo.cs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index f031ebe353..5ad6b4ec6b 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -12,6 +12,11 @@ namespace osu.Game.Beatmaps.ControlPoints [Serializable] public class ControlPointInfo { + private static readonly TimingControlPoint default_timing_point = new TimingControlPoint(); + private static readonly DifficultyControlPoint default_difficulty_point = new DifficultyControlPoint(); + private static readonly SampleControlPoint default_sample_point = new SampleControlPoint(); + private static readonly EffectControlPoint default_effect_point = new EffectControlPoint(); + /// /// All timing points. /// @@ -41,68 +46,68 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the difficulty control point at. /// The difficulty control point. - public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time); + public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time, default_difficulty_point); /// /// Finds the effect control point that is active at . /// /// The time to find the effect control point at. /// The effect control point. - public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time); + public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time, default_effect_point); /// /// Finds the sound control point that is active at . /// /// The time to find the sound control point at. /// The sound control point. - public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.FirstOrDefault()); + public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.FirstOrDefault() ?? default_sample_point); /// /// Finds the timing control point that is active at . /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault()); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault() ?? default_timing_point); [JsonIgnore] /// /// Finds the maximum BPM represented by any timing control point. /// public double BPMMaximum => - 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; + 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? default_timing_point).BeatLength; [JsonIgnore] /// /// Finds the minimum BPM represented by any timing control point. /// public double BPMMinimum => - 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; + 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? default_timing_point).BeatLength; [JsonIgnore] /// /// Finds the mode BPM (most common BPM) represented by the control points. /// public double BPMMode => - 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? new TimingControlPoint()).BeatLength; + 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? default_timing_point).BeatLength; /// /// Binary searches one of the control point lists to find the active control point at . /// /// The list to search. /// The time to find the control point at. - /// The control point to use when is before any control points. If null, a new control point will be constructed. + /// The control point to use when there is not control point before . /// The active control point at . - private T binarySearch(SortedList list, double time, T prePoint = null) + private T binarySearch(SortedList list, double time, T defaultPoint) where T : ControlPoint, new() { if (list == null) throw new ArgumentNullException(nameof(list)); if (list.Count == 0) - return new T(); + return defaultPoint; if (time < list[0].Time) - return prePoint ?? new T(); + return defaultPoint; int index = list.BinarySearch(new T { Time = time }); From c74561b3d4e1db279f2fc8e24d3648b3f8c61c6d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:33:28 +0900 Subject: [PATCH 31/69] Add test case for InputDrum --- .../Tests/TestCaseInputDrum.cs | 32 +++++++++++++++++++ .../osu.Game.Rulesets.Taiko.csproj | 1 + 2 files changed, 33 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs diff --git a/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs b/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs new file mode 100644 index 0000000000..7c18ecc34b --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Taiko.UI; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Taiko.Tests +{ + [Ignore("getting CI working")] + public class TestCaseInputDrum : OsuTestCase + { + public TestCaseInputDrum() + { + Add(new TaikoInputManager(new RulesetInfo { ID = 1 }) + { + RelativeSizeAxes = Axes.Both, + Child = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(200), + Child = new InputDrum(new ControlPointInfo()) + } + }); + } + } +} diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index f1c29c1a34..bd0d199772 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -83,6 +83,7 @@ + From 44fbe7859a0a703f540f2fa6a70b413665bcb75a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Tue, 26 Dec 2017 11:34:26 +0100 Subject: [PATCH 32/69] move anchor and origin so metadata doesn't move if it's partially empty --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 5d4f950a51..4f20b50d35 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -154,9 +154,10 @@ namespace osu.Game.Screens.Select }, new FillFlowContainer { - Name = "Bottom-aligned metadata", - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Name = "Centre-aligned metadata", + Anchor = Anchor.CentreLeft, + Origin = Anchor.TopLeft, + Y = -22, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 15, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, From 96905915931336c16d5b808af25c41a4cd7b9a4b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:55:56 +0900 Subject: [PATCH 33/69] Make taiko use namespaced hitsounds This is a temporary solution for now that uses DrawableHitObject.SampleNamespace for the override. We will not want to do this going forward, and instead have the rulesets add their custom resource stores to the games', but that requires deciding where/when to apply/remove such resource stores, and is probably left to skinning. --- osu-resources | 2 +- osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs | 4 ++-- .../Objects/Drawables/DrawableTaikoHitObject.cs | 2 ++ osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs | 12 ++++++++++++ osu.Game/Audio/SampleInfo.cs | 11 +++++++++-- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 5 ++++- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/osu-resources b/osu-resources index 4287ee8043..e01f71160f 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 4287ee8043fb1419017359bc3a5db5dc06bc643f +Subproject commit e01f71160fb9b3167efcd177c7d7dba9e5d36604 diff --git a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs index 9d0037b97a..74e2195e09 100644 --- a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs +++ b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs @@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Taiko.Audio { mappings[s] = new DrumSample { - Centre = s.GetSampleInfo().GetChannel(audio.Sample), - Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample) + Centre = s.GetSampleInfo().GetChannel(audio.Sample, "Taiko"), + Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample, "Taiko") }; } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 92da3fe09e..cc7dd2fa0f 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -41,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables // Normal and clap samples are handled by the drum protected override IEnumerable GetSamples() => HitObject.Samples.Where(s => s.Name != SampleInfo.HIT_NORMAL && s.Name != SampleInfo.HIT_CLAP); + protected override string SampleNamespace => "Taiko"; + protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(); public abstract bool OnPressed(TaikoAction action); diff --git a/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs b/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs index 7c18ecc34b..172c6e9d84 100644 --- a/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs +++ b/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs @@ -1,11 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; using NUnit.Framework; using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Taiko.Audio; using osu.Game.Rulesets.Taiko.UI; using osu.Game.Tests.Visual; @@ -14,6 +18,14 @@ namespace osu.Game.Rulesets.Taiko.Tests [Ignore("getting CI working")] public class TestCaseInputDrum : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(InputDrum), + typeof(DrumSampleMapping), + typeof(SampleInfo), + typeof(SampleControlPoint) + }; + public TestCaseInputDrum() { Add(new TaikoInputManager(new RulesetInfo { ID = 1 }) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 64a9aa50a0..1133dde570 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -14,9 +14,16 @@ namespace osu.Game.Audio public const string HIT_NORMAL = @"hitnormal"; public const string HIT_CLAP = @"hitclap"; - public SampleChannel GetChannel(SampleManager manager) + public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null) { - var channel = manager.Get($"Gameplay/{Bank}-{Name}"); + SampleChannel channel = null; + + if (!string.IsNullOrEmpty(resourceNamespace)) + channel = manager.Get($"Gameplay/{resourceNamespace}/{Bank}-{Name}"); + + if (channel == null) + channel = manager.Get($"Gameplay/{Bank}-{Name}"); + channel.Volume.Value = Volume / 100.0; return channel; } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index ab4c04be3f..c118cd5bee 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -74,6 +74,9 @@ namespace osu.Game.Rulesets.Objects.Drawables protected List Samples = new List(); protected virtual IEnumerable GetSamples() => HitObject.Samples; + // Todo: Rulesets should be overriding the resources instead, but we need to figure out where/when to apply overrides first + protected virtual string SampleNamespace => null; + public readonly Bindable State = new Bindable(); protected DrawableHitObject(TObject hitObject) @@ -101,7 +104,7 @@ namespace osu.Game.Rulesets.Objects.Drawables Volume = s.Volume > 0 ? s.Volume : HitObject.SampleControlPoint.SampleVolume }; - SampleChannel channel = localSampleInfo.GetChannel(audio.Sample); + SampleChannel channel = localSampleInfo.GetChannel(audio.Sample, SampleNamespace); if (channel == null) continue; From 0c4e4012f8a13dcebeaa4f5851c5469cbbaf7d3e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:57:16 +0900 Subject: [PATCH 34/69] Taiko drumroll ticks should just play the playfield samples --- osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 5a566fd091..a39d627cc4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -3,9 +3,6 @@ using osu.Game.Rulesets.Objects.Types; using System; -using System.Collections.Generic; -using System.Linq; -using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -75,13 +72,7 @@ namespace osu.Game.Rulesets.Taiko.Objects FirstTick = first, TickSpacing = tickSpacing, StartTime = t, - IsStrong = IsStrong, - Samples = new List(Samples.Select(s => new SampleInfo - { - Bank = s.Bank, - Name = @"slidertick", - Volume = s.Volume - })) + IsStrong = IsStrong }); first = false; From d479955e20e48b48cf75dbe390a6601cd63e4b89 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 20:01:02 +0900 Subject: [PATCH 35/69] Fix spelling error --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 5ad6b4ec6b..234a50d5dd 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -95,7 +95,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The list to search. /// The time to find the control point at. - /// The control point to use when there is not control point before . + /// The control point to use when there is no control point before . /// The active control point at . private T binarySearch(SortedList list, double time, T defaultPoint) where T : ControlPoint, new() From 1c4bcdda96f690123a8eb2ae7a502da9cac11a52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 20:13:55 +0900 Subject: [PATCH 36/69] Fix test race condition async loads --- osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 61c904aa60..53943edfab 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -110,11 +110,15 @@ namespace osu.Game.Tests.Visual private void selectBeatmap(string name) { + var infoBefore = infoWedge.Info; + AddStep($"select {name} beatmap", () => { beatmap.Value = new TestWorkingBeatmap(beatmaps.First(b => b.BeatmapInfo.Ruleset.ShortName == name)); infoWedge.UpdateBeatmap(beatmap); }); + + AddUntilStep(() => infoWedge.Info != infoBefore, "wait for async load"); } private void selectNullBeatmap() From 7504cd589dc532f67e1a2c42aac5505732c9c6ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 20:18:47 +0900 Subject: [PATCH 37/69] Move alpha handling to state --- .../Visual/TestCaseBeatmapInfoWedge.cs | 20 +++++++++---------- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 9 ++++++--- osu.Game/Screens/Select/SongSelect.cs | 1 - 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 53943edfab..3a50e43239 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -41,25 +41,23 @@ namespace osu.Game.Tests.Visual { Size = new Vector2(0.5f, 245), RelativeSizeAxes = Axes.X, - Margin = new MarginPadding - { - Top = 20, - } - }); - - AddStep("hide", () => - { - infoWedge.State = Visibility.Hidden; - Content.FadeOut(100); + Margin = new MarginPadding { Top = 20 } }); AddStep("show", () => { - Content.FadeInFromZero(250); infoWedge.State = Visibility.Visible; infoWedge.UpdateBeatmap(beatmap); }); + AddWaitStep(3); + + AddStep("hide", () => { infoWedge.State = Visibility.Hidden; }); + + AddWaitStep(3); + + AddStep("show", () => { infoWedge.State = Visibility.Visible; }); + foreach (var rulesetInfo in rulesets.AvailableRulesets) { var ruleset = rulesetInfo.CreateInstance(); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 4f20b50d35..d4f1b90ebf 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -35,6 +35,7 @@ namespace osu.Game.Screens.Select Masking = true; BorderColour = new Color4(221, 255, 255, 255); BorderThickness = 2.5f; + Alpha = 0; EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, @@ -50,12 +51,14 @@ namespace osu.Game.Screens.Select { this.MoveToX(0, 800, Easing.OutQuint); this.RotateTo(0, 800, Easing.OutQuint); + this.FadeIn(250); } protected override void PopOut() { - this.MoveToX(-100, 800, Easing.InQuint); - this.RotateTo(10, 800, Easing.InQuint); + this.MoveToX(-100, 800, Easing.In); + this.RotateTo(10, 800, Easing.In); + this.FadeOut(500, Easing.In); } public void UpdateBeatmap(WorkingBeatmap beatmap) @@ -68,7 +71,7 @@ namespace osu.Game.Screens.Select { // ensure we ourselves are visible if not already. if (!IsPresent) - this.FadeIn(250); + State = Visibility.Visible; Info?.FadeOut(250); Info?.Expire(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 68ee08e721..a66cd0b3e3 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -121,7 +121,6 @@ namespace osu.Game.Screens.Select }, beatmapInfoWedge = new BeatmapInfoWedge { - Alpha = 0, Size = wedged_container_size, RelativeSizeAxes = Axes.X, Margin = new MarginPadding From d17f6cb5647c03b4fef7f7464ef7cfbfac43fa43 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 11:20:17 +0900 Subject: [PATCH 38/69] Fix crash when starting play mode with no beatmap Closes #1767 --- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index de67bef004..a220dcee0e 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -250,7 +250,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, - new MetadataLine("Mapper", metadata.Author.Username) + new MetadataLine("Mapper", metadata.AuthorString) { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, From ae9f08f387dc26ca63eea7e09507e0ed9d4eded0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 11:47:04 +0900 Subject: [PATCH 39/69] Fix crash in editor when trying to seek on a virtual track --- .../Edit/Components/Timelines/Summary/Parts/MarkerPart.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 367cf4337d..b2308aca71 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -47,6 +47,8 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts if (Beatmap.Value == null) return; + if (Beatmap.Value.Track.Length == double.PositiveInfinity) return; + float markerPos = MathHelper.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth); seekTo(markerPos / DrawWidth * Beatmap.Value.Track.Length); } From b95d7fc2cdbe07cd219256aedd413798a4728870 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 12:41:59 +0900 Subject: [PATCH 40/69] Revert "Make ControlPointInfo return a set default control point" This reverts commit 3113a55a988be6fe7112f73d1c905edd0cd787ab. --- .../ControlPoints/ControlPointInfo.cs | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 234a50d5dd..f031ebe353 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -12,11 +12,6 @@ namespace osu.Game.Beatmaps.ControlPoints [Serializable] public class ControlPointInfo { - private static readonly TimingControlPoint default_timing_point = new TimingControlPoint(); - private static readonly DifficultyControlPoint default_difficulty_point = new DifficultyControlPoint(); - private static readonly SampleControlPoint default_sample_point = new SampleControlPoint(); - private static readonly EffectControlPoint default_effect_point = new EffectControlPoint(); - /// /// All timing points. /// @@ -46,68 +41,68 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the difficulty control point at. /// The difficulty control point. - public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time, default_difficulty_point); + public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time); /// /// Finds the effect control point that is active at . /// /// The time to find the effect control point at. /// The effect control point. - public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time, default_effect_point); + public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time); /// /// Finds the sound control point that is active at . /// /// The time to find the sound control point at. /// The sound control point. - public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.FirstOrDefault() ?? default_sample_point); + public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.FirstOrDefault()); /// /// Finds the timing control point that is active at . /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault() ?? default_timing_point); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault()); [JsonIgnore] /// /// Finds the maximum BPM represented by any timing control point. /// public double BPMMaximum => - 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? default_timing_point).BeatLength; + 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; [JsonIgnore] /// /// Finds the minimum BPM represented by any timing control point. /// public double BPMMinimum => - 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? default_timing_point).BeatLength; + 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; [JsonIgnore] /// /// Finds the mode BPM (most common BPM) represented by the control points. /// public double BPMMode => - 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? default_timing_point).BeatLength; + 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? new TimingControlPoint()).BeatLength; /// /// Binary searches one of the control point lists to find the active control point at . /// /// The list to search. /// The time to find the control point at. - /// The control point to use when there is no control point before . + /// The control point to use when is before any control points. If null, a new control point will be constructed. /// The active control point at . - private T binarySearch(SortedList list, double time, T defaultPoint) + private T binarySearch(SortedList list, double time, T prePoint = null) where T : ControlPoint, new() { if (list == null) throw new ArgumentNullException(nameof(list)); if (list.Count == 0) - return defaultPoint; + return new T(); if (time < list[0].Time) - return defaultPoint; + return prePoint ?? new T(); int index = list.BinarySearch(new T { Time = time }); From cf9a9762f7f7370c9f2cd1cf39080da5700b1455 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 12:30:30 +0900 Subject: [PATCH 41/69] Fix beatmap wedge appearing with incorrect info on entering song select Closes #1762 --- osu.Game/Screens/Select/BeatmapCarousel.cs | 13 +++++++++++-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 9d7867659d..ffdd1daf72 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -53,6 +53,11 @@ namespace osu.Game.Screens.Select public override bool HandleInput => AllowSelection; + /// + /// Used to avoid firing null selections before the initial baetmaps have been loaded via . + /// + private bool initialLoadComplete; + private IEnumerable beatmapSets => root.Children.OfType(); public IEnumerable BeatmapSets @@ -76,7 +81,11 @@ namespace osu.Game.Screens.Select itemsCache.Invalidate(); scrollPositionCache.Invalidate(); - Schedule(() => BeatmapSetsChanged?.Invoke()); + Schedule(() => + { + BeatmapSetsChanged?.Invoke(); + initialLoadComplete = true; + }); })); } } @@ -513,7 +522,7 @@ namespace osu.Game.Screens.Select currentY += DrawHeight / 2; scrollableContent.Height = currentY; - if (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected) + if (initialLoadComplete && (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected)) { selectedBeatmapSet = null; SelectionChanged?.Invoke(null); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index fa1326de8c..729cb458c2 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -71,10 +71,6 @@ namespace osu.Game.Screens.Select { State = beatmap == null ? Visibility.Hidden : Visibility.Visible; - // ensure we ourselves are visible if not already. - if (!IsPresent) - State = Visibility.Visible; - Info?.FadeOut(250); Info?.Expire(); From 519ef72adfa3b44d4a5fe28e904beb2fcd2c8c93 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 13:03:46 +0900 Subject: [PATCH 42/69] Lookup by control point time rather than control point Under some situations, such as when there are no control points, ControlPointInfo will return to us a newly-constructed controlpoint with every call to SamplePointAt, which will fail on this key lookup. Between this and overriding GetHashCode, I think this is the more proper fix for this. --- osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs index 74e2195e09..982b339d3a 100644 --- a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs +++ b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Linq; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Game.Audio; @@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.Taiko.Audio public class DrumSampleMapping { private readonly ControlPointInfo controlPoints; - private readonly Dictionary mappings = new Dictionary(); + private readonly Dictionary mappings = new Dictionary(); public DrumSampleMapping(ControlPointInfo controlPoints, AudioManager audio) { @@ -26,9 +25,9 @@ namespace osu.Game.Rulesets.Taiko.Audio else samplePoints = controlPoints.SamplePoints; - foreach (var s in samplePoints.Distinct()) + foreach (var s in samplePoints) { - mappings[s] = new DrumSample + mappings[s.Time] = new DrumSample { Centre = s.GetSampleInfo().GetChannel(audio.Sample, "Taiko"), Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample, "Taiko") @@ -36,7 +35,7 @@ namespace osu.Game.Rulesets.Taiko.Audio } } - public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time)]; + public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time).Time]; public class DrumSample { From 18d2be75d54a84dfe1d601c1a3cadab354fce7cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 13:04:24 +0900 Subject: [PATCH 43/69] Fix random selection happening more than once on quick imports --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index b4494936f4..9e5a2fa633 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -444,7 +444,7 @@ namespace osu.Game.Screens.Select { if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false) Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo); - else + else if (Carousel.SelectedBeatmapSet == null) Carousel.SelectNextRandom(); } From 9fa0cfd250b7ed577a0169b2b436bac77fd4bb0c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 13:06:36 +0900 Subject: [PATCH 44/69] Fix taiko autoplay hitting drumroll ticks with the rims instead of centres Fixes #1772. --- osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs index df1a19267f..c43899ebf1 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs @@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Taiko.Replays { foreach (var tick in drumRoll.NestedHitObjects.OfType()) { - Frames.Add(new ReplayFrame(tick.StartTime, null, null, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2)); + Frames.Add(new ReplayFrame(tick.StartTime, null, null, hitButton ? ReplayButtonState.Right1 : ReplayButtonState.Right2)); hitButton = !hitButton; } } From 5b529511ec6727ccded551c9bce9312027ffa7f0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 13:18:34 +0900 Subject: [PATCH 45/69] Update OpenTK nuget package Fixes the recent AppVeyor errors --- osu.Desktop/osu.Desktop.csproj | 4 ++-- osu.Desktop/packages.config | 2 +- osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj | 4 ++-- osu.Game.Rulesets.Catch/packages.config | 2 +- osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj | 4 ++-- osu.Game.Rulesets.Mania/packages.config | 2 +- osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj | 4 ++-- osu.Game.Rulesets.Osu/packages.config | 2 +- osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj | 4 ++-- osu.Game.Rulesets.Taiko/packages.config | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 4 ++-- osu.Game.Tests/packages.config | 2 +- osu.Game/osu.Game.csproj | 4 ++-- osu.Game/packages.config | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index e4e9807754..4a1798feb4 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -135,8 +135,8 @@ $(SolutionDir)\packages\squirrel.windows.1.7.8\lib\Net45\NuGet.Squirrel.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index 6b6361b578..e7233a42ac 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -6,7 +6,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index b03c8d2eea..578d8eb34d 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -36,8 +36,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Rulesets.Catch/packages.config b/osu.Game.Rulesets.Catch/packages.config index cde428acea..2369f7529b 100644 --- a/osu.Game.Rulesets.Catch/packages.config +++ b/osu.Game.Rulesets.Catch/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 26181164f9..bdd6656ed9 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -36,8 +36,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Rulesets.Mania/packages.config b/osu.Game.Rulesets.Mania/packages.config index cde428acea..2369f7529b 100644 --- a/osu.Game.Rulesets.Mania/packages.config +++ b/osu.Game.Rulesets.Mania/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index ec71869adb..6e61d7fb2d 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -37,8 +37,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Rulesets.Osu/packages.config b/osu.Game.Rulesets.Osu/packages.config index cde428acea..2369f7529b 100644 --- a/osu.Game.Rulesets.Osu/packages.config +++ b/osu.Game.Rulesets.Osu/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index f1c29c1a34..f73831a952 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -36,8 +36,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Rulesets.Taiko/packages.config b/osu.Game.Rulesets.Taiko/packages.config index cde428acea..2369f7529b 100644 --- a/osu.Game.Rulesets.Taiko/packages.config +++ b/osu.Game.Rulesets.Taiko/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index e0b9eb4091..df66896d9b 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -37,8 +37,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index e09f2a07ba..c2056e09a8 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -6,6 +6,6 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b5f93123fd..7d146c0a12 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -143,8 +143,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game/packages.config b/osu.Game/packages.config index 02ace918de..3ba50388e8 100644 --- a/osu.Game/packages.config +++ b/osu.Game/packages.config @@ -66,7 +66,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + From 2a7147240f74af787b7f0d217c7c63e250d912e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 13:25:42 +0900 Subject: [PATCH 46/69] Fix progress notifications not creating their completion notification early enough FIxes notification overlay thinking it has no notifications left and closing. --- osu.Game/Overlays/NotificationOverlay.cs | 9 ++++++--- osu.Game/Overlays/Notifications/ProgressNotification.cs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 2f1c3285ef..f19a80ef47 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -85,9 +85,12 @@ namespace osu.Game.Overlays private void notificationClosed() { - // hide ourselves if all notifications have been dismissed. - if (totalCount == 0) - State = Visibility.Hidden; + Schedule(() => + { + // hide ourselves if all notifications have been dismissed. + if (totalCount == 0) + State = Visibility.Hidden; + }); updateCounts(); } diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index c39c630858..d797372390 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -95,8 +95,8 @@ namespace osu.Game.Overlays.Notifications protected virtual void Completed() { - base.Close(); CompletionTarget?.Invoke(CreateCompletionNotification()); + base.Close(); } public override bool DisplayOnTop => false; From 5ad86d2b757baefcc57b1ac545e4283be8920e3a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 13:50:54 +0900 Subject: [PATCH 47/69] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 46d4704b0a..b28d4ba82a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 46d4704b0a3f140fa8ad10ca0b1553b67d8385ab +Subproject commit b28d4ba82af0138d38ff8b3f4f3392d9d9068da9 From b97d0ce0509566a008cf38153e157222562aebf3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 14:59:45 +0900 Subject: [PATCH 48/69] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..b28d4ba82a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit b28d4ba82af0138d38ff8b3f4f3392d9d9068da9 From b564215527f506b726d7305411219a34d1a8ba73 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 17:32:19 +0900 Subject: [PATCH 49/69] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..b28d4ba82a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit b28d4ba82af0138d38ff8b3f4f3392d9d9068da9 From b87e6c8b2ae1562045bb7cd3689a3cd9a594e9b0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 17:33:34 +0900 Subject: [PATCH 50/69] Add a method to get ruleset by name --- osu.Game/Rulesets/RulesetStore.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs index 5cdf46ee46..3038c51e64 100644 --- a/osu.Game/Rulesets/RulesetStore.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -38,6 +38,13 @@ namespace osu.Game.Rulesets /// A ruleset, if available, else null. public RulesetInfo GetRuleset(int id) => AvailableRulesets.FirstOrDefault(r => r.ID == id); + /// + /// Retrieve a ruleset using a known short name. + /// + /// The ruleset's short name. + /// A ruleset, if available, else null. + public RulesetInfo GetRuleset(string shortName) => AvailableRulesets.FirstOrDefault(r => r.ShortName == shortName); + /// /// All available rulesets. /// From cb18baa4d86e526d7d8ebf6cf6cb45618b07fe3f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 17:34:07 +0900 Subject: [PATCH 51/69] Add HitCircle/Slider testcases --- .../Objects/Drawables/DrawableSlider.cs | 5 -- .../Objects/ISliderProgress.cs | 10 +++ .../Tests/TestCaseHitCircle.cs | 51 +++++++++++ osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 88 +++++++++++++++++++ .../osu.Game.Rulesets.Osu.csproj | 3 + 5 files changed, 152 insertions(+), 5 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs create mode 100644 osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs create mode 100644 osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index d8a22d94ca..41d5ef1b02 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -167,9 +167,4 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public override Vector2 SelectionPoint => ToScreenSpace(body.Position); public override Quad SelectionQuad => body.PathDrawQuad; } - - internal interface ISliderProgress - { - void UpdateProgress(double progress, int repeat); - } } diff --git a/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs b/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs new file mode 100644 index 0000000000..cb0d177a60 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Osu.Objects +{ + public interface ISliderProgress + { + void UpdateProgress(double progress, int repeat); + } +} diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs new file mode 100644 index 0000000000..a86101285a --- /dev/null +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -0,0 +1,51 @@ +// 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.Containers; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseHitCircle : OsuTestCase + { + private readonly Container content; + protected override Container Content => content; + + public TestCaseHitCircle() + { + base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); + + AddStep("Single", addHitCircle); + AddStep("Stream", addStream); + } + + private void addHitCircle() + { + var circle = new HitCircle { StartTime = Time.Current + 1000 }; + circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre }); + } + + private void addStream() + { + Vector2 pos = Vector2.Zero; + + for (int i = 1000; i <= 2000; i += 100) + { + var circle = new HitCircle { StartTime = Time.Current + i, Position = pos }; + circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre, Depth = i}); + + pos += new Vector2(10); + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs new file mode 100644 index 0000000000..c423ca3736 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -0,0 +1,88 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Audio; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSlider : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] { typeof(DrawableSlider) }; + + private readonly Container content; + protected override Container Content => content; + + public TestCaseSlider() + { + base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); + + AddStep("Single", addSingle); + AddStep("Repeated (1)", () => addRepeated(1)); + AddStep("Repeated (2)", () => addRepeated(2)); + AddStep("Repeated (3)", () => addRepeated(3)); + AddStep("Repeated (4)", () => addRepeated(4)); + AddStep("Stream", addStream); + } + + private void addSingle() + { + var slider = new Slider + { + StartTime = Time.Current + 1000, + Position = new Vector2(-200, 0), + ControlPoints = new List + { + new Vector2(-200, 0), + new Vector2(400, 0), + }, + Distance = 400, + Velocity = 1, + TickDistance = 100, + }; + + slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + Add(new DrawableSlider(slider) { Anchor = Anchor.Centre }); + } + + private void addRepeated(int repeats) + { + var slider = new Slider + { + StartTime = Time.Current + 1000, + Position = new Vector2(-200, 0), + ControlPoints = new List + { + new Vector2(-200, 0), + new Vector2(400, 0), + }, + Distance = 400, + Velocity = 11, + TickDistance = 100, + RepeatCount = repeats, + RepeatSamples = new List[repeats].ToList() + }; + + slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + Add(new DrawableSlider(slider) { Anchor = Anchor.Centre }); + } + + private void addStream() + { + + } + } +} diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 6e61d7fb2d..d99f8bc948 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -75,6 +75,7 @@ + @@ -86,8 +87,10 @@ + + From 7d0c94fd01625e81565b530afe4df5e049c4c5ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 19:42:44 +0900 Subject: [PATCH 52/69] Fix notification overlay layout and scheduled tasks being delayed Closes #1295 --- .../Visual/TestCaseNotificationOverlay.cs | 49 ++++++++++++++++--- .../Notifications/NotificationSection.cs | 4 ++ 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index a83cead213..e1711be102 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Game.Overlays; @@ -19,11 +20,12 @@ namespace osu.Game.Tests.Visual public override IReadOnlyList RequiredTypes => new[] { - typeof(Notification), + typeof(NotificationSection), + typeof(SimpleNotification), typeof(ProgressNotification), typeof(ProgressCompletionNotification), - typeof(SimpleNotification), typeof(IHasCompletionTarget), + typeof(Notification) }; public TestCaseNotificationOverlay() @@ -40,17 +42,44 @@ namespace osu.Game.Tests.Visual Content.Add(displayedCount); + void setState(Visibility state) => AddStep(state.ToString(), () => manager.State = state); + void checkProgressingCount(int expected) => AddAssert($"progressing count is {expected}", () => progressingNotifications.Count == expected); + manager.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count}"; }; - AddStep(@"toggle", manager.ToggleVisibility); + + setState(Visibility.Visible); AddStep(@"simple #1", sendHelloNotification); AddStep(@"simple #2", sendAmazingNotification); AddStep(@"progress #1", sendUploadProgress); AddStep(@"progress #2", sendDownloadProgress); - AddStep(@"barrage", () => sendBarrage()); + + checkProgressingCount(2); + + setState(Visibility.Hidden); + + AddRepeatStep(@"add many simple", sendManyNotifications, 3); + AddWaitStep(5); + + checkProgressingCount(0); + + AddStep(@"progress #3", sendUploadProgress); + + checkProgressingCount(1); + + AddAssert("Displayed count is 33", () => manager.UnreadCount.Value == 33); + + AddWaitStep(5); + + checkProgressingCount(0); + + + setState(Visibility.Visible); + + //AddStep(@"barrage", () => sendBarrage()); } - private void sendBarrage(int remaining = 100) + private void sendBarrage(int remaining = 10) { switch (RNG.Next(0, 4)) { @@ -80,7 +109,7 @@ namespace osu.Game.Tests.Visual if (progressingNotifications.Count(n => n.State == ProgressNotificationState.Active) < 3) { - var p = progressingNotifications.FirstOrDefault(n => n.IsAlive && n.State == ProgressNotificationState.Queued); + var p = progressingNotifications.FirstOrDefault(n => n.State == ProgressNotificationState.Queued); if (p != null) p.State = ProgressNotificationState.Active; } @@ -88,7 +117,7 @@ namespace osu.Game.Tests.Visual foreach (var n in progressingNotifications.FindAll(n => n.State == ProgressNotificationState.Active)) { if (n.Progress < 1) - n.Progress += (float)(Time.Elapsed / 2000) * RNG.NextSingle(); + n.Progress += (float)(Time.Elapsed / 200) * RNG.NextSingle(); else n.State = ProgressNotificationState.Completed; } @@ -125,5 +154,11 @@ namespace osu.Game.Tests.Visual { manager.Post(new SimpleNotification { Text = @"Welcome to osu!. Enjoy your stay!" }); } + + private void sendManyNotifications() + { + for (int i = 0; i < 10; i++) + manager.Post(new SimpleNotification { Text = @"Spam incoming!!" }); + } } } diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 2bd0321d12..e6587506aa 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -20,6 +20,10 @@ namespace osu.Game.Overlays.Notifications private OsuSpriteText titleText; private OsuSpriteText countText; + // this is required to ensure correct layout and scheduling on children. + // the layout portion of this is being tracked as a framework issue (TODO). + protected override bool RequiresChildrenUpdate => true; + private ClearAllButton clearButton; private FlowContainer notifications; From 4d5216da00d63a8830c42d3e7718d912b49fcc6c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 19:47:42 +0900 Subject: [PATCH 53/69] Finish up implementation of TestCaseSlider --- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 66 ++++++++++++++----- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index c423ca3736..5b9047db88 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Audio; @@ -11,7 +10,6 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Tests.Visual; using OpenTK; @@ -24,11 +22,18 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly Container content; protected override Container Content => content; + private double speedMultiplier; + private double sliderMultiplier; + private int depthIndex; + public TestCaseSlider() { base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - AddStep("Single", addSingle); + AddSliderStep("SpeedMultiplier", 0.01, 10, 2, s => speedMultiplier = s); + AddSliderStep("SliderMultiplier", 0.01, 10, 2, s => sliderMultiplier = s); + + AddStep("Single", () => addSingle()); AddStep("Repeated (1)", () => addRepeated(1)); AddStep("Repeated (2)", () => addRepeated(2)); AddStep("Repeated (3)", () => addRepeated(3)); @@ -36,29 +41,44 @@ namespace osu.Game.Rulesets.Osu.Tests AddStep("Stream", addStream); } - private void addSingle() + private void addSingle(double timeOffset = 0, Vector2? positionOffset = null) { + positionOffset = positionOffset ?? Vector2.Zero; + var slider = new Slider { - StartTime = Time.Current + 1000, - Position = new Vector2(-200, 0), + StartTime = Time.Current + 1000 + timeOffset, + Position = new Vector2(-200, 0) + positionOffset.Value, ControlPoints = new List { - new Vector2(-200, 0), - new Vector2(400, 0), + new Vector2(-200, 0) + positionOffset.Value, + new Vector2(400, 0) + positionOffset.Value, }, Distance = 400, - Velocity = 1, - TickDistance = 100, }; - slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + var cpi = new ControlPointInfo(); + cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - Add(new DrawableSlider(slider) { Anchor = Anchor.Centre }); + var difficulty = new BeatmapDifficulty { SliderMultiplier = (float)sliderMultiplier }; + + slider.ApplyDefaults(cpi, difficulty); + Add(new DrawableSlider(slider) + { + Anchor = Anchor.Centre, + Depth = depthIndex++ + }); } private void addRepeated(int repeats) { + // The first run through the slider is considered a repeat + repeats++; + + var repeatSamples = new List>(); + for (int i = 0; i < repeats; i++) + repeatSamples.Add(new List()); + var slider = new Slider { StartTime = Time.Current + 1000, @@ -69,20 +89,32 @@ namespace osu.Game.Rulesets.Osu.Tests new Vector2(400, 0), }, Distance = 400, - Velocity = 11, - TickDistance = 100, RepeatCount = repeats, - RepeatSamples = new List[repeats].ToList() + RepeatSamples = repeatSamples }; - slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + var cpi = new ControlPointInfo(); + cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - Add(new DrawableSlider(slider) { Anchor = Anchor.Centre }); + var difficulty = new BeatmapDifficulty { SliderMultiplier = (float)sliderMultiplier }; + + slider.ApplyDefaults(cpi, difficulty); + Add(new DrawableSlider(slider) + { + Anchor = Anchor.Centre, + Depth = depthIndex++ + }); } private void addStream() { + Vector2 pos = Vector2.Zero; + for (int i = 0; i <= 1000; i += 100) + { + addSingle(i, pos); + pos += new Vector2(10); + } } } } From fdafc2107e40b5cd51916e648a3ae7a807491042 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 19:47:55 +0900 Subject: [PATCH 54/69] Cleanups + add auto to TestCaseHitCircle --- .../Tests/TestCaseHitCircle.cs | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index a86101285a..dea941fb01 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; @@ -17,33 +18,49 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly Container content; protected override Container Content => content; + private bool auto; + private int depthIndex; + public TestCaseHitCircle() { base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - AddStep("Single", addHitCircle); + AddStep("Single", () => addSingle()); AddStep("Stream", addStream); + AddToggleStep("Auto", v => auto = v); } - private void addHitCircle() + private void addSingle(double timeOffset = 0, Vector2? positionOffset = null) { - var circle = new HitCircle { StartTime = Time.Current + 1000 }; + positionOffset = positionOffset ?? Vector2.Zero; + + var circle = new HitCircle + { + StartTime = Time.Current + 1000 + timeOffset, + Position = positionOffset.Value + }; + circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre }); + var drawable = new DrawableHitCircle(circle) + { + Anchor = Anchor.Centre, + Depth = depthIndex++ + }; + + if (auto) + drawable.State.Value = ArmedState.Hit; + + Add(drawable); } private void addStream() { Vector2 pos = Vector2.Zero; - for (int i = 1000; i <= 2000; i += 100) + for (int i = 0; i <= 1000; i += 100) { - var circle = new HitCircle { StartTime = Time.Current + i, Position = pos }; - circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - - Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre, Depth = i}); - + addSingle(i, pos); pos += new Vector2(10); } } From ccaf63a4378219d4cdef5453500c63acef9a94c0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:01:20 +0900 Subject: [PATCH 55/69] Add a Spinner testcase --- .../Tests/TestCaseSpinner.cs | 43 +++++++++++++++++++ .../osu.Game.Rulesets.Osu.csproj | 1 + 2 files changed, 44 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs new file mode 100644 index 0000000000..6db9c1a473 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs @@ -0,0 +1,43 @@ +// 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.Containers; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSpinner : OsuTestCase + { + private readonly Container content; + protected override Container Content => content; + + private int depthIndex; + + public TestCaseSpinner() + { + base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); + + AddStep("Single", addSingle); + } + + private void addSingle() + { + var spinner = new Spinner { StartTime = Time.Current + 1000, EndTime = Time.Current + 4000 }; + + spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + var drawable = new DrawableSpinner(spinner) + { + Anchor = Anchor.Centre, + Depth = depthIndex++ + }; + + Add(drawable); + } + } +} diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index d99f8bc948..ab34d1803f 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -91,6 +91,7 @@ + From 4c032df6770e2372b899929628aa9f48a7876c74 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:08:33 +0900 Subject: [PATCH 56/69] Move sliderbars to the end of the testcase buttons --- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 5b9047db88..4f7fa1dada 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -22,23 +22,23 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly Container content; protected override Container Content => content; - private double speedMultiplier; - private double sliderMultiplier; + private double speedMultiplier = 2; + private double sliderMultiplier = 2; private int depthIndex; public TestCaseSlider() { base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - AddSliderStep("SpeedMultiplier", 0.01, 10, 2, s => speedMultiplier = s); - AddSliderStep("SliderMultiplier", 0.01, 10, 2, s => sliderMultiplier = s); - AddStep("Single", () => addSingle()); AddStep("Repeated (1)", () => addRepeated(1)); AddStep("Repeated (2)", () => addRepeated(2)); AddStep("Repeated (3)", () => addRepeated(3)); AddStep("Repeated (4)", () => addRepeated(4)); AddStep("Stream", addStream); + + AddSliderStep("SpeedMultiplier", 0.01, 10, 2, s => speedMultiplier = s); + AddSliderStep("SliderMultiplier", 0.01, 10, 2, s => sliderMultiplier = s); } private void addSingle(double timeOffset = 0, Vector2? positionOffset = null) From 5b45d36fef389bbae971bf4e87ea472b9240ea9f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:09:33 +0900 Subject: [PATCH 57/69] Decomission TestCaseHitObjects --- .../Tests/TestCaseHitObjects.cs | 129 ------------------ .../osu.Game.Rulesets.Osu.csproj | 1 - 2 files changed, 130 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Tests/TestCaseHitObjects.cs diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitObjects.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitObjects.cs deleted file mode 100644 index c4932d7803..0000000000 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitObjects.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; -using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Timing; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Tests.Visual; -using OpenTK; - -namespace osu.Game.Rulesets.Osu.Tests -{ - [TestFixture] - [Ignore("getting CI working")] - public class TestCaseHitObjects : OsuTestCase - { - private FramedClock framedClock; - - private bool auto; - - [BackgroundDependencyLoader] - private void load(RulesetStore rulesets) - { - var rateAdjustClock = new StopwatchClock(true); - framedClock = new FramedClock(rateAdjustClock); - - AddStep(@"circles", () => loadHitobjects(HitObjectType.Circle)); - AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider)); - AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner)); - - AddToggleStep("Auto", state => { auto = state; loadHitobjects(mode); }); - AddSliderStep("Playback speed", 0.0, 2.0, 0.5, v => rateAdjustClock.Rate = v); - - framedClock.ProcessFrame(); - - var clockAdjustContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Clock = framedClock, - Children = new[] - { - playfieldContainer = new OsuInputManager(rulesets.GetRuleset(0)) { RelativeSizeAxes = Axes.Both }, - approachContainer = new Container { RelativeSizeAxes = Axes.Both } - } - }; - - Add(clockAdjustContainer); - } - - private HitObjectType mode = HitObjectType.Slider; - - private Container playfieldContainer; - private Container approachContainer; - - private void loadHitobjects(HitObjectType mode) - { - this.mode = mode; - - switch (mode) - { - case HitObjectType.Circle: - const int count = 10; - - for (int i = 0; i < count; i++) - { - var h = new HitCircle - { - StartTime = framedClock.CurrentTime + 600 + i * 80, - Position = new Vector2((i - count / 2) * 14), - }; - - add(new DrawableHitCircle(h)); - } - break; - case HitObjectType.Slider: - add(new DrawableSlider(new Slider - { - StartTime = framedClock.CurrentTime + 600, - ControlPoints = new List - { - new Vector2(-200, 0), - new Vector2(400, 0), - }, - Distance = 400, - Position = new Vector2(-200, 0), - Velocity = 1, - TickDistance = 100, - })); - break; - case HitObjectType.Spinner: - add(new DrawableSpinner(new Spinner - { - StartTime = framedClock.CurrentTime + 600, - EndTime = framedClock.CurrentTime + 1600, - Position = new Vector2(0, 0), - })); - break; - } - } - - private int depth; - - private void add(DrawableOsuHitObject h) - { - h.Anchor = Anchor.Centre; - h.Depth = depth++; - - if (auto) - h.State.Value = ArmedState.Hit; - - playfieldContainer.Add(h); - var proxyable = h as IDrawableHitObjectWithProxiedApproach; - if (proxyable != null) - approachContainer.Add(proxyable.ProxiedLayer.CreateProxy()); - } - - private enum HitObjectType - { - Circle, - Slider, - Spinner - } - } -} diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index ab34d1803f..245f3eed91 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -88,7 +88,6 @@ - From edab169024fb253470865aaf0fac2216485fb9f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 20:27:20 +0900 Subject: [PATCH 58/69] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..10cae790c6 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit 10cae790c6f1d559c326f9438958d0b012d61dc6 From c18fd5da48fc28f1c4a610e05a19973a99e3db3b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:37:28 +0900 Subject: [PATCH 59/69] Simplify creation of repeat points --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 35 ++++++++----------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 2d3a4ed7f0..bfb7801532 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -151,35 +151,22 @@ namespace osu.Game.Rulesets.Osu.Objects private void createRepeatPoints() { - var length = Curve.Distance; - var repeatPointDistance = Math.Min(Distance, length); - var repeatDuration = length / Velocity; - - bool sliderStart = true; + var repeatDuration = Distance / Velocity; for (var repeat = 1; repeat < RepeatCount; repeat++) { - sliderStart = !sliderStart; + var repeatStartTime = StartTime + repeat * repeatDuration; - for (var d = repeatPointDistance; d <= length; d += repeatPointDistance) + AddNested(new RepeatPoint { - var repeatStartTime = StartTime + repeat * repeatDuration; - var distanceProgress = d / length; - - if (sliderStart) - distanceProgress = 0; - - AddNested(new RepeatPoint - { - RepeatIndex = repeat, - StartTime = repeatStartTime, - Position = Curve.PositionAt(distanceProgress), - StackHeight = StackHeight, - Scale = Scale, - ComboColour = ComboColour, - Samples = new List(RepeatSamples[repeat]) - }); - } + RepeatIndex = repeat, + StartTime = repeatStartTime, + Position = Curve.PositionAt(repeat), + StackHeight = StackHeight, + Scale = Scale, + ComboColour = ComboColour, + Samples = new List(RepeatSamples[repeat]) + }); } } } From 1a5cf98e0c51e13f15ac826878eca260d7db7fce Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:40:38 +0900 Subject: [PATCH 60/69] Fix repeat points always being placed at end position of th slider PositionAt is clamped to [0, 1] where 0 denotes the beginning of the curve and 1 denotes the end of the curve. It has no concept of repeats. --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index bfb7801532..ec51a10345 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -161,7 +161,7 @@ namespace osu.Game.Rulesets.Osu.Objects { RepeatIndex = repeat, StartTime = repeatStartTime, - Position = Curve.PositionAt(repeat), + Position = Curve.PositionAt(repeat % 2), StackHeight = StackHeight, Scale = Scale, ComboColour = ComboColour, From 6fe20bb91099abb437e93c0026ad61a081cc9db3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:41:59 +0900 Subject: [PATCH 61/69] Ignore test cases for CI --- osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 2 ++ osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index dea941fb01..5130a976f7 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.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 NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; @@ -13,6 +14,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Tests { + [Ignore("getting CI working")] public class TestCaseHitCircle : OsuTestCase { private readonly Container content; diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 4f7fa1dada..3e861b0890 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Audio; @@ -15,6 +16,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Tests { + [Ignore("getting CI working")] public class TestCaseSlider : OsuTestCase { public override IReadOnlyList RequiredTypes => new[] { typeof(DrawableSlider) }; diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs index 6db9c1a473..fc76170585 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.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 NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; @@ -11,6 +12,7 @@ using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Osu.Tests { + [Ignore("getting CI working")] public class TestCaseSpinner : OsuTestCase { private readonly Container content; From 46ef17354ee1922f30ef2e64d38ee321455e0f2b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 21:05:16 +0900 Subject: [PATCH 62/69] Simplify path construction --- osu.Game/Audio/SampleInfo.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 1133dde570..31acb8bc89 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.IO; using osu.Framework.Audio.Sample; namespace osu.Game.Audio @@ -16,14 +17,7 @@ namespace osu.Game.Audio public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null) { - SampleChannel channel = null; - - if (!string.IsNullOrEmpty(resourceNamespace)) - channel = manager.Get($"Gameplay/{resourceNamespace}/{Bank}-{Name}"); - - if (channel == null) - channel = manager.Get($"Gameplay/{Bank}-{Name}"); - + SampleChannel channel = manager.Get(Path.Combine("Gameplay", resourceNamespace ?? string.Empty, $"{Bank}-{Name}")); channel.Volume.Value = Volume / 100.0; return channel; } From 3428cf65012e214751349a0a9d5de75a3b65dba4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 20:26:14 +0900 Subject: [PATCH 63/69] Decrease speed of progress notifications --- osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index e1711be102..46deca073f 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual AddAssert("Displayed count is 33", () => manager.UnreadCount.Value == 33); - AddWaitStep(5); + AddWaitStep(10); checkProgressingCount(0); @@ -117,7 +117,7 @@ namespace osu.Game.Tests.Visual foreach (var n in progressingNotifications.FindAll(n => n.State == ProgressNotificationState.Active)) { if (n.Progress < 1) - n.Progress += (float)(Time.Elapsed / 200) * RNG.NextSingle(); + n.Progress += (float)(Time.Elapsed / 400) * RNG.NextSingle(); else n.State = ProgressNotificationState.Completed; } From 9a4b2f0d1dfe607f7bc773be2b47d707fe98bd85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 21:19:06 +0900 Subject: [PATCH 64/69] Apply workaround at two levels --- .../Notifications/NotificationSection.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index e6587506aa..42fcc3aa0f 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -15,15 +15,11 @@ using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Notifications { - public class NotificationSection : FillFlowContainer + public class NotificationSection : AlwaysUpdateFillFlowContainer { private OsuSpriteText titleText; private OsuSpriteText countText; - // this is required to ensure correct layout and scheduling on children. - // the layout portion of this is being tracked as a framework issue (TODO). - protected override bool RequiresChildrenUpdate => true; - private ClearAllButton clearButton; private FlowContainer notifications; @@ -37,6 +33,7 @@ namespace osu.Game.Overlays.Notifications public IEnumerable AcceptTypes; private string clearText; + public string ClearText { get { return clearText; } @@ -114,7 +111,7 @@ namespace osu.Game.Overlays.Notifications }, }, }, - notifications = new FillFlowContainer + notifications = new AlwaysUpdateFillFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, @@ -163,4 +160,13 @@ namespace osu.Game.Overlays.Notifications notifications?.Children.ForEach(n => n.Read = true); } } + + public class AlwaysUpdateFillFlowContainer : FillFlowContainer + where T : Drawable + { + // this is required to ensure correct layout and scheduling on children. + // the layout portion of this is being tracked as a framework issue (https://github.com/ppy/osu-framework/issues/1297). + protected override bool RequiresChildrenUpdate => true; + } + } From 3f73a9a693ab6573e7fef09bfca8d7ce1106e720 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 21:44:04 +0900 Subject: [PATCH 65/69] Add better sample fallback logic Also adds support for null channels at InputDrum level. --- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 4 ++-- osu.Game/Audio/SampleInfo.cs | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index bf1274256b..9b2ea095d2 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -152,14 +152,14 @@ namespace osu.Game.Rulesets.Taiko.UI target = centreHit; back = centre; - drumSample.Centre.Play(); + drumSample.Centre?.Play(); } else if (action == RimAction) { target = rimHit; back = rim; - drumSample.Rim.Play(); + drumSample.Rim?.Play(); } if (target != null) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 31acb8bc89..9597acd902 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -17,8 +17,18 @@ namespace osu.Game.Audio public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null) { - SampleChannel channel = manager.Get(Path.Combine("Gameplay", resourceNamespace ?? string.Empty, $"{Bank}-{Name}")); - channel.Volume.Value = Volume / 100.0; + SampleChannel channel = null; + + if (resourceNamespace != null) + channel = manager.Get(Path.Combine("Gameplay", resourceNamespace, $"{Bank}-{Name}")); + + // try without namespace as a fallback. + if (channel == null) + channel = manager.Get(Path.Combine("Gameplay", $"{Bank}-{Name}")); + + if (channel != null) + channel.Volume.Value = Volume / 100.0; + return channel; } From 3a2dadc9d390b2112d201eef4a1b5a16d7409d56 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Wed, 27 Dec 2017 23:14:48 +0900 Subject: [PATCH 66/69] Fix spelling error --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index ffdd1daf72..e877633ab3 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Select public override bool HandleInput => AllowSelection; /// - /// Used to avoid firing null selections before the initial baetmaps have been loaded via . + /// Used to avoid firing null selections before the initial beatmaps have been loaded via . /// private bool initialLoadComplete; From 7b06c16e70882bfbcbb8003da9172259f6dba97f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 23:44:51 +0900 Subject: [PATCH 67/69] Display larger hitcircles --- osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs | 2 +- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 12 ++++++++++-- osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index 5130a976f7..ef0bffa14e 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Tests Position = positionOffset.Value }; - circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 0 }); var drawable = new DrawableHitCircle(circle) { diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 3e861b0890..7ce9c35bd5 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -62,7 +62,11 @@ namespace osu.Game.Rulesets.Osu.Tests var cpi = new ControlPointInfo(); cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - var difficulty = new BeatmapDifficulty { SliderMultiplier = (float)sliderMultiplier }; + var difficulty = new BeatmapDifficulty + { + SliderMultiplier = (float)sliderMultiplier, + CircleSize = 0 + }; slider.ApplyDefaults(cpi, difficulty); Add(new DrawableSlider(slider) @@ -98,7 +102,11 @@ namespace osu.Game.Rulesets.Osu.Tests var cpi = new ControlPointInfo(); cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - var difficulty = new BeatmapDifficulty { SliderMultiplier = (float)sliderMultiplier }; + var difficulty = new BeatmapDifficulty + { + SliderMultiplier = (float)sliderMultiplier, + CircleSize = 0 + }; slider.ApplyDefaults(cpi, difficulty); Add(new DrawableSlider(slider) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs index fc76170585..76cc70effd 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Tests { var spinner = new Spinner { StartTime = Time.Current + 1000, EndTime = Time.Current + 4000 }; - spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 0 }); var drawable = new DrawableSpinner(spinner) { From 7a0662da4b9364963774240d849284cc904cf2be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Dec 2017 00:38:50 +0900 Subject: [PATCH 68/69] Fix regression during merges --- osu.Game/OsuGame.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 9c852a189a..2bc32794d7 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -440,12 +440,16 @@ namespace osu.Game private void screenAdded(Screen newScreen) { + currentScreen = (OsuScreen)newScreen; + newScreen.ModePushed += screenAdded; newScreen.Exited += screenRemoved; } private void screenRemoved(Screen newScreen) { + currentScreen = (OsuScreen)newScreen; + if (newScreen == null) Exit(); } From 4e6988d21bba51441c9553d12580c1e8e7bfd11f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Dec 2017 01:00:01 +0900 Subject: [PATCH 69/69] As it turns out, native directory separators are not supported --- osu.Game/Audio/SampleInfo.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 9597acd902..71975bf0fa 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.IO; using osu.Framework.Audio.Sample; namespace osu.Game.Audio @@ -20,11 +19,11 @@ namespace osu.Game.Audio SampleChannel channel = null; if (resourceNamespace != null) - channel = manager.Get(Path.Combine("Gameplay", resourceNamespace, $"{Bank}-{Name}")); + channel = manager.Get($"Gameplay/{resourceNamespace}/{Bank}-{Name}"); // try without namespace as a fallback. if (channel == null) - channel = manager.Get(Path.Combine("Gameplay", $"{Bank}-{Name}")); + channel = manager.Get($"Gameplay/{Bank}-{Name}"); if (channel != null) channel.Volume.Value = Volume / 100.0;