From d8724e5e3e3fe5a7ac303ca14846462be4a20824 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 24 Mar 2017 23:02:24 +0100 Subject: [PATCH 01/93] Add metadata details --- .../Tests/TestCaseDetails.cs | 31 +++++++ .../osu.Desktop.VisualTests.csproj | 5 +- osu.Game/Screens/Select/BeatmapDetailArea.cs | 29 +++++-- osu.Game/Screens/Select/Details.cs | 87 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 5 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseDetails.cs create mode 100644 osu.Game/Screens/Select/Details.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs new file mode 100644 index 0000000000..b97c61218f --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -0,0 +1,31 @@ +using osu.Framework.Graphics; +using osu.Framework.Screens.Testing; +using osu.Game.Database; +using osu.Game.Screens.Select; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace osu.Desktop.VisualTests.Tests +{ + class TestCaseDetails : TestCase + { + + public override void Reset() + { + base.Reset(); + + Add(new Details + { + RelativeSizeAxes = Axes.Both, + Metadata = new BeatmapMetadata + { + Source = "Some guy", + Tags = "beatmap metadata example with a very very long list of tags and not much creativity", + }, + }); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index f1b4a99510..d94358a6a1 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -1,4 +1,4 @@ - + {69051C69-12AE-4E7D-A3E6-460D2E282312} @@ -183,6 +183,7 @@ + @@ -211,7 +212,7 @@ - + diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 21e4d643f2..c7ee57e36c 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -17,8 +18,9 @@ namespace osu.Game.Screens.Select private readonly Container content; protected override Container Content => content; - public readonly Container Details; //todo: replace with a real details view when added + public readonly Details Details; public readonly Leaderboard Leaderboard; + private BeatmapDetailTab currentTab; private APIAccess api; @@ -32,7 +34,11 @@ namespace osu.Game.Screens.Select set { beatmap = value; - if (IsLoaded) Schedule(updateScores); + if (IsLoaded) + if(currentTab == BeatmapDetailTab.Details) + Schedule(updateDetails); + else + Schedule(updateScores); } } @@ -50,15 +56,15 @@ namespace osu.Game.Screens.Select case BeatmapDetailTab.Details: Details.Show(); Leaderboard.Hide(); + updateDetails(); break; default: Details.Hide(); Leaderboard.Show(); + updateScores(); break; } - - //for now let's always update scores. - updateScores(); + currentTab = tab; }, }, content = new Container @@ -70,7 +76,7 @@ namespace osu.Game.Screens.Select Add(new Drawable[] { - Details = new Container + Details = new Details { RelativeSizeAxes = Axes.Both, }, @@ -107,5 +113,16 @@ namespace osu.Game.Screens.Select getScoresRequest.Success += r => Leaderboard.Scores = r.Scores; api.Queue(getScoresRequest); } + + + + private void updateDetails() + { + if (!IsLoaded) return; + + if (api == null || beatmap?.BeatmapInfo == null) return; + + Details.Metadata = beatmap.Beatmap.Metadata; + } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs new file mode 100644 index 0000000000..7748bcd1b5 --- /dev/null +++ b/osu.Game/Screens/Select/Details.cs @@ -0,0 +1,87 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics; +using osu.Game.Database; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics; +using OpenTK; +using osu.Framework.Allocation; + +namespace osu.Game.Screens.Select +{ + public class Details : Container + { + private FillFlowContainer metadataContainer; + private SpriteText description; + private SpriteText source; + private FillFlowContainer tags; + private BeatmapMetadata metadata; + public BeatmapMetadata Metadata + { + get + { + return metadata; + } + + set + { + if (metadata == value) return; + metadata = value; + source.Text = metadata.Source; + tags.Children = metadata.Tags.Split(' ').ToList().Select(text => new SpriteText { Text = text }); + } + } + + public Details() + { + Children = new[] + { + metadataContainer = new FillFlowContainer() + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.4f, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new SpriteText + { + Text = "Description", + }, + description = new SpriteText(), + new SpriteText + { + Text = "Source", + Margin = new MarginPadding { Top = 20 }, + }, + source = new SpriteText(), + new SpriteText + { + Text = "Tags", + Margin = new MarginPadding { Top = 20 }, + }, + tags = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + Spacing = new Vector2(3,0), + }, + }, + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + description.Colour = colour.GrayB; + source.Colour = colour.GrayB; + tags.Colour = colour.Yellow; + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 989e605c16..9d7627b5f2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -201,6 +201,7 @@ + From 775fd63d0fa6a03184d77e556f1c17416359908e Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 25 Mar 2017 23:33:03 +0100 Subject: [PATCH 02/93] Added difficulty container --- .../Tests/TestCaseDetails.cs | 23 +- osu.Game/Screens/Select/BeatmapDetailArea.cs | 5 +- osu.Game/Screens/Select/Details.cs | 239 ++++++++++++++++-- osu.Game/Screens/Select/DetailsBar.cs | 68 +++++ osu.Game/osu.Game.csproj | 1 + 5 files changed, 309 insertions(+), 27 deletions(-) create mode 100644 osu.Game/Screens/Select/DetailsBar.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index b97c61218f..36e52717e4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -1,4 +1,7 @@ -using osu.Framework.Graphics; +// 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.Screens.Testing; using osu.Game.Database; using osu.Game.Screens.Select; @@ -20,10 +23,22 @@ namespace osu.Desktop.VisualTests.Tests Add(new Details { RelativeSizeAxes = Axes.Both, - Metadata = new BeatmapMetadata + Beatmap = new BeatmapInfo { - Source = "Some guy", - Tags = "beatmap metadata example with a very very long list of tags and not much creativity", + Version = "VisualTest", + Metadata = new BeatmapMetadata + { + Source = "Some guy", + Tags = "beatmap metadata example with a very very long list of tags and not much creativity", + }, + Difficulty = new BeatmapDifficulty + { + CircleSize = 7, + ApproachRate = 3.5f, + OverallDifficulty = 5.7f, + DrainRate = 1, + }, + StarDifficulty = 5.3f, }, }); } diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index c7ee57e36c..f2e5388d0c 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -79,6 +79,7 @@ namespace osu.Game.Screens.Select Details = new Details { RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(5), }, Leaderboard = new Leaderboard { @@ -121,8 +122,8 @@ namespace osu.Game.Screens.Select if (!IsLoaded) return; if (api == null || beatmap?.BeatmapInfo == null) return; - - Details.Metadata = beatmap.Beatmap.Metadata; + + Details.Beatmap = beatmap.Beatmap.BeatmapInfo; } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 7748bcd1b5..2374d0a674 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -1,46 +1,72 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics; -using osu.Game.Database; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Primitives; -using osu.Game.Graphics; using OpenTK; +using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Game.Database; +using osu.Game.Graphics; +using System.Linq; namespace osu.Game.Screens.Select { public class Details : Container { - private FillFlowContainer metadataContainer; private SpriteText description; private SpriteText source; private FillFlowContainer tags; - private BeatmapMetadata metadata; - public BeatmapMetadata Metadata + + private DifficultyRow circleSize; + private DifficultyRow drainRate; + private DifficultyRow approachRate; + private DifficultyRow overallDifficulty; + private DifficultyRow stars; + + private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { get { - return metadata; + return beatmap; } set { - if (metadata == value) return; - metadata = value; - source.Text = metadata.Source; - tags.Children = metadata.Tags.Split(' ').ToList().Select(text => new SpriteText { Text = text }); + if (beatmap == value) return; + beatmap = value; + description.Text = beatmap.Version; + source.Text = beatmap.Metadata.Source; + tags.Children = beatmap.Metadata.Tags.Split(' ').Select(text => new SpriteText + { + Text = text, + TextSize = 14, + Font = "Exo2.0-Medium", + }); + + circleSize.Value = beatmap.Difficulty.CircleSize; + drainRate.Value = beatmap.Difficulty.DrainRate; + approachRate.Value = beatmap.Difficulty.ApproachRate; + overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; + stars.Value = (float) beatmap.StarDifficulty; } } public Details() { - Children = new[] + Children = new Drawable[] { - metadataContainer = new FillFlowContainer() + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, + }, + new FillFlowContainer() { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -48,22 +74,39 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.4f, Direction = FillDirection.Vertical, + Padding = new MarginPadding(5), Children = new Drawable[] { new SpriteText { Text = "Description", + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + description = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + Direction = FillDirection.Full, }, - description = new SpriteText(), new SpriteText { Text = "Source", + TextSize = 14, + Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 20 }, }, - source = new SpriteText(), + source = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + Direction = FillDirection.Full, + }, new SpriteText { Text = "Tags", + TextSize = 14, + Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 20 }, }, tags = new FillFlowContainer @@ -72,7 +115,65 @@ namespace osu.Game.Screens.Select Spacing = new Vector2(3,0), }, }, - } + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.6f, + Padding = new MarginPadding(5) { Top = 0 }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0,10), + Padding = new MarginPadding(7), + Children = new [] + { + circleSize = new DifficultyRow + { + DifficultyName = "Circle Size", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + MaxValue = 7, + }, + drainRate = new DifficultyRow + { + DifficultyName = "HP Drain", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + approachRate = new DifficultyRow + { + DifficultyName = "Accuracy", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + overallDifficulty = new DifficultyRow + { + DifficultyName = "Limit Break", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + stars = new DifficultyRow + { + DifficultyName = "Star Difficulty", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + }, + }, + }, + }, }; } @@ -81,7 +182,103 @@ namespace osu.Game.Screens.Select { description.Colour = colour.GrayB; source.Colour = colour.GrayB; - tags.Colour = colour.Yellow; + tags.Colour = colour.YellowLight; + stars.BarColour = colour.YellowLight; + } + + private class DifficultyRow : Container + { + private SpriteText name; + private DetailsBar bar; + private SpriteText valueText; + + private float difficultyValue; + public float Value + { + get + { + return difficultyValue; + } + set + { + difficultyValue = value; + bar.Value = value/maxValue; + valueText.Text = value.ToString(); + } + } + + private float maxValue = 10; + public float MaxValue + { + get + { + return maxValue; + } + set + { + maxValue = value; + bar.Value = Value/value; + } + } + + public string DifficultyName + { + get + { + return name.Text; + } + set + { + name.Text = value; + } + } + + public SRGBColour BarColour + { + get + { + return bar.BarColour; + } + set + { + bar.BarColour = value; + } + } + + public DifficultyRow() + { + Children = new Drawable[] + { + name = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + }, + bar = new DetailsBar + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1, 0.35f), + Padding = new MarginPadding { Left = 100, Right = 25 }, + }, + valueText = new SpriteText + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + TextSize = 14, + Font = @"Exo2.0-Medium", + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + name.Colour = colour.GrayB; + bar.BackgroundColour = colour.Gray7; + valueText.Colour = colour.GrayB; + } } } } diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs new file mode 100644 index 0000000000..aabdf6809f --- /dev/null +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Screens.Select +{ + class DetailsBar : Container + { + private Box background; + private Box bar; + + public float Value + { + get + { + return bar.Width; + } + set + { + bar.ResizeTo(new Vector2(value, 1), 200); + } + } + + public SRGBColour BackgroundColour + { + get + { + return background.Colour; + } + set + { + background.Colour = value; + } + } + + public SRGBColour BarColour + { + get + { + return bar.Colour; + } + set + { + bar.Colour = value; + } + } + + public DetailsBar() + { + Children = new [] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + bar = new Box + { + RelativeSizeAxes = Axes.Both, + } + }; + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9d7627b5f2..2198167c7d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -202,6 +202,7 @@ + From 909fdb647c11b13ad24802e94bdb2361919f3c1a Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 28 Mar 2017 17:12:54 +0200 Subject: [PATCH 03/93] Added ratings and different bar rotations --- .../Tests/TestCaseDetails.cs | 4 + .../osu.Desktop.VisualTests.csproj | 2 +- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 + osu.Game/Screens/Select/Details.cs | 205 ++++++++++++++---- osu.Game/Screens/Select/DetailsBar.cs | 63 +++++- 5 files changed, 231 insertions(+), 44 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 36e52717e4..d0d7602831 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -40,6 +40,10 @@ namespace osu.Desktop.VisualTests.Tests }, StarDifficulty = 5.3f, }, + Ratings = new[] + { + 1,2,3,4,5,6,7,8,9,10 + } }); } } diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index d94358a6a1..19b679dc1c 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -212,7 +212,7 @@ - + diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index f2e5388d0c..337ad04e7d 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -124,6 +124,7 @@ namespace osu.Game.Screens.Select if (api == null || beatmap?.BeatmapInfo == null) return; Details.Beatmap = beatmap.Beatmap.BeatmapInfo; + } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 2374d0a674..54f3d5b519 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; +using System.Collections.Generic; using System.Linq; namespace osu.Game.Screens.Select @@ -23,10 +24,15 @@ namespace osu.Game.Screens.Select private DifficultyRow circleSize; private DifficultyRow drainRate; - private DifficultyRow approachRate; private DifficultyRow overallDifficulty; + private DifficultyRow approachRate; private DifficultyRow stars; + private DetailsBar ratingsBar; + private SpriteText negativeRatings; + private SpriteText positiveRatings; + private FillFlowContainer ratingsGraph; + private BeatmapInfo beatmap; public BeatmapInfo Beatmap { @@ -50,12 +56,43 @@ namespace osu.Game.Screens.Select circleSize.Value = beatmap.Difficulty.CircleSize; drainRate.Value = beatmap.Difficulty.DrainRate; - approachRate.Value = beatmap.Difficulty.ApproachRate; overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; + approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float) beatmap.StarDifficulty; } } + private List ratings; + public IEnumerable Ratings + { + get + { + return ratings; + } + set + { + ratings = value.ToList(); + negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); + positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); + ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); + + List ratingsGraphBars = ratingsGraph.Children.ToList(); + for (int i = 0; i < 10; i++) + if(ratingsGraphBars.Count > i) + ratingsGraphBars[i].Length = (float)ratings[i] / ratings.Max(); + else + ratingsGraph.Add(new DetailsBar + { + RelativeSizeAxes = Axes.Both, + Width = 0.1f, + Length = (float)ratings[i] / ratings.Max(), + Direction = BarDirection.BottomToTop, + BackgroundColour = new Color4(0, 0, 0, 0), + }); + } + } + + public Details() { Children = new Drawable[] @@ -74,7 +111,7 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.4f, Direction = FillDirection.Vertical, - Padding = new MarginPadding(5), + Padding = new MarginPadding(10) { Top = 25 }, Children = new Drawable[] { new SpriteText @@ -116,59 +153,143 @@ namespace osu.Game.Screens.Select }, }, }, - new Container + new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Width = 0.6f, - Padding = new MarginPadding(5) { Top = 0 }, - Children = new Drawable[] + Direction = FillDirection.Vertical, + Spacing = new Vector2(0,15), + Padding = new MarginPadding(10) { Top = 0 }, + Children = new [] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - Alpha = 0.5f, - }, - new FillFlowContainer + new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0,10), - Padding = new MarginPadding(7), - Children = new [] + Children = new Drawable[] { - circleSize = new DifficultyRow + new Box { - DifficultyName = "Circle Size", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - MaxValue = 7, + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, }, - drainRate = new DifficultyRow + new FillFlowContainer { - DifficultyName = "HP Drain", - AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0,10), + Padding = new MarginPadding(15) { Top = 25 }, + Children = new [] + { + circleSize = new DifficultyRow + { + DifficultyName = "Circle Size", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + MaxValue = 7, + }, + drainRate = new DifficultyRow + { + DifficultyName = "HP Drain", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + overallDifficulty = new DifficultyRow + { + DifficultyName = "Accuracy", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + approachRate = new DifficultyRow + { + DifficultyName = "Approach Rate", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + stars = new DifficultyRow + { + DifficultyName = "Star Difficulty", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + }, }, - approachRate = new DifficultyRow + }, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new Box { - DifficultyName = "Accuracy", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, }, - overallDifficulty = new DifficultyRow + new FillFlowContainer { - DifficultyName = "Limit Break", - AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - }, - stars = new DifficultyRow - { - DifficultyName = "Star Difficulty", AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Padding = new MarginPadding(15) { Top = 25, Bottom = 0 }, + Children = new Drawable[] + { + new SpriteText + { + Text = "User Rating", + TextSize = 14, + Font = @"Exo2.0-Medium", + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + ratingsBar = new DetailsBar + { + RelativeSizeAxes = Axes.X, + Height = 5, + Length = 0, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new[] + { + negativeRatings = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + Text = "0", + }, + positiveRatings = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + Text = "0", + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + }, + }, + new SpriteText + { + Text = "Rating Spread", + TextSize = 14, + Font = @"Exo2.0-Medium", + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + }, + ratingsGraph = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Height = 50, + } + }, }, }, }, @@ -183,7 +304,13 @@ namespace osu.Game.Screens.Select description.Colour = colour.GrayB; source.Colour = colour.GrayB; tags.Colour = colour.YellowLight; + stars.BarColour = colour.YellowLight; + + ratingsBar.BackgroundColour = colour.Green; + ratingsBar.BarColour = colour.YellowDark; + + ratingsGraph.Colour = colour.BlueDark; } private class DifficultyRow : Container @@ -202,7 +329,7 @@ namespace osu.Game.Screens.Select set { difficultyValue = value; - bar.Value = value/maxValue; + bar.Length = value/maxValue; valueText.Text = value.ToString(); } } @@ -217,7 +344,7 @@ namespace osu.Game.Screens.Select set { maxValue = value; - bar.Value = Value/value; + bar.Length = Value/value; } } diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs index aabdf6809f..650d690a78 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -9,20 +9,24 @@ using osu.Framework.Graphics.Sprites; namespace osu.Game.Screens.Select { - class DetailsBar : Container + public class DetailsBar : Container { private Box background; private Box bar; - public float Value + private const int resizeDuration = 250; + + private float length; + public float Length { get { - return bar.Width; + return length; } set { - bar.ResizeTo(new Vector2(value, 1), 200); + length = value; + updateBarLength(); } } @@ -50,6 +54,20 @@ namespace osu.Game.Screens.Select } } + private BarDirection direction = BarDirection.LeftToRight; + public BarDirection Direction + { + get + { + return direction; + } + set + { + direction = value; + updateBarLength(); + } + } + public DetailsBar() { Children = new [] @@ -64,5 +82,42 @@ namespace osu.Game.Screens.Select } }; } + + private void updateBarLength() + { + switch (direction) + { + case BarDirection.LeftToRight: + case BarDirection.RightToLeft: + bar.ResizeTo(new Vector2(length, 1), resizeDuration); + break; + case BarDirection.TopToBottom: + case BarDirection.BottomToTop: + bar.ResizeTo(new Vector2(1, length), resizeDuration); + break; + } + + switch (direction) + { + case BarDirection.LeftToRight: + case BarDirection.TopToBottom: + bar.Anchor = Anchor.TopLeft; + bar.Origin = Anchor.TopLeft; + break; + case BarDirection.RightToLeft: + case BarDirection.BottomToTop: + bar.Anchor = Anchor.BottomRight; + bar.Origin = Anchor.BottomRight; + break; + } + } + } + + public enum BarDirection + { + LeftToRight, + RightToLeft, + TopToBottom, + BottomToTop, } } From 199c70ff95bed34a9140452ad42fe124ca6b58dd Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 28 Mar 2017 20:18:56 +0200 Subject: [PATCH 04/93] Added fails and retries --- .../Tests/TestCaseDetails.cs | 13 +- osu.Game/Screens/Select/Details.cs | 143 +++++++++++++++++- osu.Game/Screens/Select/DetailsBar.cs | 7 +- 3 files changed, 150 insertions(+), 13 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index d0d7602831..3f50f4aaed 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; using osu.Framework.Screens.Testing; using osu.Game.Database; using osu.Game.Screens.Select; @@ -20,9 +21,11 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - Add(new Details + Details details; + Add(details = new Details { RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(150), Beatmap = new BeatmapInfo { Version = "VisualTest", @@ -40,11 +43,11 @@ namespace osu.Desktop.VisualTests.Tests }, StarDifficulty = 5.3f, }, - Ratings = new[] - { - 1,2,3,4,5,6,7,8,9,10 - } }); + + details.Ratings = Enumerable.Range(1, 10); + details.Fails = Enumerable.Range(1, 100).Select(i => (int)(Math.Cos(i) * 100)); + details.Retries = Enumerable.Range(1, 100).Select(i => (int)(Math.Sin(i) * 100)); } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 54f3d5b519..e99d218445 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -13,6 +13,7 @@ using osu.Game.Database; using osu.Game.Graphics; using System.Collections.Generic; using System.Linq; +using System; namespace osu.Game.Screens.Select { @@ -33,6 +34,8 @@ namespace osu.Game.Screens.Select private SpriteText positiveRatings; private FillFlowContainer ratingsGraph; + private FillFlowContainer retryAndFailGraph; + private BeatmapInfo beatmap; public BeatmapInfo Beatmap { @@ -91,7 +94,53 @@ namespace osu.Game.Screens.Select }); } } - + + private List retries = Enumerable.Repeat(0,100).ToList(); + public IEnumerable Retries + { + get + { + return retries; + } + set + { + retries = value.ToList(); + calcRetryAndFailBarLength(); + } + } + + private List fails = Enumerable.Repeat(0,100).ToList(); + public IEnumerable Fails + { + get + { + return fails; + } + set + { + fails = value.ToList(); + calcRetryAndFailBarLength(); + } + } + + private void calcRetryAndFailBarLength() + { + List retryAndFailGraphBars = retryAndFailGraph.Children.ToList(); + for (int i = 0; i < 100; i++) + if (retryAndFailGraphBars.Count > i) + { + retryAndFailGraphBars[i].FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)); + retryAndFailGraphBars[i].RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)); + } + else + retryAndFailGraph.Add(new RetryAndFailBar + { + RelativeSizeAxes = Axes.Both, + Width = 0.01f, + FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)), + RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)), + }); + } public Details() { @@ -280,7 +329,7 @@ namespace osu.Game.Screens.Select Text = "Rating Spread", TextSize = 14, Font = @"Exo2.0-Medium", - Anchor = Anchor.BottomCentre, + Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, ratingsGraph = new FillFlowContainer @@ -288,13 +337,40 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, Direction = FillDirection.Horizontal, Height = 50, - } + }, }, }, }, }, }, }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + Padding = new MarginPadding { Left = 10, Right = 10 }, + Children = new Drawable[] + { + retryAndFailGraph = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Height = 50, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }, + new SpriteText + { + Text = "Points of Failure", + TextSize = 14, + Font = @"Exo2.0-Medium", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }, + }, + }, }; } @@ -305,11 +381,10 @@ namespace osu.Game.Screens.Select source.Colour = colour.GrayB; tags.Colour = colour.YellowLight; - stars.BarColour = colour.YellowLight; + stars.BarColour = colour.Yellow; ratingsBar.BackgroundColour = colour.Green; ratingsBar.BarColour = colour.YellowDark; - ratingsGraph.Colour = colour.BlueDark; } @@ -407,5 +482,63 @@ namespace osu.Game.Screens.Select valueText.Colour = colour.GrayB; } } + + private class RetryAndFailBar : Container + { + private DetailsBar retryBar; + private DetailsBar failBar; + + public float RetryLength + { + get + { + return retryBar.Length; + } + set + { + retryBar.Length = value + FailLength; + } + } + + public float FailLength + { + get + { + return failBar.Length; + } + set + { + failBar.Length = value; + } + } + + public RetryAndFailBar() + { + Children = new[] + { + retryBar = new DetailsBar + { + RelativeSizeAxes = Axes.Both, + Direction = BarDirection.BottomToTop, + Length = 0, + BackgroundColour = new Color4(0,0,0,0), + }, + failBar = new DetailsBar + { + RelativeSizeAxes = Axes.Both, + Direction = BarDirection.BottomToTop, + Length = 0, + BackgroundColour = new Color4(0,0,0,0), + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + retryBar.Colour = colour.Yellow; + failBar.Colour = colour.YellowDarker; + } + } } } diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs index 650d690a78..daefcc9a54 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using System; namespace osu.Game.Screens.Select { @@ -14,7 +15,7 @@ namespace osu.Game.Screens.Select private Box background; private Box bar; - private const int resizeDuration = 250; + private const int resize_duration = 250; private float length; public float Length @@ -89,11 +90,11 @@ namespace osu.Game.Screens.Select { case BarDirection.LeftToRight: case BarDirection.RightToLeft: - bar.ResizeTo(new Vector2(length, 1), resizeDuration); + bar.ResizeTo(new Vector2(length, 1), resize_duration); break; case BarDirection.TopToBottom: case BarDirection.BottomToTop: - bar.ResizeTo(new Vector2(1, length), resizeDuration); + bar.ResizeTo(new Vector2(1, length), resize_duration); break; } From 7bd13d76a82c22a2d0e493de6eac679959245e46 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 14:48:43 +0200 Subject: [PATCH 05/93] fixes + updates to DetailsBar and a button for the TestCaseDetails --- osu.Desktop.VisualTests/Tests/TestCaseDetails.cs | 13 ++++++++++++- osu.Game/Screens/Select/Details.cs | 2 +- osu.Game/Screens/Select/DetailsBar.cs | 10 ++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 3f50f4aaed..2d22009f21 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -16,12 +16,12 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseDetails : TestCase { + private Details details; public override void Reset() { base.Reset(); - Details details; Add(details = new Details { RelativeSizeAxes = Axes.Both, @@ -48,6 +48,17 @@ namespace osu.Desktop.VisualTests.Tests details.Ratings = Enumerable.Range(1, 10); details.Fails = Enumerable.Range(1, 100).Select(i => (int)(Math.Cos(i) * 100)); details.Retries = Enumerable.Range(1, 100).Select(i => (int)(Math.Sin(i) * 100)); + + AddButton("new retry/fail values", newRetryAndFailValues); + } + + private int lastRange = 1; + + private void newRetryAndFailValues() + { + lastRange += 100; + details.Fails = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Cos(i) * 100)); + details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index e99d218445..c50cae0f4f 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -50,7 +50,7 @@ namespace osu.Game.Screens.Select beatmap = value; description.Text = beatmap.Version; source.Text = beatmap.Metadata.Source; - tags.Children = beatmap.Metadata.Tags.Split(' ').Select(text => new SpriteText + tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new SpriteText { Text = text, TextSize = 14, diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs index daefcc9a54..b48b618fad 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using System; +using osu.Framework.Graphics.Transforms; namespace osu.Game.Screens.Select { @@ -17,6 +17,8 @@ namespace osu.Game.Screens.Select private const int resize_duration = 250; + private const EasingTypes easing = EasingTypes.InOutCubic; + private float length; public float Length { @@ -26,7 +28,7 @@ namespace osu.Game.Screens.Select } set { - length = value; + length = MathHelper.Clamp(value,0,1); updateBarLength(); } } @@ -90,11 +92,11 @@ namespace osu.Game.Screens.Select { case BarDirection.LeftToRight: case BarDirection.RightToLeft: - bar.ResizeTo(new Vector2(length, 1), resize_duration); + bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); break; case BarDirection.TopToBottom: case BarDirection.BottomToTop: - bar.ResizeTo(new Vector2(1, length), resize_duration); + bar.ResizeTo(new Vector2(1, length), resize_duration, easing); break; } From ab4d1c772574d301398a7c5721d1468147a08e36 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 15:33:36 +0200 Subject: [PATCH 06/93] better maxValue calculation for the retry and fail graph --- osu.Game/Screens/Select/Details.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index c50cae0f4f..9ea474020b 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -13,7 +13,6 @@ using osu.Game.Database; using osu.Game.Graphics; using System.Collections.Generic; using System.Linq; -using System; namespace osu.Game.Screens.Select { @@ -126,19 +125,20 @@ namespace osu.Game.Screens.Select private void calcRetryAndFailBarLength() { List retryAndFailGraphBars = retryAndFailGraph.Children.ToList(); + float maxValue = fails.Select((value, index) => value + retries[index]).Max(); for (int i = 0; i < 100; i++) if (retryAndFailGraphBars.Count > i) { - retryAndFailGraphBars[i].FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)); - retryAndFailGraphBars[i].RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)); + retryAndFailGraphBars[i].FailLength = fails[i] / maxValue; + retryAndFailGraphBars[i].RetryLength = retries[i] / maxValue; } else retryAndFailGraph.Add(new RetryAndFailBar { RelativeSizeAxes = Axes.Both, Width = 0.01f, - FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)), - RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)), + FailLength = fails[i] / maxValue, + RetryLength = retries[i] / maxValue, }); } From 2f15653d463cf565faf86391eccc4b65c54433b4 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 15:37:51 +0200 Subject: [PATCH 07/93] removed duplicate code --- osu.Desktop.VisualTests/Tests/TestCaseDetails.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 2d22009f21..0e281fdef5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -46,8 +46,7 @@ namespace osu.Desktop.VisualTests.Tests }); details.Ratings = Enumerable.Range(1, 10); - details.Fails = Enumerable.Range(1, 100).Select(i => (int)(Math.Cos(i) * 100)); - details.Retries = Enumerable.Range(1, 100).Select(i => (int)(Math.Sin(i) * 100)); + newRetryAndFailValues(); AddButton("new retry/fail values", newRetryAndFailValues); } @@ -56,9 +55,9 @@ namespace osu.Desktop.VisualTests.Tests private void newRetryAndFailValues() { - lastRange += 100; details.Fails = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Cos(i) * 100)); details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); + lastRange += 100; } } } From 866f72e653b4e4fbcf8e3a58b7087395bb70a9d8 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 15:51:54 +0200 Subject: [PATCH 08/93] fix something the merge broke --- osu.Desktop.VisualTests/Tests/TestCaseDetails.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 0e281fdef5..0335e80e3a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Screens.Select; using System; From cdb3150c560ab6d82badfacb8a8f6657f3ce8362 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 16:00:29 +0200 Subject: [PATCH 09/93] add readonlies and remove unused using directives --- .../Tests/TestCaseDetails.cs | 5 +-- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 - osu.Game/Screens/Select/Details.cs | 36 +++++++++---------- osu.Game/Screens/Select/DetailsBar.cs | 5 ++- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 0335e80e3a..3bfc0b147b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -7,14 +7,11 @@ using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Screens.Select; using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Desktop.VisualTests.Tests { - class TestCaseDetails : TestCase + internal class TestCaseDetails : TestCase { private Details details; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 337ad04e7d..355b2958e7 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 9ea474020b..1145e13338 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -18,22 +18,22 @@ namespace osu.Game.Screens.Select { public class Details : Container { - private SpriteText description; - private SpriteText source; - private FillFlowContainer tags; + private readonly SpriteText description; + private readonly SpriteText source; + private readonly FillFlowContainer tags; - private DifficultyRow circleSize; - private DifficultyRow drainRate; - private DifficultyRow overallDifficulty; - private DifficultyRow approachRate; - private DifficultyRow stars; + private readonly DifficultyRow circleSize; + private readonly DifficultyRow drainRate; + private readonly DifficultyRow overallDifficulty; + private readonly DifficultyRow approachRate; + private readonly DifficultyRow stars; - private DetailsBar ratingsBar; - private SpriteText negativeRatings; - private SpriteText positiveRatings; - private FillFlowContainer ratingsGraph; + private readonly DetailsBar ratingsBar; + private readonly SpriteText negativeRatings; + private readonly SpriteText positiveRatings; + private readonly FillFlowContainer ratingsGraph; - private FillFlowContainer retryAndFailGraph; + private readonly FillFlowContainer retryAndFailGraph; private BeatmapInfo beatmap; public BeatmapInfo Beatmap @@ -390,9 +390,9 @@ namespace osu.Game.Screens.Select private class DifficultyRow : Container { - private SpriteText name; - private DetailsBar bar; - private SpriteText valueText; + private readonly SpriteText name; + private readonly DetailsBar bar; + private readonly SpriteText valueText; private float difficultyValue; public float Value @@ -485,8 +485,8 @@ namespace osu.Game.Screens.Select private class RetryAndFailBar : Container { - private DetailsBar retryBar; - private DetailsBar failBar; + private readonly DetailsBar retryBar; + private readonly DetailsBar failBar; public float RetryLength { diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs index b48b618fad..a7193cb822 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -6,14 +6,13 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; namespace osu.Game.Screens.Select { public class DetailsBar : Container { - private Box background; - private Box bar; + private readonly Box background; + private readonly Box bar; private const int resize_duration = 250; From a3430dd072a0ba38f43c488bdbe60c655102158b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 16:10:07 +0200 Subject: [PATCH 10/93] add culture info --- osu.Game/Screens/Select/Details.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 1145e13338..38709057bb 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; using System.Collections.Generic; +using System.Globalization; using System.Linq; namespace osu.Game.Screens.Select @@ -405,7 +406,7 @@ namespace osu.Game.Screens.Select { difficultyValue = value; bar.Length = value/maxValue; - valueText.Text = value.ToString(); + valueText.Text = value.ToString(CultureInfo.InvariantCulture); } } From 0d4f2c59a536b40192679524b78142d7c03ac651 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 30 Mar 2017 17:32:18 +0200 Subject: [PATCH 11/93] there's probably something in here I overlooked --- ...seDetails.cs => TestCaseBeatmapDetails.cs} | 9 +- .../osu.Desktop.VisualTests.csproj | 4 +- osu.Game/Screens/Select/BeatmapDetailArea.cs | 5 +- .../{Details.cs => Details/BeatmapDetails.cs} | 112 +++++++----------- .../BeatmapDetailsBar.cs} | 6 +- .../Select/Details/BeatmapDetailsGraph.cs | 38 ++++++ osu.Game/osu.Game.csproj | 5 +- 7 files changed, 98 insertions(+), 81 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCaseDetails.cs => TestCaseBeatmapDetails.cs} (84%) rename osu.Game/Screens/Select/{Details.cs => Details/BeatmapDetails.cs} (82%) rename osu.Game/Screens/Select/{DetailsBar.cs => Details/BeatmapDetailsBar.cs} (92%) create mode 100644 osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs similarity index 84% rename from osu.Desktop.VisualTests/Tests/TestCaseDetails.cs rename to osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 3bfc0b147b..dfd40e7d15 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -6,20 +6,23 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Screens.Select; +using osu.Game.Screens.Select.Details; using System; using System.Linq; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseDetails : TestCase + internal class TestCaseBeatmapDetails : TestCase { - private Details details; + public override string Description => "BeatmapDetails tab of BeatmapDetailArea"; + + private BeatmapDetails details; public override void Reset() { base.Reset(); - Add(details = new Details + Add(details = new BeatmapDetails { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(150), diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index e74ac8b166..aff1b2437f 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -1,4 +1,4 @@ - + {69051C69-12AE-4E7D-A3E6-460D2E282312} @@ -187,7 +187,7 @@ - + diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 355b2958e7..d7a104b364 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Primitives; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Screens.Select.Details; using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select @@ -17,7 +18,7 @@ namespace osu.Game.Screens.Select private readonly Container content; protected override Container Content => content; - public readonly Details Details; + public readonly BeatmapDetails Details; public readonly Leaderboard Leaderboard; private BeatmapDetailTab currentTab; @@ -75,7 +76,7 @@ namespace osu.Game.Screens.Select Add(new Drawable[] { - Details = new Details + Details = new BeatmapDetails { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(5), diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details/BeatmapDetails.cs similarity index 82% rename from osu.Game/Screens/Select/Details.cs rename to osu.Game/Screens/Select/Details/BeatmapDetails.cs index 38709057bb..8802d213b8 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetails.cs @@ -15,9 +15,9 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; -namespace osu.Game.Screens.Select +namespace osu.Game.Screens.Select.Details { - public class Details : Container + public class BeatmapDetails : Container { private readonly SpriteText description; private readonly SpriteText source; @@ -29,12 +29,13 @@ namespace osu.Game.Screens.Select private readonly DifficultyRow approachRate; private readonly DifficultyRow stars; - private readonly DetailsBar ratingsBar; + private readonly BeatmapDetailsBar ratingsBar; private readonly SpriteText negativeRatings; private readonly SpriteText positiveRatings; - private readonly FillFlowContainer ratingsGraph; + private readonly BeatmapDetailsGraph ratingsGraph; - private readonly FillFlowContainer retryAndFailGraph; + private readonly BeatmapDetailsGraph retryGraph; + private readonly BeatmapDetailsGraph failGraph; private BeatmapInfo beatmap; public BeatmapInfo Beatmap @@ -79,19 +80,7 @@ namespace osu.Game.Screens.Select positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); - List ratingsGraphBars = ratingsGraph.Children.ToList(); - for (int i = 0; i < 10; i++) - if(ratingsGraphBars.Count > i) - ratingsGraphBars[i].Length = (float)ratings[i] / ratings.Max(); - else - ratingsGraph.Add(new DetailsBar - { - RelativeSizeAxes = Axes.Both, - Width = 0.1f, - Length = (float)ratings[i] / ratings.Max(), - Direction = BarDirection.BottomToTop, - BackgroundColour = new Color4(0, 0, 0, 0), - }); + ratingsGraph.Values = ratings.Select(rating => (float)rating / ratings.Max()); } } @@ -105,7 +94,7 @@ namespace osu.Game.Screens.Select set { retries = value.ToList(); - calcRetryAndFailBarLength(); + calcRetryAndFailGraph(); } } @@ -119,31 +108,18 @@ namespace osu.Game.Screens.Select set { fails = value.ToList(); - calcRetryAndFailBarLength(); + calcRetryAndFailGraph(); } } - private void calcRetryAndFailBarLength() + private void calcRetryAndFailGraph() { - List retryAndFailGraphBars = retryAndFailGraph.Children.ToList(); - float maxValue = fails.Select((value, index) => value + retries[index]).Max(); - for (int i = 0; i < 100; i++) - if (retryAndFailGraphBars.Count > i) - { - retryAndFailGraphBars[i].FailLength = fails[i] / maxValue; - retryAndFailGraphBars[i].RetryLength = retries[i] / maxValue; - } - else - retryAndFailGraph.Add(new RetryAndFailBar - { - RelativeSizeAxes = Axes.Both, - Width = 0.01f, - FailLength = fails[i] / maxValue, - RetryLength = retries[i] / maxValue, - }); + failGraph.Values = fails.Select(fail => (float)fail / fails.Max()); + List retryAndFails = retries.Select((retry, index) => (float)retry + fails[index]).ToList(); + retryGraph.Values = retryAndFails.Select(value => value / retryAndFails.Max()); } - public Details() + public BeatmapDetails() { Children = new Drawable[] { @@ -211,7 +187,7 @@ namespace osu.Game.Screens.Select Direction = FillDirection.Vertical, Spacing = new Vector2(0,15), Padding = new MarginPadding(10) { Top = 0 }, - Children = new [] + Children = new Drawable[] { new Container { @@ -297,7 +273,7 @@ namespace osu.Game.Screens.Select Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - ratingsBar = new DetailsBar + ratingsBar = new BeatmapDetailsBar { RelativeSizeAxes = Axes.X, Height = 5, @@ -333,7 +309,7 @@ namespace osu.Game.Screens.Select Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - ratingsGraph = new FillFlowContainer + ratingsGraph = new BeatmapDetailsGraph { RelativeSizeAxes = Axes.X, Direction = FillDirection.Horizontal, @@ -343,32 +319,27 @@ namespace osu.Game.Screens.Select }, }, }, - }, - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Direction = FillDirection.Vertical, - Padding = new MarginPadding { Left = 10, Right = 10 }, - Children = new Drawable[] - { - retryAndFailGraph = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Horizontal, - Height = 50, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - }, new SpriteText { Text = "Points of Failure", TextSize = 14, Font = @"Exo2.0-Medium", - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + }, + new Container + { + RelativeSizeAxes = Axes.X, + Size = new Vector2(1/0.6f, 50), + Children = new[] + { + retryGraph = new BeatmapDetailsGraph + { + RelativeSizeAxes = Axes.Both, + }, + failGraph = new BeatmapDetailsGraph + { + RelativeSizeAxes = Axes.Both, + }, + }, }, }, }, @@ -387,12 +358,15 @@ namespace osu.Game.Screens.Select ratingsBar.BackgroundColour = colour.Green; ratingsBar.BarColour = colour.YellowDark; ratingsGraph.Colour = colour.BlueDark; + + failGraph.Colour = colour.YellowDarker; + retryGraph.Colour = colour.Yellow; } private class DifficultyRow : Container { private readonly SpriteText name; - private readonly DetailsBar bar; + private readonly BeatmapDetailsBar bar; private readonly SpriteText valueText; private float difficultyValue; @@ -457,7 +431,7 @@ namespace osu.Game.Screens.Select TextSize = 14, Font = @"Exo2.0-Medium", }, - bar = new DetailsBar + bar = new BeatmapDetailsBar { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, @@ -484,10 +458,10 @@ namespace osu.Game.Screens.Select } } - private class RetryAndFailBar : Container + private class RetryAndFailBar : Container { - private readonly DetailsBar retryBar; - private readonly DetailsBar failBar; + private readonly BeatmapDetailsBar retryBar; + private readonly BeatmapDetailsBar failBar; public float RetryLength { @@ -517,14 +491,14 @@ namespace osu.Game.Screens.Select { Children = new[] { - retryBar = new DetailsBar + retryBar = new BeatmapDetailsBar { RelativeSizeAxes = Axes.Both, Direction = BarDirection.BottomToTop, Length = 0, BackgroundColour = new Color4(0,0,0,0), }, - failBar = new DetailsBar + failBar = new BeatmapDetailsBar { RelativeSizeAxes = Axes.Both, Direction = BarDirection.BottomToTop, diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs similarity index 92% rename from osu.Game/Screens/Select/DetailsBar.cs rename to osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs index a7193cb822..d637903754 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs @@ -7,9 +7,9 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -namespace osu.Game.Screens.Select +namespace osu.Game.Screens.Select.Details { - public class DetailsBar : Container + public class BeatmapDetailsBar : Container { private readonly Box background; private readonly Box bar; @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select } } - public DetailsBar() + public BeatmapDetailsBar() { Children = new [] { diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs new file mode 100644 index 0000000000..5f462c0559 --- /dev/null +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs @@ -0,0 +1,38 @@ +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using System.Collections.Generic; +using System.Linq; + +namespace osu.Game.Screens.Select.Details +{ + public class BeatmapDetailsGraph : FillFlowContainer + { + + public IEnumerable Values + { + set + { + List values = value.ToList(); + List graphBars = Children.ToList(); + for (int i = 0; i < values.Count; i++) + if (graphBars.Count > i) + { + graphBars[i].Length = values[i] / values.Max(); + graphBars[i].Width = 1.0f / values.Count; + } + else + Add(new BeatmapDetailsBar + { + RelativeSizeAxes = Axes.Both, + Width = 1.0f / values.Count, + Length = values[i] / values.Max(), + Direction = BarDirection.BottomToTop, + BackgroundColour = new Color4(0, 0, 0, 0), + }); + + } + } + + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 313db4e110..f5bb482d26 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -201,8 +201,9 @@ - - + + + From 50b85801413fe7f8c5338a629926cc29c05a735c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 31 Mar 2017 21:13:20 +0200 Subject: [PATCH 12/93] add license header --- osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs index 5f462c0559..6a90ff60d1 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs @@ -1,4 +1,7 @@ -using OpenTK.Graphics; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; @@ -35,4 +38,4 @@ namespace osu.Game.Screens.Select.Details } } -} \ No newline at end of file +} From d8bb72dd7811ecf1039ee8a377f30f8b995664c3 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 31 Mar 2017 21:19:23 +0200 Subject: [PATCH 13/93] remove unused using-directive --- osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs index 6a90ff60d1..67a44d4f9f 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs @@ -5,7 +5,6 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; -using System.Linq; namespace osu.Game.Screens.Select.Details { From 1f19d72474f43f18b374ffc0e6bc92c0f863aac4 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 31 Mar 2017 21:24:05 +0200 Subject: [PATCH 14/93] removed wrong using >.> --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 1 - osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index dfd40e7d15..f517e04b4b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Testing; using osu.Game.Database; -using osu.Game.Screens.Select; using osu.Game.Screens.Select.Details; using System; using System.Linq; diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs index 67a44d4f9f..6a90ff60d1 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs @@ -5,6 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Screens.Select.Details { From e380254386dde65c6428b2cb7f1c1bcc46abfe7c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 31 Mar 2017 22:32:09 +0200 Subject: [PATCH 15/93] remove unnecessary code --- osu.Game/Screens/Select/Details/BeatmapDetails.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/Details/BeatmapDetails.cs b/osu.Game/Screens/Select/Details/BeatmapDetails.cs index 8802d213b8..de9897396f 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetails.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Select.Details positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); - ratingsGraph.Values = ratings.Select(rating => (float)rating / ratings.Max()); + ratingsGraph.Values = ratings.Select(rating => (float)rating); } } @@ -114,9 +114,9 @@ namespace osu.Game.Screens.Select.Details private void calcRetryAndFailGraph() { - failGraph.Values = fails.Select(fail => (float)fail / fails.Max()); - List retryAndFails = retries.Select((retry, index) => (float)retry + fails[index]).ToList(); - retryGraph.Values = retryAndFails.Select(value => value / retryAndFails.Max()); + failGraph.Values = fails.Select(fail => (float)fail); + retryGraph.Values = retries.Select((retry, index) => (float)retry + fails[index]); + } public BeatmapDetails() From d0b4f867258074176a7ee6a920a7bb514490e521 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 1 Apr 2017 14:16:18 +0200 Subject: [PATCH 16/93] fix errors from merge --- .../Tests/TestCaseBeatmapDetails.cs | 11 +++++++---- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index f517e04b4b..3a57c1bc87 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -44,10 +44,8 @@ namespace osu.Desktop.VisualTests.Tests }, }); - details.Ratings = Enumerable.Range(1, 10); - newRetryAndFailValues(); - - AddButton("new retry/fail values", newRetryAndFailValues); + AddStep("new retry/fail values", newRetryAndFailValues); + AddStep("new ratings", newRatings); } private int lastRange = 1; @@ -58,5 +56,10 @@ namespace osu.Desktop.VisualTests.Tests details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); lastRange += 100; } + + private void newRatings() + { + details.Ratings = Enumerable.Range(1, 10); + } } } diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index d7a104b364..c5dc7057bb 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -124,7 +124,6 @@ namespace osu.Game.Screens.Select if (api == null || beatmap?.BeatmapInfo == null) return; Details.Beatmap = beatmap.Beatmap.BeatmapInfo; - } } } From 017281246db3a8fbb549b11da7b6495d824087e0 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 1 Apr 2017 18:12:44 +0200 Subject: [PATCH 17/93] changed SpriteText to OsuSpriteText --- .../Screens/Select/Details/BeatmapDetails.cs | 55 ++++++++----------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/osu.Game/Screens/Select/Details/BeatmapDetails.cs b/osu.Game/Screens/Select/Details/BeatmapDetails.cs index de9897396f..cf50853691 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetails.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -19,9 +20,9 @@ namespace osu.Game.Screens.Select.Details { public class BeatmapDetails : Container { - private readonly SpriteText description; - private readonly SpriteText source; - private readonly FillFlowContainer tags; + private readonly OsuSpriteText description; + private readonly OsuSpriteText source; + private readonly FillFlowContainer tags; private readonly DifficultyRow circleSize; private readonly DifficultyRow drainRate; @@ -30,8 +31,8 @@ namespace osu.Game.Screens.Select.Details private readonly DifficultyRow stars; private readonly BeatmapDetailsBar ratingsBar; - private readonly SpriteText negativeRatings; - private readonly SpriteText positiveRatings; + private readonly OsuSpriteText negativeRatings; + private readonly OsuSpriteText positiveRatings; private readonly BeatmapDetailsGraph ratingsGraph; private readonly BeatmapDetailsGraph retryGraph; @@ -51,10 +52,9 @@ namespace osu.Game.Screens.Select.Details beatmap = value; description.Text = beatmap.Version; source.Text = beatmap.Metadata.Source; - tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new SpriteText + tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new OsuSpriteText { Text = text, - TextSize = 14, Font = "Exo2.0-Medium", }); @@ -140,39 +140,34 @@ namespace osu.Game.Screens.Select.Details Padding = new MarginPadding(10) { Top = 25 }, Children = new Drawable[] { - new SpriteText + new OsuSpriteText { Text = "Description", - TextSize = 14, Font = @"Exo2.0-Bold", }, - description = new SpriteText + description = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", Direction = FillDirection.Full, }, - new SpriteText + new OsuSpriteText { Text = "Source", - TextSize = 14, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 20 }, }, - source = new SpriteText + source = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", Direction = FillDirection.Full, }, - new SpriteText + new OsuSpriteText { Text = "Tags", - TextSize = 14, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 20 }, }, - tags = new FillFlowContainer + tags = new FillFlowContainer { RelativeSizeAxes = Axes.X, Spacing = new Vector2(3,0), @@ -265,10 +260,9 @@ namespace osu.Game.Screens.Select.Details Padding = new MarginPadding(15) { Top = 25, Bottom = 0 }, Children = new Drawable[] { - new SpriteText + new OsuSpriteText { Text = "User Rating", - TextSize = 14, Font = @"Exo2.0-Medium", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -285,15 +279,13 @@ namespace osu.Game.Screens.Select.Details AutoSizeAxes = Axes.Y, Children = new[] { - negativeRatings = new SpriteText + negativeRatings = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", Text = "0", }, - positiveRatings = new SpriteText + positiveRatings = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", Text = "0", Anchor = Anchor.TopRight, @@ -301,7 +293,7 @@ namespace osu.Game.Screens.Select.Details }, }, }, - new SpriteText + new OsuSpriteText { Text = "Rating Spread", TextSize = 14, @@ -319,10 +311,9 @@ namespace osu.Game.Screens.Select.Details }, }, }, - new SpriteText + new OsuSpriteText { Text = "Points of Failure", - TextSize = 14, Font = @"Exo2.0-Medium", }, new Container @@ -365,9 +356,9 @@ namespace osu.Game.Screens.Select.Details private class DifficultyRow : Container { - private readonly SpriteText name; + private readonly OsuSpriteText name; private readonly BeatmapDetailsBar bar; - private readonly SpriteText valueText; + private readonly OsuSpriteText valueText; private float difficultyValue; public float Value @@ -426,9 +417,8 @@ namespace osu.Game.Screens.Select.Details { Children = new Drawable[] { - name = new SpriteText + name = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", }, bar = new BeatmapDetailsBar @@ -439,11 +429,10 @@ namespace osu.Game.Screens.Select.Details Size = new Vector2(1, 0.35f), Padding = new MarginPadding { Left = 100, Right = 25 }, }, - valueText = new SpriteText + valueText = new OsuSpriteText { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - TextSize = 14, Font = @"Exo2.0-Medium", }, }; From 5a694e0c9d20909d9265c57c6f1d8de307bf445a Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 3 Apr 2017 19:28:05 +0200 Subject: [PATCH 18/93] changed location of BarGraph to be more generic --- .../Tests/TestCaseBeatmapDetails.cs | 2 +- .../UserInterface/BarGraph.cs} | 45 ++++++++++++++++--- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 - .../Select/{Details => }/BeatmapDetails.cs | 35 ++++++++------- .../Select/Details/BeatmapDetailsGraph.cs | 41 ----------------- osu.Game/osu.Game.csproj | 9 ++-- 6 files changed, 63 insertions(+), 70 deletions(-) rename osu.Game/{Screens/Select/Details/BeatmapDetailsBar.cs => Graphics/UserInterface/BarGraph.cs} (66%) rename osu.Game/Screens/Select/{Details => }/BeatmapDetails.cs (92%) delete mode 100644 osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 3a57c1bc87..1f7662306f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -5,7 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Testing; using osu.Game.Database; -using osu.Game.Screens.Select.Details; +using osu.Game.Screens.Select; using System; using System.Linq; diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs similarity index 66% rename from osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs rename to osu.Game/Graphics/UserInterface/BarGraph.cs index d637903754..80412c41e5 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -1,15 +1,48 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using System.Collections.Generic; +using System.Linq; -namespace osu.Game.Screens.Select.Details +namespace osu.Game.Graphics.UserInterface { - public class BeatmapDetailsBar : Container + public class BarGraph : FillFlowContainer + { + + public IEnumerable Values + { + set + { + List values = value.ToList(); + List graphBars = Children.ToList(); + for (int i = 0; i < values.Count; i++) + if (graphBars.Count > i) + { + graphBars[i].Length = values[i] / values.Max(); + graphBars[i].Width = 1.0f / values.Count; + } + else + Add(new Bar + { + RelativeSizeAxes = Axes.Both, + Width = 1.0f / values.Count, + Length = values[i] / values.Max(), + Direction = BarDirection.BottomToTop, + BackgroundColour = new Color4(0, 0, 0, 0), + }); + + } + } + + } + + public class Bar : Container { private readonly Box background; private readonly Box bar; @@ -27,7 +60,7 @@ namespace osu.Game.Screens.Select.Details } set { - length = MathHelper.Clamp(value,0,1); + length = MathHelper.Clamp(value, 0, 1); updateBarLength(); } } @@ -70,9 +103,9 @@ namespace osu.Game.Screens.Select.Details } } - public BeatmapDetailsBar() + public Bar() { - Children = new [] + Children = new[] { background = new Box { diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index c5dc7057bb..8387e39f67 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Primitives; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests; -using osu.Game.Screens.Select.Details; using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select diff --git a/osu.Game/Screens/Select/Details/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs similarity index 92% rename from osu.Game/Screens/Select/Details/BeatmapDetails.cs rename to osu.Game/Screens/Select/BeatmapDetails.cs index cf50853691..6bc7fe5ca0 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -12,11 +12,12 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using System.Collections.Generic; using System.Globalization; using System.Linq; -namespace osu.Game.Screens.Select.Details +namespace osu.Game.Screens.Select { public class BeatmapDetails : Container { @@ -30,13 +31,13 @@ namespace osu.Game.Screens.Select.Details private readonly DifficultyRow approachRate; private readonly DifficultyRow stars; - private readonly BeatmapDetailsBar ratingsBar; + private readonly Bar ratingsBar; private readonly OsuSpriteText negativeRatings; private readonly OsuSpriteText positiveRatings; - private readonly BeatmapDetailsGraph ratingsGraph; + private readonly BarGraph ratingsGraph; - private readonly BeatmapDetailsGraph retryGraph; - private readonly BeatmapDetailsGraph failGraph; + private readonly BarGraph retryGraph; + private readonly BarGraph failGraph; private BeatmapInfo beatmap; public BeatmapInfo Beatmap @@ -267,7 +268,7 @@ namespace osu.Game.Screens.Select.Details Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - ratingsBar = new BeatmapDetailsBar + ratingsBar = new Bar { RelativeSizeAxes = Axes.X, Height = 5, @@ -301,7 +302,7 @@ namespace osu.Game.Screens.Select.Details Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - ratingsGraph = new BeatmapDetailsGraph + ratingsGraph = new BarGraph { RelativeSizeAxes = Axes.X, Direction = FillDirection.Horizontal, @@ -316,17 +317,17 @@ namespace osu.Game.Screens.Select.Details Text = "Points of Failure", Font = @"Exo2.0-Medium", }, - new Container + new Container { RelativeSizeAxes = Axes.X, Size = new Vector2(1/0.6f, 50), Children = new[] { - retryGraph = new BeatmapDetailsGraph + retryGraph = new BarGraph { RelativeSizeAxes = Axes.Both, }, - failGraph = new BeatmapDetailsGraph + failGraph = new BarGraph { RelativeSizeAxes = Axes.Both, }, @@ -357,7 +358,7 @@ namespace osu.Game.Screens.Select.Details private class DifficultyRow : Container { private readonly OsuSpriteText name; - private readonly BeatmapDetailsBar bar; + private readonly Bar bar; private readonly OsuSpriteText valueText; private float difficultyValue; @@ -421,7 +422,7 @@ namespace osu.Game.Screens.Select.Details { Font = @"Exo2.0-Medium", }, - bar = new BeatmapDetailsBar + bar = new Bar { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, @@ -447,10 +448,10 @@ namespace osu.Game.Screens.Select.Details } } - private class RetryAndFailBar : Container + private class RetryAndFailBar : Container { - private readonly BeatmapDetailsBar retryBar; - private readonly BeatmapDetailsBar failBar; + private readonly Bar retryBar; + private readonly Bar failBar; public float RetryLength { @@ -480,14 +481,14 @@ namespace osu.Game.Screens.Select.Details { Children = new[] { - retryBar = new BeatmapDetailsBar + retryBar = new Bar { RelativeSizeAxes = Axes.Both, Direction = BarDirection.BottomToTop, Length = 0, BackgroundColour = new Color4(0,0,0,0), }, - failBar = new BeatmapDetailsBar + failBar = new Bar { RelativeSizeAxes = Axes.Both, Direction = BarDirection.BottomToTop, diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs deleted file mode 100644 index 6a90ff60d1..0000000000 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK.Graphics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using System.Collections.Generic; -using System.Linq; - -namespace osu.Game.Screens.Select.Details -{ - public class BeatmapDetailsGraph : FillFlowContainer - { - - public IEnumerable Values - { - set - { - List values = value.ToList(); - List graphBars = Children.ToList(); - for (int i = 0; i < values.Count; i++) - if (graphBars.Count > i) - { - graphBars[i].Length = values[i] / values.Max(); - graphBars[i].Width = 1.0f / values.Count; - } - else - Add(new BeatmapDetailsBar - { - RelativeSizeAxes = Axes.Both, - Width = 1.0f / values.Count, - Length = values[i] / values.Max(), - Direction = BarDirection.BottomToTop, - BackgroundColour = new Color4(0, 0, 0, 0), - }); - - } - } - - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 360f8c9772..2e1ded6136 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -206,9 +206,8 @@ - - - + + @@ -391,7 +390,9 @@ - + + + From 8e689a06d8f113c743248387dc4491bb3c538ad4 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 3 Apr 2017 23:03:49 +0200 Subject: [PATCH 19/93] change font --- osu.Game/Screens/Select/BeatmapDetails.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 6bc7fe5ca0..2e9d78cced 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Select tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new OsuSpriteText { Text = text, - Font = "Exo2.0-Medium", + Font = "Exo2.0-Regular", }); circleSize.Value = beatmap.Difficulty.CircleSize; @@ -148,7 +148,7 @@ namespace osu.Game.Screens.Select }, description = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Direction = FillDirection.Full, }, new OsuSpriteText @@ -159,7 +159,7 @@ namespace osu.Game.Screens.Select }, source = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Direction = FillDirection.Full, }, new OsuSpriteText @@ -282,12 +282,12 @@ namespace osu.Game.Screens.Select { negativeRatings = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Text = "0", }, positiveRatings = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Text = "0", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -298,7 +298,7 @@ namespace osu.Game.Screens.Select { Text = "Rating Spread", TextSize = 14, - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, @@ -315,7 +315,7 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Text = "Points of Failure", - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", }, new Container { @@ -420,7 +420,7 @@ namespace osu.Game.Screens.Select { name = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", }, bar = new Bar { @@ -434,7 +434,7 @@ namespace osu.Game.Screens.Select { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", }, }; } From 58f8dc82541775e28cf58a176ebd0b389837f225 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 17:17:22 +0200 Subject: [PATCH 20/93] add direction to graphs --- osu.Game/Graphics/UserInterface/BarGraph.cs | 19 +++++++++++++++++-- osu.Game/Screens/Select/BeatmapDetails.cs | 1 - 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 80412c41e5..5ad14a92f5 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -14,6 +14,22 @@ namespace osu.Game.Graphics.UserInterface { public class BarGraph : FillFlowContainer { + private BarDirection direction = BarDirection.BottomToTop; + public new BarDirection Direction + { + get + { + return direction; + } + set + { + direction = value; + foreach (var bar in Children) + bar.Direction = direction; + base.Direction = direction == BarDirection.LeftToRight || direction == BarDirection.RightToLeft ? FillDirection.Vertical : FillDirection.Horizontal; + } + } + public IEnumerable Values { @@ -33,13 +49,12 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.Both, Width = 1.0f / values.Count, Length = values[i] / values.Max(), - Direction = BarDirection.BottomToTop, + Direction = Direction, BackgroundColour = new Color4(0, 0, 0, 0), }); } } - } public class Bar : Container diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 2e9d78cced..5adced7c95 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -305,7 +305,6 @@ namespace osu.Game.Screens.Select ratingsGraph = new BarGraph { RelativeSizeAxes = Axes.X, - Direction = FillDirection.Horizontal, Height = 50, }, }, From 078d44aec31edce4bf7dd6fdc92d278c3f67f356 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 17:17:37 +0200 Subject: [PATCH 21/93] some changes to the testcase --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 1f7662306f..72b27bb8b2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -44,7 +44,7 @@ namespace osu.Desktop.VisualTests.Tests }, }); - AddStep("new retry/fail values", newRetryAndFailValues); + AddRepeatStep("new retry/fail values", newRetryAndFailValues, 10); AddStep("new ratings", newRatings); } @@ -57,9 +57,7 @@ namespace osu.Desktop.VisualTests.Tests lastRange += 100; } - private void newRatings() - { - details.Ratings = Enumerable.Range(1, 10); - } + private void newRatings() => details.Ratings = Enumerable.Range(1, 10); + } } From b2731bb0a130b26beaa0567a46e14e680a13b076 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 17:27:08 +0200 Subject: [PATCH 22/93] some formatting --- .../Tests/TestCaseBeatmapDetails.cs | 3 +-- .../Tests/TestCaseGraphAndBar.cs | 11 +++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Graphics/UserInterface/BarGraph.cs | 6 +++--- osu.Game/Screens/Select/BeatmapDetailArea.cs | 13 +++++++------ osu.Game/Screens/Select/BeatmapDetails.cs | 19 ++++++++++++------- 6 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 72b27bb8b2..9af7329600 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -58,6 +58,5 @@ namespace osu.Desktop.VisualTests.Tests } private void newRatings() => details.Ratings = Enumerable.Range(1, 10); - } -} +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs new file mode 100644 index 0000000000..f43b6a557d --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseGraphAndBar : TestCase + { + } +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 38c574f61f..ce60d25ad3 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -190,6 +190,7 @@ + diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 5ad14a92f5..ce8a5f18b8 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -30,7 +30,6 @@ namespace osu.Game.Graphics.UserInterface } } - public IEnumerable Values { set @@ -52,7 +51,6 @@ namespace osu.Game.Graphics.UserInterface Direction = Direction, BackgroundColour = new Color4(0, 0, 0, 0), }); - } } } @@ -141,6 +139,7 @@ namespace osu.Game.Graphics.UserInterface case BarDirection.RightToLeft: bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); break; + case BarDirection.TopToBottom: case BarDirection.BottomToTop: bar.ResizeTo(new Vector2(1, length), resize_duration, easing); @@ -154,6 +153,7 @@ namespace osu.Game.Graphics.UserInterface bar.Anchor = Anchor.TopLeft; bar.Origin = Anchor.TopLeft; break; + case BarDirection.RightToLeft: case BarDirection.BottomToTop: bar.Anchor = Anchor.BottomRight; @@ -170,4 +170,4 @@ namespace osu.Game.Graphics.UserInterface TopToBottom, BottomToTop, } -} +} \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 8387e39f67..cb697c31d0 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -24,6 +24,7 @@ namespace osu.Game.Screens.Select private APIAccess api; private WorkingBeatmap beatmap; + public WorkingBeatmap Beatmap { get @@ -34,7 +35,7 @@ namespace osu.Game.Screens.Select { beatmap = value; if (IsLoaded) - if(currentTab == BeatmapDetailTab.Details) + if (currentTab == BeatmapDetailTab.Details) Schedule(updateDetails); else Schedule(updateScores); @@ -48,7 +49,7 @@ namespace osu.Game.Screens.Select new BeatmapDetailAreaTabControl { RelativeSizeAxes = Axes.X, - OnFilter = (tab, mods) => + OnFilter = (tab, mods) => { switch (tab) { @@ -57,6 +58,7 @@ namespace osu.Game.Screens.Select Leaderboard.Hide(); updateDetails(); break; + default: Details.Hide(); Leaderboard.Show(); @@ -100,6 +102,7 @@ namespace osu.Game.Screens.Select } private GetScoresRequest getScoresRequest; + private void updateScores() { if (!IsLoaded) return; @@ -114,15 +117,13 @@ namespace osu.Game.Screens.Select api.Queue(getScoresRequest); } - - private void updateDetails() { if (!IsLoaded) return; if (api == null || beatmap?.BeatmapInfo == null) return; - + Details.Beatmap = beatmap.Beatmap.BeatmapInfo; } } -} +} \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 5adced7c95..433374509b 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -40,6 +40,7 @@ namespace osu.Game.Screens.Select private readonly BarGraph failGraph; private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { get @@ -63,11 +64,12 @@ namespace osu.Game.Screens.Select drainRate.Value = beatmap.Difficulty.DrainRate; overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; approachRate.Value = beatmap.Difficulty.ApproachRate; - stars.Value = (float) beatmap.StarDifficulty; + stars.Value = (float)beatmap.StarDifficulty; } } private List ratings; + public IEnumerable Ratings { get @@ -85,7 +87,8 @@ namespace osu.Game.Screens.Select } } - private List retries = Enumerable.Repeat(0,100).ToList(); + private List retries = Enumerable.Repeat(0, 100).ToList(); + public IEnumerable Retries { get @@ -99,7 +102,8 @@ namespace osu.Game.Screens.Select } } - private List fails = Enumerable.Repeat(0,100).ToList(); + private List fails = Enumerable.Repeat(0, 100).ToList(); + public IEnumerable Fails { get @@ -117,7 +121,6 @@ namespace osu.Game.Screens.Select { failGraph.Values = fails.Select(fail => (float)fail); retryGraph.Values = retries.Select((retry, index) => (float)retry + fails[index]); - } public BeatmapDetails() @@ -361,6 +364,7 @@ namespace osu.Game.Screens.Select private readonly OsuSpriteText valueText; private float difficultyValue; + public float Value { get @@ -370,12 +374,13 @@ namespace osu.Game.Screens.Select set { difficultyValue = value; - bar.Length = value/maxValue; + bar.Length = value / maxValue; valueText.Text = value.ToString(CultureInfo.InvariantCulture); } } private float maxValue = 10; + public float MaxValue { get @@ -385,7 +390,7 @@ namespace osu.Game.Screens.Select set { maxValue = value; - bar.Length = Value/value; + bar.Length = Value / value; } } @@ -505,4 +510,4 @@ namespace osu.Game.Screens.Select } } } -} +} \ No newline at end of file From 502afc0a4890e67c43f9c13c9780a8cc7714f297 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 18:09:16 +0200 Subject: [PATCH 23/93] some fixes to BarGraph so Direction works properly --- osu.Game/Graphics/UserInterface/BarGraph.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index ce8a5f18b8..2daa19bb4e 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -24,9 +24,12 @@ namespace osu.Game.Graphics.UserInterface set { direction = value; + base.Direction = (direction & BarDirection.Horizontal) > 0 ? FillDirection.Vertical : FillDirection.Horizontal; foreach (var bar in Children) + { + bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count()) : new Vector2(1.0f / Children.Count(), 1); bar.Direction = direction; - base.Direction = direction == BarDirection.LeftToRight || direction == BarDirection.RightToLeft ? FillDirection.Vertical : FillDirection.Horizontal; + } } } @@ -40,13 +43,13 @@ namespace osu.Game.Graphics.UserInterface if (graphBars.Count > i) { graphBars[i].Length = values[i] / values.Max(); - graphBars[i].Width = 1.0f / values.Count; + graphBars[i].Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1); } else Add(new Bar { RelativeSizeAxes = Axes.Both, - Width = 1.0f / values.Count, + Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1), Length = values[i] / values.Max(), Direction = Direction, BackgroundColour = new Color4(0, 0, 0, 0), @@ -165,9 +168,12 @@ namespace osu.Game.Graphics.UserInterface public enum BarDirection { - LeftToRight, - RightToLeft, - TopToBottom, - BottomToTop, + LeftToRight = 1 << 0, + RightToLeft = 1 << 1, + TopToBottom = 1 << 2, + BottomToTop = 1 << 3, + + Vertical = TopToBottom | BottomToTop, + Horizontal = LeftToRight | RightToLeft, } } \ No newline at end of file From cd2fc3148e1f323d78a5540b680162f362bf964c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 18:10:57 +0200 Subject: [PATCH 24/93] added TestCaseGraphAndBar --- .../Tests/TestCaseGraphAndBar.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs index f43b6a557d..571a5031c8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs @@ -1,11 +1,42 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; +using osu.Framework.Graphics; using osu.Framework.Testing; +using osu.Game.Graphics.UserInterface; +using System.Collections.Generic; +using System.Linq; namespace osu.Desktop.VisualTests.Tests { internal class TestCaseGraphAndBar : TestCase { + public override string Description => "graphs and bars, bars and graphs"; + + private BarGraph graph; + + public override void Reset() + { + base.Reset(); + + Children = new[] + { + graph = new BarGraph + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(0.5f), + }, + }; + + AddStep("values from 1-10", () => graph.Values = Enumerable.Range(1,10).Select(i => (float)i)); + AddStep("reversed values from 1-10", () => graph.Values = Enumerable.Range(1, 10).Reverse().Select(i => (float)i)); + AddStep("Bottom to top", () => graph.Direction = BarDirection.BottomToTop); + AddStep("Top to bottom", () => graph.Direction = BarDirection.TopToBottom); + AddStep("Left to right", () => graph.Direction = BarDirection.LeftToRight); + AddStep("Right to left", () => graph.Direction = BarDirection.RightToLeft); + } } } \ No newline at end of file From f9bf1c69bf73b34f88154bcce074f9f2a59de56d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 18:23:29 +0200 Subject: [PATCH 25/93] add Flags to BarDirection and remove unused "using" --- osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs | 1 - osu.Game/Graphics/UserInterface/BarGraph.cs | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs index 571a5031c8..5ae64b5e73 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs @@ -5,7 +5,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; -using System.Collections.Generic; using System.Linq; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 2daa19bb4e..8f02f14ea8 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using System; using System.Collections.Generic; using System.Linq; @@ -166,6 +167,7 @@ namespace osu.Game.Graphics.UserInterface } } + [Flags] public enum BarDirection { LeftToRight = 1 << 0, From 28193cbaaa8d50b24c0d2761b7049ac3ae6b278c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 6 Apr 2017 15:39:23 +0200 Subject: [PATCH 26/93] hide BeatmapDetails on entering the Select screen --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index cb697c31d0..3fd349da7f 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -81,6 +81,7 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(5), + Alpha = 0, }, Leaderboard = new Leaderboard { From eb4b3772e98218cf64ee041f5393908cd805941d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 18:13:55 +0200 Subject: [PATCH 27/93] put Bar into its own file and let it only add a background if BackgroundColour is changed --- osu.Game/Graphics/UserInterface/Bar.cs | 134 +++++++++++++++++++ osu.Game/Graphics/UserInterface/BarGraph.cs | 124 ----------------- osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 +- osu.Game/osu.Game.csproj | 1 + 4 files changed, 136 insertions(+), 125 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/Bar.cs diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs new file mode 100644 index 0000000000..7c2123a309 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -0,0 +1,134 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using System; + +namespace osu.Game.Graphics.UserInterface +{ + public class Bar : Container + { + private Box background; + private readonly Box bar; + + private const int resize_duration = 250; + + private const EasingTypes easing = EasingTypes.InOutCubic; + + private float length; + public float Length + { + get + { + return length; + } + set + { + length = MathHelper.Clamp(value, 0, 1); + updateBarLength(); + } + } + + public SRGBColour BackgroundColour + { + get + { + return background?.Colour ?? default(SRGBColour); + } + set + { + if (background == null) + Add(background = new Box + { + RelativeSizeAxes = Axes.Both, + Depth = 1, + }); + background.Colour = value; + } + } + + public SRGBColour BarColour + { + get + { + return bar.Colour; + } + set + { + bar.Colour = value; + } + } + + private BarDirection direction = BarDirection.LeftToRight; + public BarDirection Direction + { + get + { + return direction; + } + set + { + direction = value; + updateBarLength(); + } + } + + public Bar() + { + Children = new[] + { + bar = new Box + { + RelativeSizeAxes = Axes.Both, + } + }; + } + + private void updateBarLength() + { + switch (direction) + { + case BarDirection.LeftToRight: + case BarDirection.RightToLeft: + bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); + break; + + case BarDirection.TopToBottom: + case BarDirection.BottomToTop: + bar.ResizeTo(new Vector2(1, length), resize_duration, easing); + break; + } + + switch (direction) + { + case BarDirection.LeftToRight: + case BarDirection.TopToBottom: + bar.Anchor = Anchor.TopLeft; + bar.Origin = Anchor.TopLeft; + break; + + case BarDirection.RightToLeft: + case BarDirection.BottomToTop: + bar.Anchor = Anchor.BottomRight; + bar.Origin = Anchor.BottomRight; + break; + } + } + } + + [Flags] + public enum BarDirection + { + LeftToRight = 1 << 0, + RightToLeft = 1 << 1, + TopToBottom = 1 << 2, + BottomToTop = 1 << 3, + + Vertical = TopToBottom | BottomToTop, + Horizontal = LeftToRight | RightToLeft, + } +} \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 8f02f14ea8..2b1ea7aacd 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -4,10 +4,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using System; using System.Collections.Generic; using System.Linq; @@ -53,129 +50,8 @@ namespace osu.Game.Graphics.UserInterface Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1), Length = values[i] / values.Max(), Direction = Direction, - BackgroundColour = new Color4(0, 0, 0, 0), }); } } } - - public class Bar : Container - { - private readonly Box background; - private readonly Box bar; - - private const int resize_duration = 250; - - private const EasingTypes easing = EasingTypes.InOutCubic; - - private float length; - public float Length - { - get - { - return length; - } - set - { - length = MathHelper.Clamp(value, 0, 1); - updateBarLength(); - } - } - - public SRGBColour BackgroundColour - { - get - { - return background.Colour; - } - set - { - background.Colour = value; - } - } - - public SRGBColour BarColour - { - get - { - return bar.Colour; - } - set - { - bar.Colour = value; - } - } - - private BarDirection direction = BarDirection.LeftToRight; - public BarDirection Direction - { - get - { - return direction; - } - set - { - direction = value; - updateBarLength(); - } - } - - public Bar() - { - Children = new[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - }, - bar = new Box - { - RelativeSizeAxes = Axes.Both, - } - }; - } - - private void updateBarLength() - { - switch (direction) - { - case BarDirection.LeftToRight: - case BarDirection.RightToLeft: - bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); - break; - - case BarDirection.TopToBottom: - case BarDirection.BottomToTop: - bar.ResizeTo(new Vector2(1, length), resize_duration, easing); - break; - } - - switch (direction) - { - case BarDirection.LeftToRight: - case BarDirection.TopToBottom: - bar.Anchor = Anchor.TopLeft; - bar.Origin = Anchor.TopLeft; - break; - - case BarDirection.RightToLeft: - case BarDirection.BottomToTop: - bar.Anchor = Anchor.BottomRight; - bar.Origin = Anchor.BottomRight; - break; - } - } - } - - [Flags] - public enum BarDirection - { - LeftToRight = 1 << 0, - RightToLeft = 1 << 1, - TopToBottom = 1 << 2, - BottomToTop = 1 << 3, - - Vertical = TopToBottom | BottomToTop, - Horizontal = LeftToRight | RightToLeft, - } } \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 3fd349da7f..480814d013 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -56,7 +56,6 @@ namespace osu.Game.Screens.Select case BeatmapDetailTab.Details: Details.Show(); Leaderboard.Hide(); - updateDetails(); break; default: @@ -66,6 +65,7 @@ namespace osu.Game.Screens.Select break; } currentTab = tab; + updateDetails(); }, }, content = new Container diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c669af1da6..3e7f7e4abe 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -87,6 +87,7 @@ + From 9881889f88c75cd2eed150fbd8a9ab9b4cc9ef01 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 18:24:36 +0200 Subject: [PATCH 28/93] removed some unused stuff --- osu.Game/Graphics/UserInterface/BarGraph.cs | 1 - osu.Game/Screens/Select/BeatmapDetailArea.cs | 8 +-- osu.Game/Screens/Select/BeatmapDetails.cs | 58 -------------------- 3 files changed, 2 insertions(+), 65 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 2b1ea7aacd..e3f087b95c 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 480814d013..169530a0c2 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -24,7 +24,6 @@ namespace osu.Game.Screens.Select private APIAccess api; private WorkingBeatmap beatmap; - public WorkingBeatmap Beatmap { get @@ -34,11 +33,8 @@ namespace osu.Game.Screens.Select set { beatmap = value; - if (IsLoaded) - if (currentTab == BeatmapDetailTab.Details) - Schedule(updateDetails); - else - Schedule(updateScores); + Schedule(updateDetails); + Schedule(updateScores); } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 433374509b..56dda7fd89 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -451,63 +451,5 @@ namespace osu.Game.Screens.Select valueText.Colour = colour.GrayB; } } - - private class RetryAndFailBar : Container - { - private readonly Bar retryBar; - private readonly Bar failBar; - - public float RetryLength - { - get - { - return retryBar.Length; - } - set - { - retryBar.Length = value + FailLength; - } - } - - public float FailLength - { - get - { - return failBar.Length; - } - set - { - failBar.Length = value; - } - } - - public RetryAndFailBar() - { - Children = new[] - { - retryBar = new Bar - { - RelativeSizeAxes = Axes.Both, - Direction = BarDirection.BottomToTop, - Length = 0, - BackgroundColour = new Color4(0,0,0,0), - }, - failBar = new Bar - { - RelativeSizeAxes = Axes.Both, - Direction = BarDirection.BottomToTop, - Length = 0, - BackgroundColour = new Color4(0,0,0,0), - }, - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colour) - { - retryBar.Colour = colour.Yellow; - failBar.Colour = colour.YellowDarker; - } - } } } \ No newline at end of file From 65d9f4fc4589628e601ba3a523cbd2073916678e Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 19:27:14 +0200 Subject: [PATCH 29/93] hide MetadataSegments without content and remove fail/retry initialisations --- osu.Game/Screens/Select/BeatmapDetails.cs | 141 ++++++++++++++-------- 1 file changed, 92 insertions(+), 49 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 56dda7fd89..5acc5ccb56 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -21,9 +21,9 @@ namespace osu.Game.Screens.Select { public class BeatmapDetails : Container { - private readonly OsuSpriteText description; - private readonly OsuSpriteText source; - private readonly FillFlowContainer tags; + private readonly MetadataSegment description; + private readonly MetadataSegment source; + private readonly MetadataSegment tags; private readonly DifficultyRow circleSize; private readonly DifficultyRow drainRate; @@ -52,13 +52,10 @@ namespace osu.Game.Screens.Select { if (beatmap == value) return; beatmap = value; - description.Text = beatmap.Version; - source.Text = beatmap.Metadata.Source; - tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new OsuSpriteText - { - Text = text, - Font = "Exo2.0-Regular", - }); + + description.ContentText = beatmap.Version; + source.ContentText = beatmap.Metadata.Source; + tags.ContentText = beatmap.Metadata.Tags; circleSize.Value = beatmap.Difficulty.CircleSize; drainRate.Value = beatmap.Difficulty.DrainRate; @@ -87,8 +84,7 @@ namespace osu.Game.Screens.Select } } - private List retries = Enumerable.Repeat(0, 100).ToList(); - + private List retries; public IEnumerable Retries { get @@ -102,8 +98,7 @@ namespace osu.Game.Screens.Select } } - private List fails = Enumerable.Repeat(0, 100).ToList(); - + private List fails; public IEnumerable Fails { get @@ -120,7 +115,7 @@ namespace osu.Game.Screens.Select private void calcRetryAndFailGraph() { failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries.Select((retry, index) => (float)retry + fails[index]); + retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails?[index] ?? 0) ?? new List(); } public BeatmapDetails() @@ -133,7 +128,7 @@ namespace osu.Game.Screens.Select Colour = Color4.Black, Alpha = 0.5f, }, - new FillFlowContainer() + new FillFlowContainer() { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -141,41 +136,29 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.4f, Direction = FillDirection.Vertical, + LayoutDuration = 1, + LayoutEasing = EasingTypes.OutQuint, Padding = new MarginPadding(10) { Top = 25 }, - Children = new Drawable[] + Children = new [] { - new OsuSpriteText - { - Text = "Description", - Font = @"Exo2.0-Bold", - }, - description = new OsuSpriteText - { - Font = @"Exo2.0-Regular", - Direction = FillDirection.Full, - }, - new OsuSpriteText - { - Text = "Source", - Font = @"Exo2.0-Bold", - Margin = new MarginPadding { Top = 20 }, - }, - source = new OsuSpriteText - { - Font = @"Exo2.0-Regular", - Direction = FillDirection.Full, - }, - new OsuSpriteText - { - Text = "Tags", - Font = @"Exo2.0-Bold", - Margin = new MarginPadding { Top = 20 }, - }, - tags = new FillFlowContainer + description = new MetadataSegment { + HeaderText = "Description", RelativeSizeAxes = Axes.X, - Spacing = new Vector2(3,0), + AutoSizeAxes = Axes.Y, }, + source = new MetadataSegment + { + HeaderText = "Source", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, + tags = new MetadataSegment + { + HeaderText = "Tags", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + } }, }, new FillFlowContainer @@ -343,9 +326,9 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colour) { - description.Colour = colour.GrayB; - source.Colour = colour.GrayB; - tags.Colour = colour.YellowLight; + description.ContentColour = colour.GrayB; + source.ContentColour = colour.GrayB; + tags.ContentColour = colour.YellowLight; stars.BarColour = colour.Yellow; @@ -451,5 +434,65 @@ namespace osu.Game.Screens.Select valueText.Colour = colour.GrayB; } } + + private class MetadataSegment : Container + { + private readonly OsuSpriteText header; + private readonly FillFlowContainer content; + + private const int fade_time = 250; + + public string HeaderText + { + set + { + header.Text = value; + } + } + + public string ContentText + { + set + { + if (value == "") + FadeOut(fade_time); + else + { + FadeIn(fade_time); + content.Children = value.Split(' ').Select(text => new OsuSpriteText + { + Text = text + " ", + Font = "Exo2.0-Regular", + }); + } + } + } + + public SRGBColour ContentColour + { + set + { + content.Colour = value; + } + } + + public MetadataSegment() + { + Children = new Drawable[] + { + header = new OsuSpriteText + { + Font = @"Exo2.0-Bold", + }, + content = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Full, + Margin = new MarginPadding { Top = header.TextSize } + } + }; + } + } } } \ No newline at end of file From 899e559b5c3f93b1c313d1612ea7010f0d8505c3 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 19:58:49 +0200 Subject: [PATCH 30/93] ratings hide now + remove unnessary stuff --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 3 --- osu.Game/Screens/Select/BeatmapDetails.cs | 21 +++++++++++++------- osu.Game/osu.Game.csproj | 4 +--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 169530a0c2..15db451ea9 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -19,7 +19,6 @@ namespace osu.Game.Screens.Select public readonly BeatmapDetails Details; public readonly Leaderboard Leaderboard; - private BeatmapDetailTab currentTab; private APIAccess api; @@ -60,8 +59,6 @@ namespace osu.Game.Screens.Select updateScores(); break; } - currentTab = tab; - updateDetails(); }, }, content = new Container diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 5acc5ccb56..2655fce8c5 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Select private readonly DifficultyRow approachRate; private readonly DifficultyRow stars; + private readonly Container ratingsContainer; private readonly Bar ratingsBar; private readonly OsuSpriteText negativeRatings; private readonly OsuSpriteText positiveRatings; @@ -40,7 +41,6 @@ namespace osu.Game.Screens.Select private readonly BarGraph failGraph; private BeatmapInfo beatmap; - public BeatmapInfo Beatmap { get @@ -66,7 +66,6 @@ namespace osu.Game.Screens.Select } private List ratings; - public IEnumerable Ratings { get @@ -76,11 +75,17 @@ namespace osu.Game.Screens.Select set { ratings = value.ToList(); - negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); - positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); - ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); + if(ratings.Count == 0) + ratingsContainer.FadeOut(250); + else + { + ratingsContainer.FadeIn(250); + negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); + positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); + ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); - ratingsGraph.Values = ratings.Select(rating => (float)rating); + ratingsGraph.Values = ratings.Select(rating => (float)rating); + } } } @@ -227,10 +232,12 @@ namespace osu.Game.Screens.Select }, }, }, - new Container + ratingsContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Alpha = 0, + AlwaysPresent = true, Children = new Drawable[] { new Box diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3e7f7e4abe..1888fda4a6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -385,9 +385,7 @@ - - - + From 6a87fd611235afb6e61515dfaea096414fdac3f6 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 20:19:03 +0200 Subject: [PATCH 31/93] retries and fails hide if they're not present --- osu.Game/Screens/Select/BeatmapDetails.cs | 46 +++++++++++++++-------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 2655fce8c5..23e3fcf0d5 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -37,6 +37,7 @@ namespace osu.Game.Screens.Select private readonly OsuSpriteText positiveRatings; private readonly BarGraph ratingsGraph; + private readonly FillFlowContainer retryAndFailContainer; private readonly BarGraph retryGraph; private readonly BarGraph failGraph; @@ -119,8 +120,14 @@ namespace osu.Game.Screens.Select private void calcRetryAndFailGraph() { - failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails?[index] ?? 0) ?? new List(); + if ((fails?.Count ?? 0) == 0 || (retries?.Count ?? 0) == 0) + retryAndFailContainer.FadeOut(250); + else + { + retryAndFailContainer.FadeIn(250); + failGraph.Values = fails.Select(fail => (float)fail); + retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]) ?? new List(); + } } public BeatmapDetails() @@ -304,26 +311,35 @@ namespace osu.Game.Screens.Select }, }, }, - new OsuSpriteText - { - Text = "Points of Failure", - Font = @"Exo2.0-Regular", - }, - new Container + retryAndFailContainer = new FillFlowContainer { RelativeSizeAxes = Axes.X, - Size = new Vector2(1/0.6f, 50), - Children = new[] + AutoSizeAxes = Axes.Y, + Alpha = 0, + Children = new Drawable[] { - retryGraph = new BarGraph + new OsuSpriteText { - RelativeSizeAxes = Axes.Both, + Text = "Points of Failure", + Font = @"Exo2.0-Regular", }, - failGraph = new BarGraph + new Container { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + Size = new Vector2(1/0.6f, 50), + Children = new[] + { + retryGraph = new BarGraph + { + RelativeSizeAxes = Axes.Both, + }, + failGraph = new BarGraph + { + RelativeSizeAxes = Axes.Both, + }, + }, }, - }, + } }, }, }, From c60a55285c6d20838f11e6319033b2a7aec05eb7 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 20:32:09 +0200 Subject: [PATCH 32/93] updated TestCase and some null checks --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 6 +++--- osu.Game/Graphics/UserInterface/BarGraph.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 9af7329600..2885520106 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -45,7 +45,9 @@ namespace osu.Desktop.VisualTests.Tests }); AddRepeatStep("new retry/fail values", newRetryAndFailValues, 10); - AddStep("new ratings", newRatings); + AddStep("new ratings", () => details.Ratings = Enumerable.Range(1, 10)); + AddStep("remove retries and fails", () => details.Retries = null ); + AddStep("remove ratings", () => details.Ratings = null); } private int lastRange = 1; @@ -56,7 +58,5 @@ namespace osu.Desktop.VisualTests.Tests details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); lastRange += 100; } - - private void newRatings() => details.Ratings = Enumerable.Range(1, 10); } } \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index e3f087b95c..832ba74b89 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface { set { - List values = value.ToList(); + List values = value?.ToList() ?? new List(); List graphBars = Children.ToList(); for (int i = 0; i < values.Count; i++) if (graphBars.Count > i) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 23e3fcf0d5..a319d3841c 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select } set { - ratings = value.ToList(); + ratings = value?.ToList() ?? new List(); if(ratings.Count == 0) ratingsContainer.FadeOut(250); else @@ -99,7 +99,7 @@ namespace osu.Game.Screens.Select } set { - retries = value.ToList(); + retries = value?.ToList() ?? new List(); calcRetryAndFailGraph(); } } @@ -113,7 +113,7 @@ namespace osu.Game.Screens.Select } set { - fails = value.ToList(); + fails = value?.ToList() ?? new List(); calcRetryAndFailGraph(); } } @@ -126,7 +126,7 @@ namespace osu.Game.Screens.Select { retryAndFailContainer.FadeIn(250); failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]) ?? new List(); + retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]); } } From 841d101be73026ef3c84bb5d585eced7d2ad311d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 20:41:03 +0200 Subject: [PATCH 33/93] renaming --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 2885520106..00f0d67e24 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -44,10 +44,10 @@ namespace osu.Desktop.VisualTests.Tests }, }); - AddRepeatStep("new retry/fail values", newRetryAndFailValues, 10); + AddRepeatStep("new fail values", newRetryAndFailValues, 10); AddStep("new ratings", () => details.Ratings = Enumerable.Range(1, 10)); - AddStep("remove retries and fails", () => details.Retries = null ); - AddStep("remove ratings", () => details.Ratings = null); + AddStep("remove fails", () => details.Fails = null ); + AddStep("remove ratings", () => details.Ratings = null ); } private int lastRange = 1; From 5e56e84c4a789cf5130cf69f26ee3f9508078c0b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 8 Apr 2017 13:31:55 +0200 Subject: [PATCH 34/93] change SRGBColour to Color4 and use IHasAccentColour in some places --- osu.Game/Graphics/UserInterface/Bar.cs | 8 ++++---- osu.Game/Screens/Select/BeatmapDetails.cs | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 7c2123a309..2320e48de8 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -2,8 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using System; @@ -33,11 +33,11 @@ namespace osu.Game.Graphics.UserInterface } } - public SRGBColour BackgroundColour + public Color4 BackgroundColour { get { - return background?.Colour ?? default(SRGBColour); + return background?.Colour ?? default(Color4); } set { @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface } } - public SRGBColour BarColour + public Color4 BarColour { get { diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a319d3841c..6be42a7759 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -5,7 +5,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; @@ -349,11 +348,11 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colour) { - description.ContentColour = colour.GrayB; - source.ContentColour = colour.GrayB; - tags.ContentColour = colour.YellowLight; + description.AccentColour = colour.GrayB; + source.AccentColour = colour.GrayB; + tags.AccentColour = colour.YellowLight; - stars.BarColour = colour.Yellow; + stars.AccentColour = colour.Yellow; ratingsBar.BackgroundColour = colour.Green; ratingsBar.BarColour = colour.YellowDark; @@ -363,7 +362,7 @@ namespace osu.Game.Screens.Select retryGraph.Colour = colour.Yellow; } - private class DifficultyRow : Container + private class DifficultyRow : Container, IHasAccentColour { private readonly OsuSpriteText name; private readonly Bar bar; @@ -412,7 +411,7 @@ namespace osu.Game.Screens.Select } } - public SRGBColour BarColour + public Color4 AccentColour { get { @@ -458,7 +457,7 @@ namespace osu.Game.Screens.Select } } - private class MetadataSegment : Container + private class MetadataSegment : Container, IHasAccentColour { private readonly OsuSpriteText header; private readonly FillFlowContainer content; @@ -491,8 +490,12 @@ namespace osu.Game.Screens.Select } } - public SRGBColour ContentColour + public Color4 AccentColour { + get + { + return content.Colour; + } set { content.Colour = value; From f7a9a11ae59441e7a493bbc851f11b43aa486e3d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 8 Apr 2017 13:53:11 +0200 Subject: [PATCH 35/93] Bar uses AccentColour aswell --- osu.Game/Graphics/UserInterface/Bar.cs | 4 ++-- osu.Game/Screens/Select/BeatmapDetails.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 2320e48de8..555d366f98 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -10,7 +10,7 @@ using System; namespace osu.Game.Graphics.UserInterface { - public class Bar : Container + public class Bar : Container, IHasAccentColour { private Box background; private readonly Box bar; @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface } } - public Color4 BarColour + public Color4 AccentColour { get { diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 6be42a7759..f1daf4eeb9 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -355,7 +355,7 @@ namespace osu.Game.Screens.Select stars.AccentColour = colour.Yellow; ratingsBar.BackgroundColour = colour.Green; - ratingsBar.BarColour = colour.YellowDark; + ratingsBar.AccentColour = colour.YellowDark; ratingsGraph.Colour = colour.BlueDark; failGraph.Colour = colour.YellowDarker; @@ -415,11 +415,11 @@ namespace osu.Game.Screens.Select { get { - return bar.BarColour; + return bar.AccentColour; } set { - bar.BarColour = value; + bar.AccentColour = value; } } From bcef1ce2b68f5c74bc140633cb4ad14ae8ed54ac Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 8 Apr 2017 13:59:22 +0200 Subject: [PATCH 36/93] replace space in text with Spacing in FillFlowContainer --- osu.Game/Screens/Select/BeatmapDetails.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index f1daf4eeb9..6bbe7a0858 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -483,7 +483,7 @@ namespace osu.Game.Screens.Select FadeIn(fade_time); content.Children = value.Split(' ').Select(text => new OsuSpriteText { - Text = text + " ", + Text = text, Font = "Exo2.0-Regular", }); } @@ -515,6 +515,7 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Full, + Spacing = new Vector2(5,0), Margin = new MarginPadding { Top = header.TextSize } } }; From 24b4b3ad7d8011a27c01f619158f27f4c3ab620d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 10 Apr 2017 16:42:23 +0200 Subject: [PATCH 37/93] update to everything --- .../Tests/TestCaseBeatmapDetails.cs | 36 ++- osu.Game/Database/BeatmapInfo.cs | 3 + osu.Game/Database/BeatmapMetric.cs | 23 ++ osu.Game/Graphics/UserInterface/Bar.cs | 16 +- osu.Game/Graphics/UserInterface/BarGraph.cs | 13 +- osu.Game/Screens/Select/BeatmapDetails.cs | 221 +++++------------- osu.Game/osu.Game.csproj | 1 + 7 files changed, 140 insertions(+), 173 deletions(-) create mode 100644 osu.Game/Database/BeatmapMetric.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 00f0d67e24..3394a6498e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -41,21 +41,45 @@ namespace osu.Desktop.VisualTests.Tests DrainRate = 1, }, StarDifficulty = 5.3f, + Metric = new BeatmapMetric + { + Ratings = Enumerable.Range(0,10).ToArray(), + Fails = Enumerable.Range(lastRange, 100).Select(i => (i % 12) - 6).ToArray(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => (i % 12) - 6).ToArray(), + }, }, }); - AddRepeatStep("new fail values", newRetryAndFailValues, 10); - AddStep("new ratings", () => details.Ratings = Enumerable.Range(1, 10)); - AddStep("remove fails", () => details.Fails = null ); - AddStep("remove ratings", () => details.Ratings = null ); + AddRepeatStep("fail values", newRetryAndFailValues, 10); } private int lastRange = 1; private void newRetryAndFailValues() { - details.Fails = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Cos(i) * 100)); - details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); + details.Beatmap = new BeatmapInfo + { + Version = "VisualTest", + Metadata = new BeatmapMetadata + { + Source = "Some guy", + Tags = "beatmap metadata example with a very very long list of tags and not much creativity", + }, + Difficulty = new BeatmapDifficulty + { + CircleSize = 7, + ApproachRate = 3.5f, + OverallDifficulty = 5.7f, + DrainRate = 1, + }, + StarDifficulty = 5.3f, + Metric = new BeatmapMetric + { + Ratings = Enumerable.Range(0, 10).ToArray(), + Fails = Enumerable.Range(lastRange, 100).Select(i => (i % 12) - 6).ToArray(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => (i % 12) - 6).ToArray(), + }, + }; lastRange += 100; } } diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index bc6e077633..252d52a744 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -41,6 +41,9 @@ namespace osu.Game.Database [OneToOne(CascadeOperations = CascadeOperation.All)] public BeatmapDifficulty Difficulty { get; set; } + [Ignore] + public BeatmapMetric Metric { get; set; } + public string Path { get; set; } public string Hash { get; set; } diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetric.cs new file mode 100644 index 0000000000..2302289047 --- /dev/null +++ b/osu.Game/Database/BeatmapMetric.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Database +{ + public class BeatmapMetric + { + /// + /// Ratings for a beatmap, length should be 10 + /// + public int[] Ratings { get; set; } + + /// + /// Fails for a beatmap, length should be 100 + /// + public int[] Fails { get; set; } + + /// + /// Retries for a beatmap, length should be 100 + /// + public int[] Retries { get; set; } + } +} diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 555d366f98..c9733b807d 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -20,6 +20,9 @@ namespace osu.Game.Graphics.UserInterface private const EasingTypes easing = EasingTypes.InOutCubic; private float length; + /// + /// Length of the bar, ranges from 0 to 1 + /// public float Length { get @@ -41,12 +44,6 @@ namespace osu.Game.Graphics.UserInterface } set { - if (background == null) - Add(background = new Box - { - RelativeSizeAxes = Axes.Both, - Depth = 1, - }); background.Colour = value; } } @@ -81,10 +78,15 @@ namespace osu.Game.Graphics.UserInterface { Children = new[] { + background = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(0,0,0,0) + }, bar = new Box { RelativeSizeAxes = Axes.Both, - } + }, }; } diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 832ba74b89..b29726ab1c 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -11,6 +11,11 @@ namespace osu.Game.Graphics.UserInterface { public class BarGraph : FillFlowContainer { + /// + /// Manually sets the max value, if null is instead used + /// + public float? MaxValue { get; set; } + private BarDirection direction = BarDirection.BottomToTop; public new BarDirection Direction { @@ -30,6 +35,9 @@ namespace osu.Game.Graphics.UserInterface } } + /// + /// A list of floats that defines the length of each + /// public IEnumerable Values { set @@ -39,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface for (int i = 0; i < values.Count; i++) if (graphBars.Count > i) { - graphBars[i].Length = values[i] / values.Max(); + graphBars[i].Length = values[i] / (MaxValue ?? values.Max()); graphBars[i].Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1); } else @@ -47,9 +55,10 @@ namespace osu.Game.Graphics.UserInterface { RelativeSizeAxes = Axes.Both, Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1), - Length = values[i] / values.Max(), + Length = values[i] / (MaxValue ?? values.Max()), Direction = Direction, }); + Remove(Children.Where((bar, index) => index >= values.Count)); } } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 6bbe7a0858..e33f42e5b1 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -47,85 +47,49 @@ namespace osu.Game.Screens.Select { return beatmap; } - set { if (beatmap == value) return; beatmap = value; - description.ContentText = beatmap.Version; - source.ContentText = beatmap.Metadata.Source; - tags.ContentText = beatmap.Metadata.Tags; + description.Text = beatmap.Version; + source.Text = beatmap.Metadata.Source; + tags.Text = beatmap.Metadata.Tags; circleSize.Value = beatmap.Difficulty.CircleSize; drainRate.Value = beatmap.Difficulty.DrainRate; overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - } - } - private List ratings; - public IEnumerable Ratings - { - get - { - return ratings; - } - set - { - ratings = value?.ToList() ?? new List(); - if(ratings.Count == 0) - ratingsContainer.FadeOut(250); + + List ratings = beatmap.Metric?.Ratings?.ToList() ?? new List(); + if (ratings.Count == 0) + ratingsContainer.Hide(); else { - ratingsContainer.FadeIn(250); + ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); ratingsGraph.Values = ratings.Select(rating => (float)rating); } - } - } - private List retries; - public IEnumerable Retries - { - get - { - return retries; - } - set - { - retries = value?.ToList() ?? new List(); - calcRetryAndFailGraph(); - } - } + List retries = beatmap.Metric?.Retries?.ToList() ?? new List(); + List fails = beatmap.Metric?.Fails?.ToList() ?? new List(); - private List fails; - public IEnumerable Fails - { - get - { - return fails; - } - set - { - fails = value?.ToList() ?? new List(); - calcRetryAndFailGraph(); - } - } - - private void calcRetryAndFailGraph() - { - if ((fails?.Count ?? 0) == 0 || (retries?.Count ?? 0) == 0) - retryAndFailContainer.FadeOut(250); - else - { - retryAndFailContainer.FadeIn(250); - failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]); + if ((fails?.Count ?? 0) == 0 || (retries?.Count ?? 0) == 0) + retryAndFailContainer.Hide(); + else + { + retryAndFailContainer.Show(); + float maxValue = fails.Select((fail, index) => fail + retries[index]).Max(); + failGraph.MaxValue = maxValue; + retryGraph.MaxValue = maxValue; + failGraph.Values = fails.Select(fail => (float)fail); + retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue)); + } } } @@ -152,24 +116,9 @@ namespace osu.Game.Screens.Select Padding = new MarginPadding(10) { Top = 25 }, Children = new [] { - description = new MetadataSegment - { - HeaderText = "Description", - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, - source = new MetadataSegment - { - HeaderText = "Source", - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, - tags = new MetadataSegment - { - HeaderText = "Tags", - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - } + description = new MetadataSegment("Description"), + source = new MetadataSegment("Source"), + tags = new MetadataSegment("Tags") }, }, new FillFlowContainer @@ -178,7 +127,7 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.6f, Direction = FillDirection.Vertical, - Spacing = new Vector2(0,15), + Spacing = new Vector2(0, 15), Padding = new MarginPadding(10) { Top = 0 }, Children = new Drawable[] { @@ -203,37 +152,11 @@ namespace osu.Game.Screens.Select Padding = new MarginPadding(15) { Top = 25 }, Children = new [] { - circleSize = new DifficultyRow - { - DifficultyName = "Circle Size", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - MaxValue = 7, - }, - drainRate = new DifficultyRow - { - DifficultyName = "HP Drain", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }, - overallDifficulty = new DifficultyRow - { - DifficultyName = "Accuracy", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }, - approachRate = new DifficultyRow - { - DifficultyName = "Approach Rate", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }, - stars = new DifficultyRow - { - DifficultyName = "Star Difficulty", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }, + circleSize = new DifficultyRow("Circle Size", 7), + drainRate = new DifficultyRow("HP Drain"), + overallDifficulty = new DifficultyRow("Accuracy"), + approachRate = new DifficultyRow("Approach Rate"), + stars = new DifficultyRow("Star Diffculty"), }, }, }, @@ -320,7 +243,7 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Text = "Points of Failure", - Font = @"Exo2.0-Regular", + Font = @"Exo2.0-Regular", }, new Container { @@ -341,7 +264,7 @@ namespace osu.Game.Screens.Select } }, }, - }, + } }; } @@ -368,8 +291,9 @@ namespace osu.Game.Screens.Select private readonly Bar bar; private readonly OsuSpriteText valueText; - private float difficultyValue; + private readonly float maxValue; + private float difficultyValue; public float Value { get @@ -384,33 +308,6 @@ namespace osu.Game.Screens.Select } } - private float maxValue = 10; - - public float MaxValue - { - get - { - return maxValue; - } - set - { - maxValue = value; - bar.Length = Value / value; - } - } - - public string DifficultyName - { - get - { - return name.Text; - } - set - { - name.Text = value; - } - } - public Color4 AccentColour { get @@ -423,13 +320,17 @@ namespace osu.Game.Screens.Select } } - public DifficultyRow() + public DifficultyRow(string difficultyName, float maxValue = 10) { + this.maxValue = maxValue; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; Children = new Drawable[] { name = new OsuSpriteText { Font = @"Exo2.0-Regular", + Text = difficultyName, }, bar = new Bar { @@ -462,30 +363,30 @@ namespace osu.Game.Screens.Select private readonly OsuSpriteText header; private readonly FillFlowContainer content; - private const int fade_time = 250; - - public string HeaderText + public string Text { set { - header.Text = value; - } - } - - public string ContentText - { - set - { - if (value == "") - FadeOut(fade_time); + if (string.IsNullOrEmpty(value)) + Hide(); else { - FadeIn(fade_time); - content.Children = value.Split(' ').Select(text => new OsuSpriteText - { - Text = text, - Font = "Exo2.0-Regular", - }); + Show(); + if (header.Text == "Tags") + content.Children = value.Split(' ').Select(text => new OsuSpriteText + { + Text = text, + Font = "Exo2.0-Regular", + }); + else + content.Children = new[] + { + new OsuSpriteText + { + Text = value, + Font = "Exo2.0-Regular", + } + }; } } } @@ -502,13 +403,17 @@ namespace osu.Game.Screens.Select } } - public MetadataSegment() + public MetadataSegment(string headerText) { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Margin = new MarginPadding { Top = 10 }; Children = new Drawable[] { header = new OsuSpriteText { Font = @"Exo2.0-Bold", + Text = headerText, }, content = new FillFlowContainer { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1888fda4a6..7f01efbe70 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -79,6 +79,7 @@ + From 412d6a14ca01fbe1e43e7f1baca9df0bc2544cf6 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 10 Apr 2017 16:45:34 +0200 Subject: [PATCH 38/93] removed something unnecessary --- osu.Game/Graphics/UserInterface/Bar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index c9733b807d..4647adb91c 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -40,7 +40,7 @@ namespace osu.Game.Graphics.UserInterface { get { - return background?.Colour ?? default(Color4); + return background.Colour; } set { From ad41fd5c1a91eb54ff203104fbdecc6e3a0c589d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 10 Apr 2017 16:49:48 +0200 Subject: [PATCH 39/93] more unnecessary stuff --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 9 ++++----- osu.Game/Graphics/UserInterface/Bar.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 3394a6498e..200c2ba786 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Screens.Select; -using System; using System.Linq; namespace osu.Desktop.VisualTests.Tests @@ -44,8 +43,8 @@ namespace osu.Desktop.VisualTests.Tests Metric = new BeatmapMetric { Ratings = Enumerable.Range(0,10).ToArray(), - Fails = Enumerable.Range(lastRange, 100).Select(i => (i % 12) - 6).ToArray(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => (i % 12) - 6).ToArray(), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(), }, }, }); @@ -76,8 +75,8 @@ namespace osu.Desktop.VisualTests.Tests Metric = new BeatmapMetric { Ratings = Enumerable.Range(0, 10).ToArray(), - Fails = Enumerable.Range(lastRange, 100).Select(i => (i % 12) - 6).ToArray(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => (i % 12) - 6).ToArray(), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(), }, }; lastRange += 100; diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 4647adb91c..07aafbb655 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -12,7 +12,7 @@ namespace osu.Game.Graphics.UserInterface { public class Bar : Container, IHasAccentColour { - private Box background; + private readonly Box background; private readonly Box bar; private const int resize_duration = 250; diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index e33f42e5b1..2414122d7b 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Select List retries = beatmap.Metric?.Retries?.ToList() ?? new List(); List fails = beatmap.Metric?.Fails?.ToList() ?? new List(); - if ((fails?.Count ?? 0) == 0 || (retries?.Count ?? 0) == 0) + if (fails.Count == 0 || retries.Count == 0) retryAndFailContainer.Hide(); else { From 24fea2809b47e50c92a824957d7577f66a5c4ed3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 13:44:55 +0900 Subject: [PATCH 40/93] Map beatmap md5 from online response to BeatmapInfo. --- osu.Game/Database/BeatmapInfo.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index bc6e077633..798540bdd8 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -43,6 +43,7 @@ namespace osu.Game.Database public string Path { get; set; } + [JsonProperty("file_md5")] public string Hash { get; set; } // General From ecfe68d6fba14bf6915182e52e049e6639bf0a46 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 13:47:30 +0900 Subject: [PATCH 41/93] Hide deprecated API storage variables and populate Score.User automatically. --- osu.Game/Modes/Scoring/Score.cs | 23 ++++++++++++++++--- .../Select/Leaderboards/LeaderboardScore.cs | 4 ++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Modes/Scoring/Score.cs index c998b11f77..e49907e7a8 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Modes/Scoring/Score.cs @@ -27,7 +27,24 @@ namespace osu.Game.Modes.Scoring public int Combo { get; set; } public Mod[] Mods { get; set; } - public User User { get; set; } + private User user; + + public User User + { + get + { + return user ?? new User + { + Username = temporaryUsername, + Id = temporaryUserID + }; + } + + set + { + user = value; + } + } [JsonProperty(@"replay_data")] public Replay Replay; @@ -38,10 +55,10 @@ namespace osu.Game.Modes.Scoring public long OnlineScoreID; [JsonProperty(@"username")] - public string Username; + private string temporaryUsername; [JsonProperty(@"user_id")] - public long UserID; + private long temporaryUserID; [JsonProperty(@"date")] public DateTime Date; diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 2bac387c5c..493f351b75 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -142,7 +142,7 @@ namespace osu.Game.Screens.Select.Leaderboards Children = new Drawable[] { avatar = new DelayedLoadWrapper( - new Avatar(Score.User ?? new User { Id = Score.UserID }) + new Avatar(Score.User) { RelativeSizeAxes = Axes.Both, CornerRadius = corner_radius, @@ -169,7 +169,7 @@ namespace osu.Game.Screens.Select.Leaderboards { nameLabel = new OsuSpriteText { - Text = Score.User?.Username ?? Score.Username, + Text = Score.User.Username, Font = @"Exo2.0-BoldItalic", TextSize = 23, }, From dc3a2d45fe15aa1c8be2bda54797d7ce69eef17b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 13:48:43 +0900 Subject: [PATCH 42/93] Move API lookup from BeatmapDetailArea to Leaderboard. --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 38 +----------------- .../Select/Leaderboards/Leaderboard.cs | 40 +++++++++++++++++++ 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index dae909f2b7..186739c3cb 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -1,13 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Game.Beatmaps; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select @@ -20,8 +17,6 @@ namespace osu.Game.Screens.Select public readonly Container Details; //todo: replace with a real details view when added public readonly Leaderboard Leaderboard; - private APIAccess api; - private WorkingBeatmap beatmap; public WorkingBeatmap Beatmap { @@ -32,7 +27,7 @@ namespace osu.Game.Screens.Select set { beatmap = value; - if (IsLoaded) Schedule(updateScores); + Leaderboard.Beatmap = beatmap?.BeatmapInfo; } } @@ -56,9 +51,6 @@ namespace osu.Game.Screens.Select Leaderboard.Show(); break; } - - //for now let's always update scores. - updateScores(); }, }, content = new Container @@ -77,35 +69,9 @@ namespace osu.Game.Screens.Select Leaderboard = new Leaderboard { RelativeSizeAxes = Axes.Both, + } }); } - - protected override void LoadComplete() - { - base.LoadComplete(); - updateScores(); - } - - [BackgroundDependencyLoader(permitNulls: true)] - private void load(APIAccess api) - { - this.api = api; - } - - private GetScoresRequest getScoresRequest; - private void updateScores() - { - if (!IsLoaded) return; - - Leaderboard.Scores = null; - getScoresRequest?.Cancel(); - - if (api == null || beatmap?.BeatmapInfo == null || !Leaderboard.IsPresent) return; - - getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo); - getScoresRequest.Success += r => Leaderboard.Scores = r.Scores; - api.Queue(getScoresRequest); - } } } diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 12ff096d16..315611a60c 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -10,7 +10,11 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using System; +using osu.Framework.Allocation; +using osu.Game.Database; using osu.Game.Modes.Scoring; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; namespace osu.Game.Screens.Select.Leaderboards { @@ -26,6 +30,7 @@ namespace osu.Game.Screens.Select.Leaderboards set { scores = value; + getScoresRequest?.Cancel(); int i = 150; if (scores == null) @@ -81,6 +86,41 @@ namespace osu.Game.Screens.Select.Leaderboards }; } + private APIAccess api; + + private BeatmapInfo beatmap; + + public BeatmapInfo Beatmap + { + get { return beatmap; } + set + { + beatmap = value; + Schedule(updateScores); + } + } + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(APIAccess api) + { + this.api = api; + } + + private GetScoresRequest getScoresRequest; + private void updateScores() + { + if (!IsLoaded) return; + + Scores = null; + getScoresRequest?.Cancel(); + + if (api == null || Beatmap == null) return; + + getScoresRequest = new GetScoresRequest(Beatmap); + getScoresRequest.Success += r => Scores = r.Scores; + api.Queue(getScoresRequest); + } + protected override void Update() { base.Update(); From f8c6ce15c395a6faadeaa2fde8f1c7a9d1ef6f4c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 13:45:16 +0900 Subject: [PATCH 43/93] Fix weird RollingCounter behaviour. --- osu.Game/Graphics/UserInterface/RollingCounter.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 12eeb771dd..869ee37e11 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -108,8 +108,6 @@ namespace osu.Game.Graphics.UserInterface { base.LoadComplete(); - Flush(false, TransformType); - DisplayedCountSpriteText.Text = FormatCount(Current); DisplayedCountSpriteText.Anchor = Anchor; DisplayedCountSpriteText.Origin = Origin; @@ -205,8 +203,8 @@ namespace osu.Game.Graphics.UserInterface ? GetProportionalDuration(currentValue, newValue) : RollingDuration; - transform.StartTime = Time.Current; - transform.EndTime = Time.Current + rollingTotalDuration; + transform.StartTime = TransformStartTime; + transform.EndTime = TransformStartTime + rollingTotalDuration; transform.StartValue = currentValue; transform.EndValue = newValue; transform.Easing = RollingEasing; From 7ca0d6d11738975945e7a2b0798e12e137badf05 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 16:44:12 +0900 Subject: [PATCH 44/93] Adjust cursor popin/out to make it less ugly. --- osu.Game/Graphics/Cursor/MenuCursor.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 0fb7f59212..ceb3296bdf 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -80,14 +80,12 @@ namespace osu.Game.Graphics.Cursor protected override void PopIn() { ActiveCursor.FadeTo(1, 250, EasingTypes.OutQuint); - ActiveCursor.ScaleTo(1, 1000, EasingTypes.OutElastic); + ActiveCursor.ScaleTo(1, 400, EasingTypes.OutQuint); } protected override void PopOut() { - ActiveCursor.FadeTo(0, 1400, EasingTypes.OutQuint); - ActiveCursor.ScaleTo(1.1f, 100, EasingTypes.Out); - ActiveCursor.Delay(100); + ActiveCursor.FadeTo(0, 900, EasingTypes.OutQuint); ActiveCursor.ScaleTo(0, 500, EasingTypes.In); } From 001836f535e799545575dd6595bccb1fb359fe5c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 16:48:11 +0900 Subject: [PATCH 45/93] Rename variables and make public for now. --- osu.Game/Modes/Scoring/Score.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Modes/Scoring/Score.cs index e49907e7a8..b0c123f438 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Modes/Scoring/Score.cs @@ -35,8 +35,8 @@ namespace osu.Game.Modes.Scoring { return user ?? new User { - Username = temporaryUsername, - Id = temporaryUserID + Username = LegacyUsername, + Id = LegacyUserID }; } @@ -55,10 +55,10 @@ namespace osu.Game.Modes.Scoring public long OnlineScoreID; [JsonProperty(@"username")] - private string temporaryUsername; + public string LegacyUsername; [JsonProperty(@"user_id")] - private long temporaryUserID; + public long LegacyUserID; [JsonProperty(@"date")] public DateTime Date; From 9732110bd95b1435ab9010217d7d509943ac27f2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 17:25:56 +0900 Subject: [PATCH 46/93] Update TransformTo methods in line with framework changes. --- osu.Game/Graphics/IHasAccentColour.cs | 2 +- osu.Game/Overlays/DragBar.cs | 2 +- osu.Game/Screens/Tournament/ScrollingTeamContainer.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index f959bc8760..e4647f22fd 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -28,7 +28,7 @@ namespace osu.Game.Graphics /// The tween easing. public static void FadeAccent(this IHasAccentColour accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) { - accentedDrawable.TransformTo(accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent()); + accentedDrawable.TransformTo(() => accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent()); } } } diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 90991bb195..53a01c9e9c 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -65,7 +65,7 @@ namespace osu.Game.Overlays private void updatePosition(float position) { position = MathHelper.Clamp(position, 0, 1); - fill.TransformTo(fill.Width, position, 200, EasingTypes.OutQuint, new TransformSeek()); + fill.TransformTo(() => fill.Width, position, 200, EasingTypes.OutQuint, new TransformSeek()); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index b80f76d281..08f270741c 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -298,7 +298,7 @@ namespace osu.Game.Screens.Tournament private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) { DelayReset(); - TransformTo(speed, value, duration, easing, new TransformScrollSpeed()); + TransformTo(() => speed, value, duration, easing, new TransformScrollSpeed()); } private enum ScrollState From 7d7bea7198fd472e8c9243fef80a0ebddcbe1100 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 18:40:39 +0900 Subject: [PATCH 47/93] Fix crash on restart after update. Also make update process more graceful. --- osu.Desktop/Overlays/VersionManager.cs | 9 +++++++-- osu.Game/OsuGame.cs | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 70925f6cf4..9532652bfe 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -189,19 +189,24 @@ namespace osu.Desktop.Overlays private class UpdateProgressNotification : ProgressNotification { + private OsuGame game; + protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification() { Text = @"Update ready to install. Click to restart!", Activated = () => { - UpdateManager.RestartApp(); + UpdateManager.RestartAppWhenExited(); + game.GracefullyExit(); return true; } }; [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, OsuGame game) { + this.game = game; + IconContent.Add(new Drawable[] { new Box diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7172aba3be..ccea6ef458 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -307,6 +307,18 @@ namespace osu.Game return base.OnExiting(); } + /// + /// Use to programatically exit the game as if the user was triggering via alt-f4. + /// Will keep persisting until an exit occurs (exit may be blocked multiple times). + /// + public void GracefullyExit() + { + if (!OnExiting()) + Exit(); + else + Scheduler.AddDelayed(GracefullyExit, 2000); + } + protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); From 1a2db87668d254315cbd2a1d52cbb9dc902354a3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 19:19:54 +0900 Subject: [PATCH 48/93] Fix osu! mode adding combos twice. --- osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs index 0bd587e8ea..00c797e97d 100644 --- a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs @@ -30,21 +30,6 @@ namespace osu.Game.Modes.Osu.Scoring protected override void OnNewJudgement(OsuJudgement judgement) { - if (judgement != null) - { - switch (judgement.Result) - { - case HitResult.Hit: - Combo.Value++; - Health.Value += 0.1f; - break; - case HitResult.Miss: - Combo.Value = 0; - Health.Value -= 0.2f; - break; - } - } - int score = 0; int maxScore = 0; From 9e6fa965b21003966c21372e4623280953dcf601 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 19:38:03 +0900 Subject: [PATCH 49/93] TestCasePlayer doesn't need a PlayerLoader. --- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index f36889b02a..624723ed35 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -83,10 +83,7 @@ namespace osu.Desktop.VisualTests.Tests Colour = Color4.Black, }); - Add(new PlayerLoader(Player = CreatePlayer(beatmap)) - { - Beatmap = beatmap - }); + Add(Player = CreatePlayer(beatmap)); } protected virtual Player CreatePlayer(WorkingBeatmap beatmap) From 1a1607aaaa0c0e240f6f0d5aa12650a556a079b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 19:58:57 +0900 Subject: [PATCH 50/93] Improve the look of the transition on hotkey retry (and retry in general). --- osu.Game/Screens/Play/Player.cs | 35 ++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a7108eda1b..94e82860f2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -116,7 +116,12 @@ namespace osu.Game.Screens.Play scoreProcessor = HitRenderer.CreateScoreProcessor(); - hudOverlay = new StandardHudOverlay(); + hudOverlay = new StandardHudOverlay() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }; + hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); hudOverlay.BindHitRenderer(HitRenderer); @@ -160,7 +165,12 @@ namespace osu.Game.Screens.Play }, new HotkeyRetryOverlay { - Action = Restart, + Action = () => { + //we want to hide the hitrenderer immediately (looks better). + //we may be able to remove this once the mouse cursor trail is improved. + HitRenderer?.Hide(); + Restart(); + }, } }; } @@ -304,8 +314,7 @@ namespace osu.Game.Screens.Play protected override void OnSuspending(Screen next) { - Content.FadeOut(350); - Content.ScaleTo(0.7f, 750, EasingTypes.InQuint); + fadeOut(); base.OnSuspending(next); } @@ -324,14 +333,22 @@ namespace osu.Game.Screens.Play } } - HitRenderer?.FadeOut(60); - - FadeOut(250); - Content.ScaleTo(0.7f, 750, EasingTypes.InQuint); - Background?.FadeTo(1f, 200); + fadeOut(); return base.OnExiting(next); } + private void fadeOut() + { + const float fade_out_duration = 250; + + HitRenderer?.FadeOut(fade_out_duration); + Content.FadeOut(fade_out_duration); + + hudOverlay.ScaleTo(0.7f, fade_out_duration * 3, EasingTypes.In); + + Background?.FadeTo(1f, fade_out_duration); + } + private Bindable mouseWheelDisabled; protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; From fb5952186c45a5526b625ae366c9d09961fcbed6 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 14:02:56 +0200 Subject: [PATCH 51/93] changes and fixes --- .../Tests/TestCaseBeatmapDetails.cs | 12 ++++---- ...estCaseGraphAndBar.cs => TestCaseGraph.cs} | 5 ++-- .../osu.Desktop.VisualTests.csproj | 2 +- osu.Game/Database/BeatmapMetric.cs | 8 ++++-- osu.Game/Graphics/UserInterface/BarGraph.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 28 +++++++++---------- 6 files changed, 30 insertions(+), 27 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCaseGraphAndBar.cs => TestCaseGraph.cs} (84%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 200c2ba786..9ea182c5c7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -42,9 +42,9 @@ namespace osu.Desktop.VisualTests.Tests StarDifficulty = 5.3f, Metric = new BeatmapMetric { - Ratings = Enumerable.Range(0,10).ToArray(), - Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(), + Ratings = Enumerable.Range(0,10).ToList(), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(), }, }, }); @@ -74,9 +74,9 @@ namespace osu.Desktop.VisualTests.Tests StarDifficulty = 5.3f, Metric = new BeatmapMetric { - Ratings = Enumerable.Range(0, 10).ToArray(), - Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(), + Ratings = Enumerable.Range(0, 10).ToList(), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(), }, }; lastRange += 100; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs similarity index 84% rename from osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs rename to osu.Desktop.VisualTests/Tests/TestCaseGraph.cs index 5ae64b5e73..7ac795f6f9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs @@ -9,9 +9,9 @@ using System.Linq; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseGraphAndBar : TestCase + internal class TestCaseGraph : TestCase { - public override string Description => "graphs and bars, bars and graphs"; + public override string Description => "graph"; private BarGraph graph; @@ -31,6 +31,7 @@ namespace osu.Desktop.VisualTests.Tests }; AddStep("values from 1-10", () => graph.Values = Enumerable.Range(1,10).Select(i => (float)i)); + AddStep("values from 1-100", () => graph.Values = Enumerable.Range(1, 100).Select(i => (float)i)); AddStep("reversed values from 1-10", () => graph.Values = Enumerable.Range(1, 10).Reverse().Select(i => (float)i)); AddStep("Bottom to top", () => graph.Direction = BarDirection.BottomToTop); AddStep("Top to bottom", () => graph.Direction = BarDirection.TopToBottom); diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 44d823e50d..455e04ccec 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -190,7 +190,7 @@ - + diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetric.cs index 2302289047..6272e5d6b1 100644 --- a/osu.Game/Database/BeatmapMetric.cs +++ b/osu.Game/Database/BeatmapMetric.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; + namespace osu.Game.Database { public class BeatmapMetric @@ -8,16 +10,16 @@ namespace osu.Game.Database /// /// Ratings for a beatmap, length should be 10 /// - public int[] Ratings { get; set; } + public List Ratings { get; set; } /// /// Fails for a beatmap, length should be 100 /// - public int[] Fails { get; set; } + public List Fails { get; set; } /// /// Retries for a beatmap, length should be 100 /// - public int[] Retries { get; set; } + public List Retries { get; set; } } } diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index b29726ab1c..41a00d7fec 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -58,7 +58,7 @@ namespace osu.Game.Graphics.UserInterface Length = values[i] / (MaxValue ?? values.Max()), Direction = Direction, }); - Remove(Children.Where((bar, index) => index >= values.Count)); + Remove(Children.Where((bar, index) => index >= values.Count).ToList()); } } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 2414122d7b..fab36ba5a6 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -36,7 +36,7 @@ namespace osu.Game.Screens.Select private readonly OsuSpriteText positiveRatings; private readonly BarGraph ratingsGraph; - private readonly FillFlowContainer retryAndFailContainer; + private readonly FillFlowContainer retryFailContainer; private readonly BarGraph retryGraph; private readonly BarGraph failGraph; @@ -62,34 +62,34 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - - List ratings = beatmap.Metric?.Ratings?.ToList() ?? new List(); - if (ratings.Count == 0) - ratingsContainer.Hide(); - else + if (beatmap.Metric?.Ratings.Count != 0) { + List ratings = beatmap.Metric?.Ratings; ratingsContainer.Show(); + negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); ratingsGraph.Values = ratings.Select(rating => (float)rating); } - - List retries = beatmap.Metric?.Retries?.ToList() ?? new List(); - List fails = beatmap.Metric?.Fails?.ToList() ?? new List(); - - if (fails.Count == 0 || retries.Count == 0) - retryAndFailContainer.Hide(); else + ratingsContainer.Hide(); + + if (beatmap.Metric?.Retries.Count != 0 && beatmap.Metric?.Fails.Count != 0) { - retryAndFailContainer.Show(); + List retries = beatmap.Metric?.Retries; + List fails = beatmap.Metric?.Fails; + + retryFailContainer.Show(); float maxValue = fails.Select((fail, index) => fail + retries[index]).Max(); failGraph.MaxValue = maxValue; retryGraph.MaxValue = maxValue; failGraph.Values = fails.Select(fail => (float)fail); retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue)); } + else + retryFailContainer.Hide(); } } @@ -233,7 +233,7 @@ namespace osu.Game.Screens.Select }, }, }, - retryAndFailContainer = new FillFlowContainer + retryFailContainer = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, From bfebba3a206a7e818bf5aa3ad635d1144cd357ef Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 14:12:23 +0200 Subject: [PATCH 52/93] null reference fixes --- osu.Game/Screens/Select/BeatmapDetails.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index fab36ba5a6..a76497b221 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -62,9 +62,11 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings.Count != 0) + if (beatmap.Metric?.Ratings?.Count == 0) + ratingsContainer.Hide(); + else { - List ratings = beatmap.Metric?.Ratings; + List ratings = beatmap.Metric.Ratings; ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); @@ -73,23 +75,22 @@ namespace osu.Game.Screens.Select ratingsGraph.Values = ratings.Select(rating => (float)rating); } + + if (beatmap.Metric?.Retries?.Count == 0 && beatmap.Metric?.Fails?.Count == 0) + retryFailContainer.Hide(); else - ratingsContainer.Hide(); - - if (beatmap.Metric?.Retries.Count != 0 && beatmap.Metric?.Fails.Count != 0) { - List retries = beatmap.Metric?.Retries; - List fails = beatmap.Metric?.Fails; - + List retries = beatmap.Metric.Retries; + List fails = beatmap.Metric.Fails; retryFailContainer.Show(); + float maxValue = fails.Select((fail, index) => fail + retries[index]).Max(); failGraph.MaxValue = maxValue; retryGraph.MaxValue = maxValue; + failGraph.Values = fails.Select(fail => (float)fail); retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue)); } - else - retryFailContainer.Hide(); } } From 9dd8920c2ceda574835057667a773090ae5ae409 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 14:22:13 +0200 Subject: [PATCH 53/93] :thinking: I hope this works --- osu.Game/Screens/Select/BeatmapDetails.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a76497b221..811235ea13 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings?.Count == 0) + if (beatmap.Metric?.Ratings == null) ratingsContainer.Hide(); else { @@ -76,7 +76,7 @@ namespace osu.Game.Screens.Select ratingsGraph.Values = ratings.Select(rating => (float)rating); } - if (beatmap.Metric?.Retries?.Count == 0 && beatmap.Metric?.Fails?.Count == 0) + if (beatmap.Metric?.Retries == null && beatmap.Metric?.Fails == null) retryFailContainer.Hide(); else { From 9026880495e266540313d0d6e40c338f7f2fe01b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 14:40:12 +0200 Subject: [PATCH 54/93] fix --- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 811235ea13..559f159e49 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -76,7 +76,7 @@ namespace osu.Game.Screens.Select ratingsGraph.Values = ratings.Select(rating => (float)rating); } - if (beatmap.Metric?.Retries == null && beatmap.Metric?.Fails == null) + if (beatmap.Metric?.Retries == null || beatmap.Metric?.Fails == null) retryFailContainer.Hide(); else { From f64af9bce3b3ca839f3efebd4410028b774dc911 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 23:59:08 +0900 Subject: [PATCH 55/93] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 1490f00327..4caf0c918e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1490f003273d7aab6589e489f6e4b02d204c9f27 +Subproject commit 4caf0c918edfd9d3be0358e2b2cfc4d40908e330 From a1aed44f109c0e38d9da85bea51f2e6a4ed6094c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 00:05:21 +0900 Subject: [PATCH 56/93] Fix health not being calculated in osu! mode (regression). --- osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs index 00c797e97d..3b798a2fad 100644 --- a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs @@ -30,6 +30,19 @@ namespace osu.Game.Modes.Osu.Scoring protected override void OnNewJudgement(OsuJudgement judgement) { + if (judgement != null) + { + switch (judgement.Result) + { + case HitResult.Hit: + Health.Value += 0.1f; + break; + case HitResult.Miss: + Health.Value -= 0.2f; + break; + } + } + int score = 0; int maxScore = 0; From bc98e53aff3c5aa934942950fff73fb815a3d74f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 12 Apr 2017 00:09:45 +0900 Subject: [PATCH 57/93] I helped. --- osu.Game/Screens/Play/Player.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 94e82860f2..e2712a64e4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -168,7 +168,7 @@ namespace osu.Game.Screens.Play Action = () => { //we want to hide the hitrenderer immediately (looks better). //we may be able to remove this once the mouse cursor trail is improved. - HitRenderer?.Hide(); + HitRenderer?.Hide(); Restart(); }, } @@ -353,4 +353,4 @@ namespace osu.Game.Screens.Play protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; } -} \ No newline at end of file +} From d4e5f550914dfb0b3f1104b1cf0ade75fc3b5802 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 18:43:48 +0200 Subject: [PATCH 58/93] the power of linq --- .../Tests/TestCaseBeatmapDetails.cs | 32 ++++--------------- osu.Game/Database/BeatmapMetric.cs | 6 ++-- osu.Game/Graphics/UserInterface/BarGraph.cs | 17 +++++----- osu.Game/Screens/Select/BeatmapDetails.cs | 23 +++++++------ 4 files changed, 28 insertions(+), 50 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 9ea182c5c7..7cf42b966a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -42,9 +42,9 @@ namespace osu.Desktop.VisualTests.Tests StarDifficulty = 5.3f, Metric = new BeatmapMetric { - Ratings = Enumerable.Range(0,10).ToList(), - Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(), + Ratings = Enumerable.Range(0,10), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6), }, }, }); @@ -56,29 +56,9 @@ namespace osu.Desktop.VisualTests.Tests private void newRetryAndFailValues() { - details.Beatmap = new BeatmapInfo - { - Version = "VisualTest", - Metadata = new BeatmapMetadata - { - Source = "Some guy", - Tags = "beatmap metadata example with a very very long list of tags and not much creativity", - }, - Difficulty = new BeatmapDifficulty - { - CircleSize = 7, - ApproachRate = 3.5f, - OverallDifficulty = 5.7f, - DrainRate = 1, - }, - StarDifficulty = 5.3f, - Metric = new BeatmapMetric - { - Ratings = Enumerable.Range(0, 10).ToList(), - Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(), - }, - }; + details.Beatmap.Metric.Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6); + details.Beatmap.Metric.Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6); + details.Beatmap = details.Beatmap; lastRange += 100; } } diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetric.cs index 6272e5d6b1..e40da27d1d 100644 --- a/osu.Game/Database/BeatmapMetric.cs +++ b/osu.Game/Database/BeatmapMetric.cs @@ -10,16 +10,16 @@ namespace osu.Game.Database /// /// Ratings for a beatmap, length should be 10 /// - public List Ratings { get; set; } + public IEnumerable Ratings { get; set; } /// /// Fails for a beatmap, length should be 100 /// - public List Fails { get; set; } + public IEnumerable Fails { get; set; } /// /// Retries for a beatmap, length should be 100 /// - public List Retries { get; set; } + public IEnumerable Retries { get; set; } } } diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 41a00d7fec..0b249d857b 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -42,23 +42,22 @@ namespace osu.Game.Graphics.UserInterface { set { - List values = value?.ToList() ?? new List(); - List graphBars = Children.ToList(); - for (int i = 0; i < values.Count; i++) - if (graphBars.Count > i) + List bars = Children.ToList(); + foreach (var bar in value.Select((length, index) => new { Value = length, Bar = bars.Count > index ? bars[index] : null })) + if (bar.Bar != null) { - graphBars[i].Length = values[i] / (MaxValue ?? values.Max()); - graphBars[i].Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1); + bar.Bar.Length = bar.Value / (MaxValue ?? value.Max()); + bar.Bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / value.Count()) : new Vector2(1.0f / value.Count(), 1); } else Add(new Bar { RelativeSizeAxes = Axes.Both, - Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1), - Length = values[i] / (MaxValue ?? values.Max()), + Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / value.Count()) : new Vector2(1.0f / value.Count(), 1), + Length = bar.Value / (MaxValue ?? value.Max()), Direction = Direction, }); - Remove(Children.Where((bar, index) => index >= values.Count).ToList()); + Remove(Children.Where((bar, index) => index >= value.Count()).ToList()); } } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 559f159e49..b5a666e556 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -49,7 +49,6 @@ namespace osu.Game.Screens.Select } set { - if (beatmap == value) return; beatmap = value; description.Text = beatmap.Version; @@ -62,11 +61,9 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings == null) - ratingsContainer.Hide(); - else + if (beatmap.Metric?.Ratings.Count() > 0) { - List ratings = beatmap.Metric.Ratings; + List ratings = beatmap.Metric.Ratings.ToList(); ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); @@ -75,22 +72,24 @@ namespace osu.Game.Screens.Select ratingsGraph.Values = ratings.Select(rating => (float)rating); } - - if (beatmap.Metric?.Retries == null || beatmap.Metric?.Fails == null) - retryFailContainer.Hide(); else + ratingsContainer.Hide(); + + if (beatmap.Metric?.Retries.Count() > 0 && beatmap.Metric?.Retries.Count() > 0) { - List retries = beatmap.Metric.Retries; - List fails = beatmap.Metric.Fails; + IEnumerable retries = beatmap.Metric.Retries; + IEnumerable fails = beatmap.Metric.Fails; retryFailContainer.Show(); - float maxValue = fails.Select((fail, index) => fail + retries[index]).Max(); + float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); failGraph.MaxValue = maxValue; retryGraph.MaxValue = maxValue; failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue)); + retryGraph.Values = retries.Zip(fails, (retry, fail) => retry + MathHelper.Clamp(fail, 0, maxValue)); } + else + retryFailContainer.Hide(); } } From ed2f5d210efe96beac035156f46d5d7c0a2a838c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 22:48:53 +0200 Subject: [PATCH 59/93] condensed some commits because they were small or already reversed --- osu.Game/Graphics/UserInterface/BarGraph.cs | 1 + osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 14 +++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 0b249d857b..d0965a1861 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -57,6 +57,7 @@ namespace osu.Game.Graphics.UserInterface Length = bar.Value / (MaxValue ?? value.Max()), Direction = Direction, }); + //I'm using ToList() here because Where() returns an Enumerable which can change it's elements afterwards Remove(Children.Where((bar, index) => index >= value.Count()).ToList()); } } diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 23d40e0260..ae117254fa 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select { beatmap = value; Leaderboard.Beatmap = beatmap?.BeatmapInfo; - Details.Beatmap = beatmap.Beatmap.BeatmapInfo; + Details.Beatmap = beatmap?.Beatmap.BeatmapInfo; } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index b5a666e556..6f6b2f5880 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -12,7 +12,6 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -50,6 +49,7 @@ namespace osu.Game.Screens.Select set { beatmap = value; + if (beatmap == null) return; description.Text = beatmap.Version; source.Text = beatmap.Metadata.Source; @@ -61,9 +61,9 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings.Count() > 0) + if (beatmap.Metric?.Ratings.Count() == 10) { - List ratings = beatmap.Metric.Ratings.ToList(); + var ratings = beatmap.Metric.Ratings.ToList(); ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); @@ -75,10 +75,10 @@ namespace osu.Game.Screens.Select else ratingsContainer.Hide(); - if (beatmap.Metric?.Retries.Count() > 0 && beatmap.Metric?.Retries.Count() > 0) + if (beatmap.Metric?.Retries.Count() == 100 && beatmap.Metric?.Fails.Count() == 100) { - IEnumerable retries = beatmap.Metric.Retries; - IEnumerable fails = beatmap.Metric.Fails; + var retries = beatmap.Metric.Retries; + var fails = beatmap.Metric.Fails; retryFailContainer.Show(); float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); @@ -111,7 +111,7 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.4f, Direction = FillDirection.Vertical, - LayoutDuration = 1, + LayoutDuration = 200, LayoutEasing = EasingTypes.OutQuint, Padding = new MarginPadding(10) { Top = 25 }, Children = new [] From 50cb9e0fe7968a1f74e758163b080b0aeceb87ea Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Tue, 11 Apr 2017 18:07:54 -0500 Subject: [PATCH 60/93] Match stable search parameters --- osu.Game/Screens/Select/FilterCriteria.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index acf0954418..2654129a44 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -31,7 +31,9 @@ namespace osu.Game.Screens.Select || (set.Metadata.Artist ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 || (set.Metadata.ArtistUnicode ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 || (set.Metadata.Title ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 - || (set.Metadata.TitleUnicode ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1; + || (set.Metadata.TitleUnicode ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 + || (set.Metadata.Tags ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 + || (set.Metadata.Source ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1; switch (g.State) { From dffdb100ab877d6eb241632564886cea37e52dd9 Mon Sep 17 00:00:00 2001 From: Poliwrath Date: Tue, 11 Apr 2017 21:35:49 -0400 Subject: [PATCH 61/93] Small fix to the chat overlay to prevent crashing on the test --- osu.Game/Overlays/ChatOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 0bb3d3dc71..fc12789b05 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays { var postText = sender.Text; - if (!string.IsNullOrEmpty(postText)) + if (!string.IsNullOrEmpty(postText) && api.LocalUser.Value != null) { //todo: actually send to server careChannels.FirstOrDefault()?.AddNewMessages(new[] From 4e2ae72126c304ccbaa69d9ef170370be53889c2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 12:03:51 +0900 Subject: [PATCH 62/93] Implement proper masking support for taiko hit objects. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 36 ++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index db3a1bc84e..5e5344eb6f 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics.Primitives; using System.Linq; using osu.Game.Modes.Taiko.Objects.Drawables; using System; +using osu.Framework.Graphics.OpenGL; namespace osu.Game.Modes.Taiko.UI { @@ -111,9 +112,11 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, }, - hitObjectContainer = new Container + hitObjectContainer = new ExternalMaskingRectangleContainer { RelativeSizeAxes = Axes.Both, + Masking = true, + MaskingReference = () => this }, judgementContainer = new Container { @@ -269,5 +272,36 @@ namespace osu.Game.Modes.Taiko.UI } } } + + private class ExternalMaskingRectangleContainer : Container + { + public Func MaskingReference; + + protected override void ApplyDrawNode(DrawNode node) + { + base.ApplyDrawNode(node); + + Drawable maskingReference = MaskingReference?.Invoke(); + + if (MaskingReference == null) + return; + + var cn = node as ContainerDrawNode; + + cn.MaskingInfo = !Masking + ? (MaskingInfo?)null + : new MaskingInfo + { + ScreenSpaceAABB = maskingReference.ScreenSpaceDrawQuad.AABB, + MaskingRect = maskingReference.DrawRectangle, + ToMaskingSpace = cn.MaskingInfo.Value.ToMaskingSpace, + CornerRadius = cn.MaskingInfo.Value.CornerRadius, + BorderThickness = cn.MaskingInfo.Value.BorderThickness, + BorderColour = cn.MaskingInfo.Value.BorderColour, + BlendRange = cn.MaskingInfo.Value.BlendRange, + AlphaExponent = cn.MaskingInfo.Value.AlphaExponent + }; + } + } } } \ No newline at end of file From a922e677547210566ebf3441a3b6987093f200ea Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 12:04:23 +0900 Subject: [PATCH 63/93] Because Ruleset only exposes HitRenderer, we need to have AspectAdjust in the base class. --- osu.Game/Modes/UI/HitRenderer.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index afc525d686..dd5eff5a95 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -33,6 +33,11 @@ namespace osu.Game.Modes.UI /// public event Action OnAllJudged; + /// + /// Whether to apply adjustments to the child based on our own size. + /// + public bool AspectAdjust = true; + /// /// The input manager for this HitRenderer. /// @@ -168,11 +173,6 @@ namespace osu.Game.Modes.UI { public event Action OnJudgement; - /// - /// Whether to apply adjustments to the child based on our own size. - /// - public bool AspectAdjust = true; - public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor; protected override Container Content => content; From d6fa51dc5cf355168babe725dd87224a39bd894d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 12:06:24 +0900 Subject: [PATCH 64/93] Update SliderBar to use OnUserChange method. --- .../Graphics/UserInterface/OsuSliderBar.cs | 37 ++++++------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 91fb1c672a..38cf8dcef9 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -63,15 +63,6 @@ namespace osu.Game.Graphics.UserInterface rightBox.Colour = colours.Pink; } - private void playSample() - { - if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50) - return; - lastSampleTime = Clock.CurrentTime; - sample.Frequency.Value = 1 + NormalizedValue * 0.2f; - sample.Play(); - } - protected override bool OnHover(InputState state) { nub.Glowing = true; @@ -84,11 +75,19 @@ namespace osu.Game.Graphics.UserInterface base.OnHoverLost(state); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override void OnUserChange() { - if (args.Key == Key.Left || args.Key == Key.Right) - playSample(); - return base.OnKeyDown(state, args); + base.OnUserChange(); + playSample(); + } + + private void playSample() + { + if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50) + return; + lastSampleTime = Clock.CurrentTime; + sample.Frequency.Value = 1 + NormalizedValue * 0.2f; + sample.Play(); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -103,18 +102,6 @@ namespace osu.Game.Graphics.UserInterface return base.OnMouseUp(state, args); } - protected override bool OnClick(InputState state) - { - playSample(); - return base.OnClick(state); - } - - protected override bool OnDrag(InputState state) - { - playSample(); - return base.OnDrag(state); - } - protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); From 2964c04c148b5c1fc39b469de5bdbcf76edd1b49 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 12:06:56 +0900 Subject: [PATCH 65/93] Add special SliderBar sound behaviour when at extents. --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 38cf8dcef9..9781a507cc 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -87,6 +87,17 @@ namespace osu.Game.Graphics.UserInterface return; lastSampleTime = Clock.CurrentTime; sample.Frequency.Value = 1 + NormalizedValue * 0.2f; + + switch (NormalizedValue) + { + case 0: + sample.Frequency.Value -= 0.4f; + break; + case 1: + sample.Frequency.Value += 0.4f; + break; + } + sample.Play(); } From 0c90ef79fa7e710253a48bae685ed5480c5fca47 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 12:36:31 +0900 Subject: [PATCH 66/93] Make TestCaseTaikoPlayfield work again. --- .../Tests/TestCaseTaikoPlayfield.cs | 14 +++++++++----- osu.Game/Modes/UI/Playfield.cs | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index a8e4382ebb..e886af6b83 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -27,6 +27,7 @@ namespace osu.Desktop.VisualTests.Tests private readonly Random rng = new Random(1337); private TaikoPlayfield playfield; + private Container playfieldContainer; public override void Reset() { @@ -51,11 +52,14 @@ namespace osu.Desktop.VisualTests.Tests var rateAdjustClock = new StopwatchClock(true) { Rate = 1 }; - Add(new Container + Add(playfieldContainer = new Container { - Clock = new FramedClock(rateAdjustClock), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, - Y = 200, + Height = TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT, + Width = 0.8f, + Clock = new FramedClock(rateAdjustClock), Children = new[] { playfield = new TaikoPlayfield() @@ -81,11 +85,11 @@ namespace osu.Desktop.VisualTests.Tests break; case 5: addSwell(1000); - playfield.Delay(scroll_time - 100); + playfieldContainer.Delay(scroll_time - 100); break; } - playfield.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); + playfieldContainer.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); } private void addHitJudgement() diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index bf5f0acde5..e8e53ab1f0 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -38,6 +38,9 @@ namespace osu.Game.Modes.UI protected Playfield(float? customWidth = null) { AlwaysReceiveInput = true; + + // Default height since we force RelativeSizeAxes = Both + Size = Vector2.One; AddInternal(ScaledContent = new ScaledContainer { From 04baa9eb7227f94b8de0bf979449d4df01556300 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 12:37:20 +0900 Subject: [PATCH 67/93] Reset stage to normal height after tests. --- .../Tests/TestCaseTaikoPlayfield.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index e886af6b83..a79790f8f8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -49,6 +49,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Height test 3", () => changePlayfieldSize(3)); AddStep("Height test 4", () => changePlayfieldSize(4)); AddStep("Height test 5", () => changePlayfieldSize(5)); + AddStep("Reset height", () => changePlayfieldSize(6)); var rateAdjustClock = new StopwatchClock(true) { Rate = 1 }; @@ -69,6 +70,7 @@ namespace osu.Desktop.VisualTests.Tests private void changePlayfieldSize(int step) { + // Add new hits switch (step) { case 1: @@ -89,7 +91,16 @@ namespace osu.Desktop.VisualTests.Tests break; } + // Tween playfield height + switch (step) + { + default: playfieldContainer.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); + break; + case 6: + playfieldContainer.ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT), 500); + break; + } } private void addHitJudgement() From 5d5040ee7326ff389e75d22b8949bd135fca6a6b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 14:34:49 +0900 Subject: [PATCH 68/93] Better masking. --- .../Tests/TestCaseTaikoPlayfield.cs | 8 ++- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 53 +++++++------------ 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index a79790f8f8..c8c264083c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -4,6 +4,7 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Framework.Timing; @@ -63,7 +64,12 @@ namespace osu.Desktop.VisualTests.Tests Clock = new FramedClock(rateAdjustClock), Children = new[] { - playfield = new TaikoPlayfield() + playfield = new TaikoPlayfield + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Height = 0.75f + } } }); } diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 5e5344eb6f..eccf4aff09 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -53,6 +53,8 @@ namespace osu.Game.Modes.Taiko.UI public TaikoPlayfield() { + Masking = true; + AddInternal(new Drawable[] { rightBackgroundContainer = new Container @@ -112,11 +114,9 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, }, - hitObjectContainer = new ExternalMaskingRectangleContainer + hitObjectContainer = new Container { RelativeSizeAxes = Axes.Both, - Masking = true, - MaskingReference = () => this }, judgementContainer = new Container { @@ -222,6 +222,22 @@ namespace osu.Game.Modes.Taiko.UI hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); } + protected override void ApplyDrawNode(DrawNode node) + { + base.ApplyDrawNode(node); + + var cn = node as ContainerDrawNode; + + if (!Masking) + return; + + MaskingInfo old = cn.MaskingInfo.Value; + old.MaskingRect = new RectangleF(old.MaskingRect.X, old.MaskingRect.Y - 2000, old.MaskingRect.Width, old.MaskingRect.Height + 4000); + old.ScreenSpaceAABB = new System.Drawing.Rectangle(old.ScreenSpaceAABB.X, old.ScreenSpaceAABB.Y - 2000, old.ScreenSpaceAABB.Width, old.ScreenSpaceAABB.Height + 4000); + + cn.MaskingInfo = old; + } + /// /// This is a very special type of container. It serves a similar purpose to , however unlike , /// this will only adjust the scale relative to the height of its parent and will maintain the original width relative to its parent. @@ -272,36 +288,5 @@ namespace osu.Game.Modes.Taiko.UI } } } - - private class ExternalMaskingRectangleContainer : Container - { - public Func MaskingReference; - - protected override void ApplyDrawNode(DrawNode node) - { - base.ApplyDrawNode(node); - - Drawable maskingReference = MaskingReference?.Invoke(); - - if (MaskingReference == null) - return; - - var cn = node as ContainerDrawNode; - - cn.MaskingInfo = !Masking - ? (MaskingInfo?)null - : new MaskingInfo - { - ScreenSpaceAABB = maskingReference.ScreenSpaceDrawQuad.AABB, - MaskingRect = maskingReference.DrawRectangle, - ToMaskingSpace = cn.MaskingInfo.Value.ToMaskingSpace, - CornerRadius = cn.MaskingInfo.Value.CornerRadius, - BorderThickness = cn.MaskingInfo.Value.BorderThickness, - BorderColour = cn.MaskingInfo.Value.BorderColour, - BlendRange = cn.MaskingInfo.Value.BlendRange, - AlphaExponent = cn.MaskingInfo.Value.AlphaExponent - }; - } - } } } \ No newline at end of file From 7a24e5f5090a5bfe0c7b80bde70d15be187f7b82 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 15:00:18 +0900 Subject: [PATCH 69/93] Revert "Implement proper masking support for taiko hit objects." This reverts commit 4e2ae72126c304ccbaa69d9ef170370be53889c2. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index eccf4aff09..cc5dad84cd 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -17,7 +17,6 @@ using osu.Framework.Graphics.Primitives; using System.Linq; using osu.Game.Modes.Taiko.Objects.Drawables; using System; -using osu.Framework.Graphics.OpenGL; namespace osu.Game.Modes.Taiko.UI { From 32c3e34eb77758f4f03fe5671ae2380417ef3fd5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 15:00:26 +0900 Subject: [PATCH 70/93] Revert "Better masking." This reverts commit 5d5040ee7326ff389e75d22b8949bd135fca6a6b. --- .../Tests/TestCaseTaikoPlayfield.cs | 8 +-- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 53 ++++++++++++------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index c8c264083c..a79790f8f8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -4,7 +4,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Framework.Timing; @@ -64,12 +63,7 @@ namespace osu.Desktop.VisualTests.Tests Clock = new FramedClock(rateAdjustClock), Children = new[] { - playfield = new TaikoPlayfield - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Height = 0.75f - } + playfield = new TaikoPlayfield() } }); } diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index cc5dad84cd..a809cf338d 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -52,8 +52,6 @@ namespace osu.Game.Modes.Taiko.UI public TaikoPlayfield() { - Masking = true; - AddInternal(new Drawable[] { rightBackgroundContainer = new Container @@ -113,9 +111,11 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, }, - hitObjectContainer = new Container + hitObjectContainer = new ExternalMaskingRectangleContainer { RelativeSizeAxes = Axes.Both, + Masking = true, + MaskingReference = () => this }, judgementContainer = new Container { @@ -221,22 +221,6 @@ namespace osu.Game.Modes.Taiko.UI hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); } - protected override void ApplyDrawNode(DrawNode node) - { - base.ApplyDrawNode(node); - - var cn = node as ContainerDrawNode; - - if (!Masking) - return; - - MaskingInfo old = cn.MaskingInfo.Value; - old.MaskingRect = new RectangleF(old.MaskingRect.X, old.MaskingRect.Y - 2000, old.MaskingRect.Width, old.MaskingRect.Height + 4000); - old.ScreenSpaceAABB = new System.Drawing.Rectangle(old.ScreenSpaceAABB.X, old.ScreenSpaceAABB.Y - 2000, old.ScreenSpaceAABB.Width, old.ScreenSpaceAABB.Height + 4000); - - cn.MaskingInfo = old; - } - /// /// This is a very special type of container. It serves a similar purpose to , however unlike , /// this will only adjust the scale relative to the height of its parent and will maintain the original width relative to its parent. @@ -287,5 +271,36 @@ namespace osu.Game.Modes.Taiko.UI } } } + + private class ExternalMaskingRectangleContainer : Container + { + public Func MaskingReference; + + protected override void ApplyDrawNode(DrawNode node) + { + base.ApplyDrawNode(node); + + Drawable maskingReference = MaskingReference?.Invoke(); + + if (MaskingReference == null) + return; + + var cn = node as ContainerDrawNode; + + cn.MaskingInfo = !Masking + ? (MaskingInfo?)null + : new MaskingInfo + { + ScreenSpaceAABB = maskingReference.ScreenSpaceDrawQuad.AABB, + MaskingRect = maskingReference.DrawRectangle, + ToMaskingSpace = cn.MaskingInfo.Value.ToMaskingSpace, + CornerRadius = cn.MaskingInfo.Value.CornerRadius, + BorderThickness = cn.MaskingInfo.Value.BorderThickness, + BorderColour = cn.MaskingInfo.Value.BorderColour, + BlendRange = cn.MaskingInfo.Value.BlendRange, + AlphaExponent = cn.MaskingInfo.Value.AlphaExponent + }; + } + } } } \ No newline at end of file From 50a598dd05cbd3dd77a8cdea41a647c42f7ad438 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 15:01:17 +0900 Subject: [PATCH 71/93] Revert another masking container. --- .../Tests/TestCaseTaikoPlayfield.cs | 1 - osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 35 +------------------ 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index a79790f8f8..4e9ff4980e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -59,7 +59,6 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Height = TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT, - Width = 0.8f, Clock = new FramedClock(rateAdjustClock), Children = new[] { diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index a809cf338d..db3a1bc84e 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -111,11 +111,9 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, }, - hitObjectContainer = new ExternalMaskingRectangleContainer + hitObjectContainer = new Container { RelativeSizeAxes = Axes.Both, - Masking = true, - MaskingReference = () => this }, judgementContainer = new Container { @@ -271,36 +269,5 @@ namespace osu.Game.Modes.Taiko.UI } } } - - private class ExternalMaskingRectangleContainer : Container - { - public Func MaskingReference; - - protected override void ApplyDrawNode(DrawNode node) - { - base.ApplyDrawNode(node); - - Drawable maskingReference = MaskingReference?.Invoke(); - - if (MaskingReference == null) - return; - - var cn = node as ContainerDrawNode; - - cn.MaskingInfo = !Masking - ? (MaskingInfo?)null - : new MaskingInfo - { - ScreenSpaceAABB = maskingReference.ScreenSpaceDrawQuad.AABB, - MaskingRect = maskingReference.DrawRectangle, - ToMaskingSpace = cn.MaskingInfo.Value.ToMaskingSpace, - CornerRadius = cn.MaskingInfo.Value.CornerRadius, - BorderThickness = cn.MaskingInfo.Value.BorderThickness, - BorderColour = cn.MaskingInfo.Value.BorderColour, - BlendRange = cn.MaskingInfo.Value.BlendRange, - AlphaExponent = cn.MaskingInfo.Value.AlphaExponent - }; - } - } } } \ No newline at end of file From f8076ec79252132b62c509e5986dcae0ba463e5b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 15:04:11 +0900 Subject: [PATCH 72/93] Better comment. --- osu.Game/Modes/UI/Playfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index e8e53ab1f0..27bc3baa3e 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -39,7 +39,7 @@ namespace osu.Game.Modes.UI { AlwaysReceiveInput = true; - // Default height since we force RelativeSizeAxes = Both + // Default height since we force relative size axes Size = Vector2.One; AddInternal(ScaledContent = new ScaledContainer From 6ab274abc0cd5f4128ac07976753c9c50188182f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 12 Apr 2017 15:06:46 +0900 Subject: [PATCH 73/93] Trim whitespace --- osu.Game/Modes/UI/Playfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index 27bc3baa3e..1e7cf6579c 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -38,7 +38,7 @@ namespace osu.Game.Modes.UI protected Playfield(float? customWidth = null) { AlwaysReceiveInput = true; - + // Default height since we force relative size axes Size = Vector2.One; From 8cad09370d527dd421c2383790459f1fc258943e Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 00:20:41 -0700 Subject: [PATCH 74/93] Fixed pause and fail screen overlap --- osu.Game/Screens/Play/Player.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e2712a64e4..2a18d44248 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -273,6 +273,11 @@ namespace osu.Game.Screens.Play private void onFail() { + if (IsPaused) + { + pauseOverlay.Hide(); + IsPaused = false; + } sourceClock.Stop(); Delay(500); From d2affe68675131ced3e0354607c4bb917e01bf5b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 12 Apr 2017 10:52:24 +0200 Subject: [PATCH 75/93] requested changes --- osu.Game/Graphics/UserInterface/Bar.cs | 1 + osu.Game/Screens/Select/BeatmapDetails.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 07aafbb655..76b75f1084 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -86,6 +86,7 @@ namespace osu.Game.Graphics.UserInterface bar = new Box { RelativeSizeAxes = Axes.Both, + Width = 0, }, }; } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 6f6b2f5880..990ecabdb5 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -180,7 +180,12 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Padding = new MarginPadding(15) { Top = 25, Bottom = 0 }, + Padding = new MarginPadding + { + Top = 25, + Left = 15, + Right = 15, + }, Children = new Drawable[] { new OsuSpriteText @@ -194,7 +199,6 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.X, Height = 5, - Length = 0, }, new Container { From e285d33f8cfe0658f458541805a32a3f7d775a14 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 12 Apr 2017 11:05:10 +0200 Subject: [PATCH 76/93] fails, retries and size not enforced --- osu.Game/Screens/Select/BeatmapDetails.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 990ecabdb5..1479ef35ce 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -61,21 +61,21 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings.Count() == 10) + if (beatmap.Metric?.Ratings.Any() ?? false) { var ratings = beatmap.Metric.Ratings.ToList(); ratingsContainer.Show(); - negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); - positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); - ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); + negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2).Sum().ToString(); + positiveRatings.Text = ratings.GetRange(ratings.Count / 2, ratings.Count / 2).Sum().ToString(); + ratingsBar.Length = (float)ratings.GetRange(0, ratings.Count / 2).Sum() / ratings.Sum(); ratingsGraph.Values = ratings.Select(rating => (float)rating); } else ratingsContainer.Hide(); - if (beatmap.Metric?.Retries.Count() == 100 && beatmap.Metric?.Fails.Count() == 100) + if ((beatmap.Metric?.Retries.Any() ?? false) && (beatmap.Metric?.Fails.Any() ?? false)) { var retries = beatmap.Metric.Retries; var fails = beatmap.Metric.Fails; From 98ce9e072410554620f4082748d4f4d209cc65e4 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 12 Apr 2017 11:25:32 +0200 Subject: [PATCH 77/93] remove ?? --- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 1479ef35ce..0d3a9ba9ee 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select else ratingsContainer.Hide(); - if ((beatmap.Metric?.Retries.Any() ?? false) && (beatmap.Metric?.Fails.Any() ?? false)) + if ((beatmap.Metric?.Retries.Any() ?? false) && beatmap.Metric.Fails.Any()) { var retries = beatmap.Metric.Retries; var fails = beatmap.Metric.Fails; From 348dd7140662e164d103afeda23c621363c1e443 Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 02:43:42 -0700 Subject: [PATCH 78/93] Fixed repeat keys working for resuming --- osu.Game/Screens/Play/PauseOverlay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index f9706d263e..6088e2fea5 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -20,6 +20,7 @@ namespace osu.Game.Screens.Play protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { + if (args.Repeat) return false; if (args.Key == Key.Escape) { if (State == Visibility.Hidden) return false; From d250dde537ff671321c5f845da50cff64790af58 Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 02:50:03 -0700 Subject: [PATCH 79/93] Fixed repeat keys working for retrying --- osu.Game/Screens/Play/FailOverlay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 7a32e19338..1cd34e45e7 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -17,6 +17,7 @@ namespace osu.Game.Screens.Play public override string Description => "you're dead, try again?"; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { + if (args.Repeat) return false; if (args.Key == Key.Escape) { if (State == Visibility.Hidden) return false; From c0338a82e76424fafc128c72d63491b8a12b5d7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 19:20:30 +0900 Subject: [PATCH 80/93] Update nuget packages. Includes fix in OpenTK for focus issues. --- osu-framework | 2 +- osu.Desktop.Deploy/App.config | 12 ++++++++++++ osu.Desktop.Deploy/osu.Desktop.Deploy.csproj | 7 +++---- osu.Desktop.Deploy/packages.config | 2 +- osu.Desktop.Tests/osu.Desktop.Tests.csproj | 11 +++++------ osu.Desktop.Tests/packages.config | 5 ++--- .../osu.Desktop.VisualTests.csproj | 16 +++++++--------- osu.Desktop.VisualTests/packages.config | 6 +++--- osu.Desktop/osu.Desktop.csproj | 3 +-- osu.Desktop/packages.config | 2 +- osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj | 5 ++--- osu.Game.Modes.Catch/packages.config | 2 +- osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj | 5 ++--- osu.Game.Modes.Mania/packages.config | 2 +- osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj | 5 ++--- osu.Game.Modes.Osu/packages.config | 2 +- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 5 ++--- osu.Game.Modes.Taiko/packages.config | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 8 +++----- osu.Game.Tests/packages.config | 5 ++--- osu.Game/osu.Game.csproj | 15 ++++++--------- osu.Game/packages.config | 7 +++---- 22 files changed, 62 insertions(+), 67 deletions(-) diff --git a/osu-framework b/osu-framework index 4caf0c918e..34ac837eeb 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4caf0c918edfd9d3be0358e2b2cfc4d40908e330 +Subproject commit 34ac837eebeecd0b6f35829780f2123f6b8cc698 diff --git a/osu.Desktop.Deploy/App.config b/osu.Desktop.Deploy/App.config index d1da144f50..45685a74a8 100644 --- a/osu.Desktop.Deploy/App.config +++ b/osu.Desktop.Deploy/App.config @@ -21,4 +21,16 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste + + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj index 7a3719a25b..901117b026 100644 --- a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj +++ b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj @@ -68,9 +68,8 @@ $(SolutionDir)\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll True - - $(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True + + $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll $(SolutionDir)\packages\squirrel.windows.1.5.2\lib\Net45\NuGet.Squirrel.dll @@ -120,7 +119,7 @@ - - - + + diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index da068c5557..f0c137578a 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -83,22 +83,20 @@ - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + + $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - - ..\packages\SharpCompress.0.15.1\lib\net45\SharpCompress.dll - True + + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + + $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll False $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll - - $(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\SQLiteNetExtensions.1.3.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\SQLiteNetExtensions.dll diff --git a/osu.Desktop.VisualTests/packages.config b/osu.Desktop.VisualTests/packages.config index 5a30c50600..cad2ffff0d 100644 --- a/osu.Desktop.VisualTests/packages.config +++ b/osu.Desktop.VisualTests/packages.config @@ -4,9 +4,9 @@ Copyright (c) 2007-2017 ppy Pty Ltd . Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE --> - - - + + + diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index fbc342d695..dbd26b4640 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -124,8 +124,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll $(SolutionDir)\packages\Splat.2.0.0\lib\Net45\Splat.dll diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index be9b65f0c6..60e8182c82 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -7,7 +7,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + \ No newline at end of file diff --git a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj index 593d8db4f6..50b1a095af 100644 --- a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj +++ b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj @@ -33,8 +33,7 @@ - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll @@ -84,7 +83,7 @@ - - + \ No newline at end of file diff --git a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj index cc925d417a..896e9c68c6 100644 --- a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj +++ b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj @@ -33,8 +33,7 @@ - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll @@ -89,7 +88,7 @@ - - + \ No newline at end of file diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj index 55322e855e..21f0f03d8c 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj @@ -34,8 +34,7 @@ - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll @@ -104,7 +103,7 @@ - - + \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index d0981c2500..19ba5c77e4 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -33,8 +33,7 @@ - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll @@ -112,7 +111,7 @@ - - + \ 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 d01aa77e02..2844528d0c 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -29,13 +29,11 @@ false - - $(SolutionDir)\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll - True + + $(SolutionDir)\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index ca53ef08b0..9972fb41a1 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -1,12 +1,11 @@  - - - + + \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d90fdda41a..12410563cd 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,17 +35,14 @@ false - - $(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True + + $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll - - ..\packages\SharpCompress.0.15.1\lib\net45\SharpCompress.dll - True + + $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll @@ -389,7 +386,7 @@ - - - - + + + From ec6267c5b2a97873cfc3f47d5343bb1ed66b66d7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 19:41:11 +0900 Subject: [PATCH 81/93] switch -> if. --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 9781a507cc..7895ae0aa4 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -88,15 +88,10 @@ namespace osu.Game.Graphics.UserInterface lastSampleTime = Clock.CurrentTime; sample.Frequency.Value = 1 + NormalizedValue * 0.2f; - switch (NormalizedValue) - { - case 0: - sample.Frequency.Value -= 0.4f; - break; - case 1: - sample.Frequency.Value += 0.4f; - break; - } + if (NormalizedValue == 0) + sample.Frequency.Value -= 0.4f; + else if (NormalizedValue == 1) + sample.Frequency.Value += 0.4f; sample.Play(); } From 6c6ef946bde3fc2cdd357d1dfb0b361af49919fe Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 04:01:52 -0700 Subject: [PATCH 82/93] Some more clean up --- osu.Game/Screens/Play/FailOverlay.cs | 12 --------- osu.Game/Screens/Play/PauseOverlay.cs | 1 - osu.Game/Screens/Play/Player.cs | 36 +++++++-------------------- 3 files changed, 9 insertions(+), 40 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 1cd34e45e7..1c0e01201e 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -15,18 +15,6 @@ namespace osu.Game.Screens.Play public override string Header => "failed"; public override string Description => "you're dead, try again?"; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Repeat) return false; - if (args.Key == Key.Escape) - { - if (State == Visibility.Hidden) return false; - OnQuit(); - return true; - } - - return base.OnKeyDown(state, args); - } [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 6088e2fea5..c8439b33e0 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -23,7 +23,6 @@ namespace osu.Game.Screens.Play if (args.Repeat) return false; if (args.Key == Key.Escape) { - if (State == Visibility.Hidden) return false; OnResume(); return true; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2a18d44248..2ae809a7c2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play public BeatmapInfo BeatmapInfo; - public bool IsPaused { get; private set; } + public bool IsPaused => !sourceClock.IsRunning; public bool HasFailed { get; private set; } @@ -204,19 +204,13 @@ namespace osu.Game.Screens.Play public void Pause(bool force = false) { - if (canPause || force) - { - lastPauseActionTime = Time.Current; - hudOverlay.KeyCounter.IsCounting = false; - pauseOverlay.Retries = RestartCount; - pauseOverlay.Show(); - sourceClock.Stop(); - IsPaused = true; - } - else - { - IsPaused = false; - } + if (!canPause && !force) return; + + lastPauseActionTime = Time.Current; + hudOverlay.KeyCounter.IsCounting = false; + pauseOverlay.Retries = RestartCount; + pauseOverlay.Show(); + sourceClock.Stop(); } public void Resume() @@ -225,13 +219,6 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.IsCounting = true; pauseOverlay.Hide(); sourceClock.Start(); - IsPaused = false; - } - - public void TogglePaused() - { - IsPaused = !IsPaused; - if (IsPaused) Pause(); else Resume(); } public void Restart() @@ -273,11 +260,6 @@ namespace osu.Game.Screens.Play private void onFail() { - if (IsPaused) - { - pauseOverlay.Hide(); - IsPaused = false; - } sourceClock.Stop(); Delay(500); @@ -331,7 +313,7 @@ namespace osu.Game.Screens.Play //pause screen override logic. if (pauseOverlay?.State == Visibility.Hidden && !canPause) return true; - if (!IsPaused && sourceClock.IsRunning) // For if the user presses escape quickly when entering the map + if (!IsPaused) // For if the user presses escape quickly when entering the map { Pause(); return true; From 5bf71aae9c96fef30a8615eecbb3143129c9803d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 12 Apr 2017 20:14:12 +0900 Subject: [PATCH 83/93] Remove unused using. --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 7895ae0aa4..180cb88707 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; From 32b87d12b58ce23133f83fcd437e7ceca2e5d2ca Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 04:54:24 -0700 Subject: [PATCH 84/93] Removed unneeded `using` --- osu.Game/Screens/Play/FailOverlay.cs | 3 --- osu.Game/Screens/Play/PauseOverlay.cs | 1 - 2 files changed, 4 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 1c0e01201e..3225695cb7 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -1,9 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; -using osu.Framework.Input; -using OpenTK.Input; using osu.Game.Graphics; using OpenTK.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index c8439b33e0..3b06b1c84f 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -5,7 +5,6 @@ using System; using osu.Framework.Input; using osu.Game.Graphics; using OpenTK.Input; -using osu.Framework.Graphics.Containers; using OpenTK.Graphics; using osu.Framework.Allocation; From 00cd2c8372a0a50058a2f01f00a9cdc978915950 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 21:08:28 +0900 Subject: [PATCH 85/93] Better comments. --- osu.Game/Database/BeatmapMetric.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetric.cs index e40da27d1d..ae21bc4170 100644 --- a/osu.Game/Database/BeatmapMetric.cs +++ b/osu.Game/Database/BeatmapMetric.cs @@ -8,17 +8,17 @@ namespace osu.Game.Database public class BeatmapMetric { /// - /// Ratings for a beatmap, length should be 10 + /// Total vote counts of user ratings on a scale of 0..length. /// public IEnumerable Ratings { get; set; } /// - /// Fails for a beatmap, length should be 100 + /// Points of failure on a relative time scale (usually 0..100). /// public IEnumerable Fails { get; set; } /// - /// Retries for a beatmap, length should be 100 + /// Points of retry on a relative time scale (usually 0..100). /// public IEnumerable Retries { get; set; } } From 2c3fa303862e93c539fc6789d0b8d18fda6ff134 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 21:09:39 +0900 Subject: [PATCH 86/93] Metric -> Metrics. --- .../Tests/TestCaseBeatmapDetails.cs | 6 +++--- osu.Game/Database/BeatmapInfo.cs | 2 +- .../Database/{BeatmapMetric.cs => BeatmapMetrics.cs} | 5 ++++- osu.Game/Screens/Select/BeatmapDetails.cs | 10 +++++----- osu.Game/osu.Game.csproj | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) rename osu.Game/Database/{BeatmapMetric.cs => BeatmapMetrics.cs} (80%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 7cf42b966a..4a59ad9534 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -40,7 +40,7 @@ namespace osu.Desktop.VisualTests.Tests DrainRate = 1, }, StarDifficulty = 5.3f, - Metric = new BeatmapMetric + Metrics = new BeatmapMetrics { Ratings = Enumerable.Range(0,10), Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6), @@ -56,8 +56,8 @@ namespace osu.Desktop.VisualTests.Tests private void newRetryAndFailValues() { - details.Beatmap.Metric.Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6); - details.Beatmap.Metric.Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6); + details.Beatmap.Metrics.Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6); + details.Beatmap.Metrics.Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6); details.Beatmap = details.Beatmap; lastRange += 100; } diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 7dc62d64e8..3e84825919 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -42,7 +42,7 @@ namespace osu.Game.Database public BeatmapDifficulty Difficulty { get; set; } [Ignore] - public BeatmapMetric Metric { get; set; } + public BeatmapMetrics Metrics { get; set; } public string Path { get; set; } diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetrics.cs similarity index 80% rename from osu.Game/Database/BeatmapMetric.cs rename to osu.Game/Database/BeatmapMetrics.cs index ae21bc4170..91320110d0 100644 --- a/osu.Game/Database/BeatmapMetric.cs +++ b/osu.Game/Database/BeatmapMetrics.cs @@ -5,7 +5,10 @@ using System.Collections.Generic; namespace osu.Game.Database { - public class BeatmapMetric + /// + /// Beatmap metrics based on acculumated online data from community plays. + /// + public class BeatmapMetrics { /// /// Total vote counts of user ratings on a scale of 0..length. diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 0d3a9ba9ee..a0d15101e0 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -61,9 +61,9 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings.Any() ?? false) + if (beatmap.Metrics?.Ratings.Any() ?? false) { - var ratings = beatmap.Metric.Ratings.ToList(); + var ratings = beatmap.Metrics.Ratings.ToList(); ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2).Sum().ToString(); @@ -75,10 +75,10 @@ namespace osu.Game.Screens.Select else ratingsContainer.Hide(); - if ((beatmap.Metric?.Retries.Any() ?? false) && beatmap.Metric.Fails.Any()) + if ((beatmap.Metrics?.Retries.Any() ?? false) && beatmap.Metrics.Fails.Any()) { - var retries = beatmap.Metric.Retries; - var fails = beatmap.Metric.Fails; + var retries = beatmap.Metrics.Retries; + var fails = beatmap.Metrics.Fails; retryFailContainer.Show(); float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 76ec4d3387..578704f4f8 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -76,7 +76,7 @@ - + From 94bf1d65b617a8d3c9d40078be0b51440bf14f80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 11:41:08 +0900 Subject: [PATCH 87/93] Fix thread race conditions on pausing close to a fail. --- osu.Game/Screens/Play/Player.cs | 36 ++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2ae809a7c2..1bab7cddde 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play private const double pause_cooldown = 1000; private double lastPauseActionTime; - private bool canPause => Time.Current >= lastPauseActionTime + pause_cooldown; + private bool canPause => ValidForResume && !HasFailed && Time.Current >= lastPauseActionTime + pause_cooldown; private IAdjustableClock sourceClock; private IFrameBasedClock interpolatedSourceClock; @@ -206,11 +206,28 @@ namespace osu.Game.Screens.Play { if (!canPause && !force) return; - lastPauseActionTime = Time.Current; - hudOverlay.KeyCounter.IsCounting = false; - pauseOverlay.Retries = RestartCount; - pauseOverlay.Show(); sourceClock.Stop(); + + // the actual pausing is potentially happening on a different thread. + // we want to wait for the source clock to stop so we can be sure all components are in a stable state. + if (!IsPaused) + { + Schedule(() => Pause(force)); + return; + } + + // we need to do a final check after all of our children have processed up to the paused clock time. + // this is to cover cases where, for instance, the player fails in the last processed frame (which would change canPause). + // as the scheduler runs before children updates, let's schedule for the next frame. + Schedule(() => + { + if (!canPause) return; + + lastPauseActionTime = Time.Current; + hudOverlay.KeyCounter.IsCounting = false; + pauseOverlay.Retries = RestartCount; + pauseOverlay.Show(); + }); } public void Resume() @@ -227,11 +244,11 @@ namespace osu.Game.Screens.Play var newPlayer = new Player(); + ValidForResume = false; + LoadComponentAsync(newPlayer, delegate { newPlayer.RestartCount = RestartCount + 1; - ValidForResume = false; - if (!Push(newPlayer)) { // Error(?) @@ -247,10 +264,11 @@ namespace osu.Game.Screens.Play if (scoreProcessor.HasFailed || onCompletionEvent != null) return; + ValidForResume = false; + Delay(1000); onCompletionEvent = Schedule(delegate { - ValidForResume = false; Push(new Results { Score = scoreProcessor.CreateScore() @@ -262,8 +280,6 @@ namespace osu.Game.Screens.Play { sourceClock.Stop(); - Delay(500); - HasFailed = true; failOverlay.Retries = RestartCount; failOverlay.Show(); From 359fea7e25f40013fdff1797e70710e01ec80e89 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 11:35:36 +0900 Subject: [PATCH 88/93] Improve "escape" pressing logic in pause/fail menus. --- osu.Game/Screens/Play/FailOverlay.cs | 25 ++++++++++++------------- osu.Game/Screens/Play/MenuOverlay.cs | 7 ++++--- osu.Game/Screens/Play/PauseOverlay.cs | 8 +++----- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 7a32e19338..faff687ddb 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -1,31 +1,19 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; using osu.Framework.Input; using OpenTK.Input; using osu.Game.Graphics; using OpenTK.Graphics; using osu.Framework.Allocation; +using System.Linq; namespace osu.Game.Screens.Play { public class FailOverlay : MenuOverlay { - public override string Header => "failed"; public override string Description => "you're dead, try again?"; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Key == Key.Escape) - { - if (State == Visibility.Hidden) return false; - OnQuit(); - return true; - } - - return base.OnKeyDown(state, args); - } [BackgroundDependencyLoader] private void load(OsuColour colours) @@ -33,5 +21,16 @@ namespace osu.Game.Screens.Play AddButton("Retry", colours.YellowDark, OnRetry); AddButton("Quit", new Color4(170, 27, 39, 255), OnQuit); } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (!args.Repeat && args.Key == Key.Escape) + { + Buttons.Children.Last().TriggerClick(); + return true; + } + + return base.OnKeyDown(state, args); + } } } diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index ede49065a7..379df0a2a2 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -13,6 +13,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics; using osu.Framework.Allocation; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Play { @@ -30,7 +31,7 @@ namespace osu.Game.Screens.Play public abstract string Header { get; } public abstract string Description { get; } - private FillFlowContainer buttons; + protected FillFlowContainer Buttons; public int Retries { @@ -84,7 +85,7 @@ namespace osu.Game.Screens.Play protected void AddButton(string text, Color4 colour, Action action) { - buttons.Add(new PauseButton + Buttons.Add(new PauseButton { Text = text, ButtonColour = colour, @@ -151,7 +152,7 @@ namespace osu.Game.Screens.Play } } }, - buttons = new FillFlowContainer + Buttons = new FillFlowContainer { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index f9706d263e..9561979751 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using osu.Framework.Input; using osu.Game.Graphics; using OpenTK.Input; -using osu.Framework.Graphics.Containers; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -20,10 +20,9 @@ namespace osu.Game.Screens.Play protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { - if (args.Key == Key.Escape) + if (!args.Repeat && args.Key == Key.Escape) { - if (State == Visibility.Hidden) return false; - OnResume(); + Buttons.Children.First().TriggerClick(); return true; } @@ -39,4 +38,3 @@ namespace osu.Game.Screens.Play } } } - \ No newline at end of file From 1f4e0b0251c09a6f38c70f229b6b651792706de6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 12:41:08 +0900 Subject: [PATCH 89/93] Fix MosueUp and HighResolution events not being handled by MenuOverlays. --- osu.Game/Screens/Play/MenuOverlay.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index 379df0a2a2..738e5cc35d 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -17,7 +17,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Play { - public abstract class MenuOverlay : OverlayContainer + public abstract class MenuOverlay : OverlayContainer, IRequireHighFrequencyMousePosition { private const int transition_duration = 200; private const int button_height = 70; @@ -81,6 +81,8 @@ namespace osu.Game.Screens.Play // Don't let mouse down events through the overlay or people can click circles while paused. protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => true; + protected override bool OnMouseMove(InputState state) => true; protected void AddButton(string text, Color4 colour, Action action) From 13f057f900b36bf78b15cd3d9385e9777da40b83 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 14:13:53 +0900 Subject: [PATCH 90/93] Give CursorTrail its own clock for the time being. --- osu.Game/Graphics/Cursor/CursorTrail.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index 4b5610e840..09d1b99d13 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.OpenGL.Buffers; using OpenTK.Graphics.ES30; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Colour; +using osu.Framework.Timing; namespace osu.Game.Graphics.Cursor { @@ -58,6 +59,9 @@ namespace osu.Game.Graphics.Cursor public CursorTrail() { + // as we are currently very dependent on having a running clock, let's make our own clock for the time being. + Clock = new FramedClock(); + AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; @@ -231,4 +235,4 @@ namespace osu.Game.Graphics.Cursor } } } -} \ No newline at end of file +} From 5f8baf874dd6907d612fdde8b7d6485d24678e93 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 18:31:23 +0900 Subject: [PATCH 91/93] Use interpolatedSourceClock's IsRunning value for consistency. --- osu.Game/Screens/Play/Player.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 1bab7cddde..7f43ae2ac3 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play public BeatmapInfo BeatmapInfo; - public bool IsPaused => !sourceClock.IsRunning; + public bool IsPaused => !interpolatedSourceClock.IsRunning; public bool HasFailed { get; private set; } @@ -206,12 +206,12 @@ namespace osu.Game.Screens.Play { if (!canPause && !force) return; - sourceClock.Stop(); - // the actual pausing is potentially happening on a different thread. // we want to wait for the source clock to stop so we can be sure all components are in a stable state. if (!IsPaused) { + sourceClock.Stop(); + Schedule(() => Pause(force)); return; } From 262a2c9f0e093b416d1f0b61083ec5dae119624c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 19:01:15 +0900 Subject: [PATCH 92/93] Add exception for failing. --- osu.Game/Screens/Play/Player.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7f43ae2ac3..01d5d0770a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -324,6 +324,9 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { + if (HasFailed || !ValidForResume) + return false; + if (pauseOverlay != null && !HitRenderer.HasReplayLoaded) { //pause screen override logic. From e62922ba6454eadc85988b25b93a2a4dc43c5704 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 00:57:57 +0900 Subject: [PATCH 93/93] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 34ac837eeb..2234013e59 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 34ac837eebeecd0b6f35829780f2123f6b8cc698 +Subproject commit 2234013e59a99116ee9f9e56a95ff8a6667db2a7