From d10dcd82bc572c3914b5989f0b3307e45351eee4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 02:39:48 +0300 Subject: [PATCH 01/36] Rank Line Graph improvements --- osu.Game/Overlays/Profile/RankChart.cs | 122 +++++++++++++++---------- 1 file changed, 75 insertions(+), 47 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 2e2286098a..b8690efa2a 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -24,6 +24,7 @@ namespace osu.Game.Overlays.Profile private readonly RankChartLineGraph graph; private readonly int[] ranks; + private readonly int rankedDays; private const float primary_textsize = 25, secondary_textsize = 13, padding = 10; @@ -33,6 +34,10 @@ namespace osu.Game.Overlays.Profile { this.user = user; + int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank }; + ranks = userRanks.SkipWhile(x => x == 0).ToArray(); + rankedDays = ranks.Length; + Padding = new MarginPadding { Vertical = padding }; Children = new Drawable[] { @@ -64,13 +69,12 @@ namespace osu.Game.Overlays.Profile Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, Y = -secondary_textsize, - DefaultValueCount = 90, - BallRelease = updateRankTexts, - BallMove = showHistoryRankTexts + DefaultValueCount = rankedDays, } }; - ranks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank }; + graph.OnBallMove += showHistoryRankTexts; + graph.OnReset += updateRankTexts; } private void updateRankTexts() @@ -82,8 +86,8 @@ namespace osu.Game.Overlays.Profile private void showHistoryRankTexts(int dayIndex) { - rankText.Text = ranks[dayIndex] > 0 ? $"#{ranks[dayIndex]:#,0}" : "no rank"; - relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago"; + rankText.Text = $"#{ranks[dayIndex]:#,0}"; + relativeText.Text = dayIndex == rankedDays ? "Now" : $"{rankedDays - dayIndex} days ago"; //plural should be handled in a general way } @@ -96,7 +100,8 @@ namespace osu.Game.Overlays.Profile { // use logarithmic coordinates graph.Values = ranks.Select(x => -(float)Math.Log(x)); - graph.ResetBall(); + graph.SetStaticBallPosition(); + updateRankTexts(); } } @@ -110,67 +115,90 @@ namespace osu.Game.Overlays.Profile return base.Invalidate(invalidation, source, shallPropagate); } + protected override bool OnHover(InputState state) + { + graph.ShowBall(ToLocalSpace(state.Mouse.NativeState.Position).X); + return base.OnHover(state); + } + + protected override bool OnMouseMove(InputState state) + { + graph.MoveBall(ToLocalSpace(state.Mouse.NativeState.Position).X); + return base.OnMouseMove(state); + } + + protected override void OnHoverLost(InputState state) + { + graph.HideBall(); + updateRankTexts(); + base.OnHoverLost(state); + } + private class RankChartLineGraph : LineGraph { - private readonly CircularContainer ball; - private bool ballShown; + private const double fade_duration = 300; + private const double move_duration = 100; - private const double transform_duration = 100; + private readonly CircularContainer staticBall; + private readonly CircularContainer movingBall; - public Action BallMove; - public Action BallRelease; + public Action OnBallMove; + public Action OnReset; public RankChartLineGraph() { - Add(ball = new CircularContainer + Add(staticBall = new CircularContainer { + Origin = Anchor.Centre, Size = new Vector2(8), Masking = true, - Origin = Anchor.Centre, - Alpha = 0, RelativePositionAxes = Axes.Both, - Children = new Drawable[] - { - new Box { RelativeSizeAxes = Axes.Both } - } + Child = new Box { RelativeSizeAxes = Axes.Both } + }); + Add(movingBall = new CircularContainer + { + Origin = Anchor.Centre, + Size = new Vector2(8), + Alpha = 0, + Masking = true, + RelativePositionAxes = Axes.Both, + Child = new Box { RelativeSizeAxes = Axes.Both } }); } - public void ResetBall() + public void SetStaticBallPosition() { - ball.MoveTo(new Vector2(1, GetYPosition(Values.Last())), ballShown ? transform_duration : 0, Easing.OutQuint); - ball.Show(); - BallRelease(); - ballShown = true; + staticBall.Position = new Vector2(1, GetYPosition(Values.Last())); + OnReset.Invoke(); } - protected override bool OnMouseMove(InputState state) + public void ShowBall(float mouseXPosition) { - if (ballShown) - { - var values = (IList)Values; - var position = ToLocalSpace(state.Mouse.NativeState.Position); - int count = Math.Max(values.Count, DefaultValueCount); - int index = (int)Math.Round(position.X / DrawWidth * (count - 1)); - if (index >= count - values.Count) - { - int i = index + values.Count - count; - float y = GetYPosition(values[i]); - if (Math.Abs(y * DrawHeight - position.Y) <= 8f) - { - ball.MoveTo(new Vector2(index / (float)(count - 1), y), transform_duration, Easing.OutQuint); - BallMove(i); - } - } - } - return base.OnMouseMove(state); + int index = calculateIndex(mouseXPosition); + movingBall.Position = calculateBallPosition(mouseXPosition, index); + movingBall.FadeIn(fade_duration); + OnBallMove.Invoke(index); } - protected override void OnHoverLost(InputState state) + public void MoveBall(float mouseXPosition) { - if (ballShown) - ResetBall(); - base.OnHoverLost(state); + int index = calculateIndex(mouseXPosition); + movingBall.MoveTo(calculateBallPosition(mouseXPosition, index), move_duration, Easing.OutQuint); + OnBallMove.Invoke(index); + } + + public void HideBall() + { + movingBall.FadeOut(fade_duration); + OnReset.Invoke(); + } + + private int calculateIndex(float mouseXPosition) => (int)Math.Round(mouseXPosition / DrawWidth * (DefaultValueCount - 1)); + + private Vector2 calculateBallPosition(float mouseXPosition, int index) + { + float y = GetYPosition(Values.ElementAt(index)); + return new Vector2(index / (float)(DefaultValueCount - 1), y); } } } From 28167388d69e9a5fd0f70b6aa52fec69ba0623ca Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 02:53:07 +0300 Subject: [PATCH 02/36] Remove useless calls --- osu.Game/Overlays/Profile/RankChart.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index b8690efa2a..1caa171c88 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -101,7 +101,6 @@ namespace osu.Game.Overlays.Profile // use logarithmic coordinates graph.Values = ranks.Select(x => -(float)Math.Log(x)); graph.SetStaticBallPosition(); - updateRankTexts(); } } @@ -130,7 +129,6 @@ namespace osu.Game.Overlays.Profile protected override void OnHoverLost(InputState state) { graph.HideBall(); - updateRankTexts(); base.OnHoverLost(state); } From 461baf3b9729af2607e3ed781c047a45b0b0c662 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 03:05:12 +0300 Subject: [PATCH 03/36] CI fixes --- osu.Game/Overlays/Profile/RankChart.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 1caa171c88..67f1e4b951 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using System.Linq; using OpenTK; using osu.Framework.Allocation; @@ -173,7 +172,7 @@ namespace osu.Game.Overlays.Profile public void ShowBall(float mouseXPosition) { int index = calculateIndex(mouseXPosition); - movingBall.Position = calculateBallPosition(mouseXPosition, index); + movingBall.Position = calculateBallPosition(index); movingBall.FadeIn(fade_duration); OnBallMove.Invoke(index); } @@ -181,7 +180,7 @@ namespace osu.Game.Overlays.Profile public void MoveBall(float mouseXPosition) { int index = calculateIndex(mouseXPosition); - movingBall.MoveTo(calculateBallPosition(mouseXPosition, index), move_duration, Easing.OutQuint); + movingBall.MoveTo(calculateBallPosition(index), move_duration, Easing.OutQuint); OnBallMove.Invoke(index); } @@ -193,7 +192,7 @@ namespace osu.Game.Overlays.Profile private int calculateIndex(float mouseXPosition) => (int)Math.Round(mouseXPosition / DrawWidth * (DefaultValueCount - 1)); - private Vector2 calculateBallPosition(float mouseXPosition, int index) + private Vector2 calculateBallPosition(int index) { float y = GetYPosition(Values.ElementAt(index)); return new Vector2(index / (float)(DefaultValueCount - 1), y); From 1063e18566ae1635dfbcdf468c5c5b1f85e9a152 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 03:16:27 +0300 Subject: [PATCH 04/36] Don't show graph at all if there's no data to use --- osu.Game/Overlays/Profile/RankChart.cs | 46 ++++++++++++++------------ 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 67f1e4b951..88cbd1ec74 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -62,25 +62,28 @@ namespace osu.Game.Overlays.Profile Font = @"Exo2.0-RegularItalic", TextSize = secondary_textsize }, - graph = new RankChartLineGraph + }; + + if (rankedDays > 0) + { + Add(graph = new RankChartLineGraph { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, Y = -secondary_textsize, DefaultValueCount = rankedDays, - } - }; + }); - graph.OnBallMove += showHistoryRankTexts; - graph.OnReset += updateRankTexts; + graph.OnBallMove += showHistoryRankTexts; + } } private void updateRankTexts() { - rankText.Text = user.Statistics.Rank > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank"; - performanceText.Text = user.Statistics.PP != null ? $"{user.Statistics.PP:#,0}pp" : string.Empty; - relativeText.Text = $"{user.Country?.FullName} #{user.CountryRank:#,0}"; + rankText.Text = rankedDays > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank"; + performanceText.Text = rankedDays > 0 ? $"{user.Statistics.PP:#,0}pp" : string.Empty; + relativeText.Text = rankedDays > 0 ? $"{user.Country?.FullName} #{user.CountryRank:#,0}" : string.Empty; } private void showHistoryRankTexts(int dayIndex) @@ -93,14 +96,15 @@ namespace osu.Game.Overlays.Profile [BackgroundDependencyLoader] private void load(OsuColour colours) { - graph.Colour = colours.Yellow; - - if (user.Statistics.Rank > 0) + if (graph != null) { + graph.Colour = colours.Yellow; // use logarithmic coordinates graph.Values = ranks.Select(x => -(float)Math.Log(x)); graph.SetStaticBallPosition(); } + + updateRankTexts(); } public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) @@ -115,19 +119,25 @@ namespace osu.Game.Overlays.Profile protected override bool OnHover(InputState state) { - graph.ShowBall(ToLocalSpace(state.Mouse.NativeState.Position).X); + if (graph != null) + graph.ShowBall(ToLocalSpace(state.Mouse.NativeState.Position).X); return base.OnHover(state); } protected override bool OnMouseMove(InputState state) { - graph.MoveBall(ToLocalSpace(state.Mouse.NativeState.Position).X); + if (graph != null) + graph.MoveBall(ToLocalSpace(state.Mouse.NativeState.Position).X); return base.OnMouseMove(state); } protected override void OnHoverLost(InputState state) { - graph.HideBall(); + if (graph != null) + { + graph.HideBall(); + updateRankTexts(); + } base.OnHoverLost(state); } @@ -140,7 +150,6 @@ namespace osu.Game.Overlays.Profile private readonly CircularContainer movingBall; public Action OnBallMove; - public Action OnReset; public RankChartLineGraph() { @@ -163,11 +172,7 @@ namespace osu.Game.Overlays.Profile }); } - public void SetStaticBallPosition() - { - staticBall.Position = new Vector2(1, GetYPosition(Values.Last())); - OnReset.Invoke(); - } + public void SetStaticBallPosition() => staticBall.Position = new Vector2(1, GetYPosition(Values.Last())); public void ShowBall(float mouseXPosition) { @@ -187,7 +192,6 @@ namespace osu.Game.Overlays.Profile public void HideBall() { movingBall.FadeOut(fade_duration); - OnReset.Invoke(); } private int calculateIndex(float mouseXPosition) => (int)Math.Round(mouseXPosition / DrawWidth * (DefaultValueCount - 1)); From 60e6177b7f2e26de652029551d673ded7d0bbfd7 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 03:26:47 +0300 Subject: [PATCH 05/36] Use null propagation --- osu.Game/Overlays/Profile/RankChart.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 88cbd1ec74..873fcaa78a 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -119,15 +119,13 @@ namespace osu.Game.Overlays.Profile protected override bool OnHover(InputState state) { - if (graph != null) - graph.ShowBall(ToLocalSpace(state.Mouse.NativeState.Position).X); + graph?.ShowBall(ToLocalSpace(state.Mouse.NativeState.Position).X); return base.OnHover(state); } protected override bool OnMouseMove(InputState state) { - if (graph != null) - graph.MoveBall(ToLocalSpace(state.Mouse.NativeState.Position).X); + graph?.MoveBall(ToLocalSpace(state.Mouse.NativeState.Position).X); return base.OnMouseMove(state); } From 1b0e7e71452d77e569de0e79d78b890be046ebc6 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 03:44:21 +0300 Subject: [PATCH 06/36] Undo some useless changes --- osu.Game/Overlays/Profile/RankChart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 873fcaa78a..0171988967 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -81,9 +81,9 @@ namespace osu.Game.Overlays.Profile private void updateRankTexts() { - rankText.Text = rankedDays > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank"; - performanceText.Text = rankedDays > 0 ? $"{user.Statistics.PP:#,0}pp" : string.Empty; - relativeText.Text = rankedDays > 0 ? $"{user.Country?.FullName} #{user.CountryRank:#,0}" : string.Empty; + rankText.Text = user.Statistics.Rank > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank"; + performanceText.Text = user.Statistics.PP != null ? $"{user.Statistics.PP:#,0}pp" : string.Empty; + relativeText.Text = $"{user.Country?.FullName} #{user.CountryRank:#,0}"; } private void showHistoryRankTexts(int dayIndex) From 5946585a6f6013ed8ee9af3fc0bc03930d09a13f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 12:19:23 +0300 Subject: [PATCH 07/36] Apply suggested changes --- osu.Game/Overlays/Profile/RankChart.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 0171988967..dc2c9e92ca 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -23,7 +23,6 @@ namespace osu.Game.Overlays.Profile private readonly RankChartLineGraph graph; private readonly int[] ranks; - private readonly int rankedDays; private const float primary_textsize = 25, secondary_textsize = 13, padding = 10; @@ -35,7 +34,6 @@ namespace osu.Game.Overlays.Profile int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank }; ranks = userRanks.SkipWhile(x => x == 0).ToArray(); - rankedDays = ranks.Length; Padding = new MarginPadding { Vertical = padding }; Children = new Drawable[] @@ -64,7 +62,7 @@ namespace osu.Game.Overlays.Profile }, }; - if (rankedDays > 0) + if (ranks.Length > 0) { Add(graph = new RankChartLineGraph { @@ -72,7 +70,7 @@ namespace osu.Game.Overlays.Profile Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, Y = -secondary_textsize, - DefaultValueCount = rankedDays, + DefaultValueCount = ranks.Length, }); graph.OnBallMove += showHistoryRankTexts; @@ -89,7 +87,7 @@ namespace osu.Game.Overlays.Profile private void showHistoryRankTexts(int dayIndex) { rankText.Text = $"#{ranks[dayIndex]:#,0}"; - relativeText.Text = dayIndex == rankedDays ? "Now" : $"{rankedDays - dayIndex} days ago"; + relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago"; //plural should be handled in a general way } @@ -119,13 +117,13 @@ namespace osu.Game.Overlays.Profile protected override bool OnHover(InputState state) { - graph?.ShowBall(ToLocalSpace(state.Mouse.NativeState.Position).X); + graph?.ShowBall(state.Mouse.Position.X); return base.OnHover(state); } protected override bool OnMouseMove(InputState state) { - graph?.MoveBall(ToLocalSpace(state.Mouse.NativeState.Position).X); + graph?.MoveBall(state.Mouse.Position.X); return base.OnMouseMove(state); } From 8e806cd11c2a8820ecd7fa896a77ea2a8133859a Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 13:43:02 +0300 Subject: [PATCH 08/36] Simplify moving ball behaviour --- osu.Game/Overlays/Profile/RankChart.cs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index dc2c9e92ca..393575ff60 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -117,13 +117,14 @@ namespace osu.Game.Overlays.Profile protected override bool OnHover(InputState state) { - graph?.ShowBall(state.Mouse.Position.X); + graph?.UpdateBallPosition(state.Mouse.Position.X); + graph?.ShowBall(); return base.OnHover(state); } protected override bool OnMouseMove(InputState state) { - graph?.MoveBall(state.Mouse.Position.X); + graph?.UpdateBallPosition(state.Mouse.Position.X); return base.OnMouseMove(state); } @@ -139,8 +140,7 @@ namespace osu.Game.Overlays.Profile private class RankChartLineGraph : LineGraph { - private const double fade_duration = 300; - private const double move_duration = 100; + private const double fade_duration = 200; private readonly CircularContainer staticBall; private readonly CircularContainer movingBall; @@ -170,25 +170,16 @@ namespace osu.Game.Overlays.Profile public void SetStaticBallPosition() => staticBall.Position = new Vector2(1, GetYPosition(Values.Last())); - public void ShowBall(float mouseXPosition) + public void UpdateBallPosition(float mouseXPosition) { int index = calculateIndex(mouseXPosition); movingBall.Position = calculateBallPosition(index); - movingBall.FadeIn(fade_duration); OnBallMove.Invoke(index); } - public void MoveBall(float mouseXPosition) - { - int index = calculateIndex(mouseXPosition); - movingBall.MoveTo(calculateBallPosition(index), move_duration, Easing.OutQuint); - OnBallMove.Invoke(index); - } + public void ShowBall() => movingBall.FadeIn(fade_duration); - public void HideBall() - { - movingBall.FadeOut(fade_duration); - } + public void HideBall() => movingBall.FadeOut(fade_duration); private int calculateIndex(float mouseXPosition) => (int)Math.Round(mouseXPosition / DrawWidth * (DefaultValueCount - 1)); From 13cc1fcc92e8af93e33b987f6266e61a3c6a7dd5 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 7 Nov 2017 14:30:44 +0300 Subject: [PATCH 09/36] Fix wrong index offset --- osu.Game/Overlays/Profile/RankChart.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 393575ff60..5bd6d30b42 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -87,6 +87,7 @@ namespace osu.Game.Overlays.Profile private void showHistoryRankTexts(int dayIndex) { rankText.Text = $"#{ranks[dayIndex]:#,0}"; + dayIndex++; relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago"; //plural should be handled in a general way } From e417eceb98de1f432b3780e770ff254bfe1ec152 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 22:49:32 +0100 Subject: [PATCH 10/36] Texture in Avatar.cs can not be null. --- osu.Game/Users/Avatar.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index 111c901ca0..7ced0305fd 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.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; @@ -25,6 +26,9 @@ namespace osu.Game.Users [BackgroundDependencyLoader] private void load(TextureStore textures) { + if (textures == null) + throw new ArgumentNullException(nameof(textures)); + Texture texture = null; if (user != null && user.Id > 1) texture = textures.Get($@"https://a.ppy.sh/{user.Id}"); if (texture == null) texture = textures.Get(@"Online/avatar-guest"); From d5b275fa5368607db4b735587b8d53e9e7585094 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 22:50:00 +0100 Subject: [PATCH 11/36] The TextureStore in Country.cs can noit be null. --- osu.Game/Users/Country.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index bf06d9f8bc..0c0d12c1cc 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.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 Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -45,6 +46,9 @@ namespace osu.Game.Users [BackgroundDependencyLoader] private void load(TextureStore ts) { + if (ts == null) + throw new ArgumentNullException(nameof(ts)); + textures = ts; sprite.Texture = textures.Get($@"Flags/{flagName}"); } From 2518b5e9a0a52674a529604776258e5beb7a8653 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 22:50:45 +0100 Subject: [PATCH 12/36] Textures in UserCoverBackground.cs can not be null --- osu.Game/Users/UserCoverBackground.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Users/UserCoverBackground.cs b/osu.Game/Users/UserCoverBackground.cs index c0f0d09d9d..68c97fc8fd 100644 --- a/osu.Game/Users/UserCoverBackground.cs +++ b/osu.Game/Users/UserCoverBackground.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.Sprites; using osu.Framework.Graphics.Textures; @@ -19,6 +20,9 @@ namespace osu.Game.Users [BackgroundDependencyLoader] private void load(TextureStore textures) { + if (textures == null) + throw new ArgumentNullException(nameof(textures)); + if (!string.IsNullOrEmpty(user.CoverUrl)) Texture = textures.Get(user.CoverUrl); } From e430256b092c1cc3bfdfbaae75d3a6ec788d24d2 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 22:51:06 +0100 Subject: [PATCH 13/36] User and colors can not be null in UserPanel.cs --- osu.Game/Users/UserPanel.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index e5518b5845..706ad86bfc 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -38,6 +38,9 @@ namespace osu.Game.Users public UserPanel(User user) { + if (user == null) + throw new ArgumentNullException(nameof(user)); + this.user = user; Height = height - status_height; @@ -173,6 +176,9 @@ namespace osu.Game.Users [BackgroundDependencyLoader(permitNulls: true)] private void load(OsuColour colours, UserProfileOverlay profile) { + if (colours == null) + throw new ArgumentNullException(nameof(colours)); + Status.ValueChanged += displayStatus; Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); From 840946d160483f351808c5f8a1712d04f889c040 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:08:24 +0100 Subject: [PATCH 14/36] list can not be null in ControlPointInfo.cs --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index e7035880dd..e46eb8e20a 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Lists; @@ -85,6 +86,9 @@ namespace osu.Game.Beatmaps.ControlPoints private T binarySearch(SortedList list, double time, T prePoint = null) where T : ControlPoint, new() { + if (list == null) + throw new ArgumentNullException(nameof(list)); + if (list.Count == 0) return new T(); From 1f620886cbe283bb9816bf7fd3ad95de53c76a0d Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:09:16 +0100 Subject: [PATCH 15/36] beatmap and line can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index d775ab409b..3cf3b3a168 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -70,6 +70,11 @@ namespace osu.Game.Beatmaps.Formats private void handleGeneral(Beatmap beatmap, string line) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + if (line == null) + throw new ArgumentNullException(nameof(line)); + var pair = splitKeyVal(line, ':'); var metadata = beatmap.BeatmapInfo.Metadata; From 080c3fabba909854939d156427523e92d455c7af Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:10:06 +0100 Subject: [PATCH 16/36] BeatmapSet and manager can not be null in BeatmapGroup.cs --- osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 6e5af29799..163dd7fbe9 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -72,6 +72,11 @@ namespace osu.Game.Beatmaps.Drawables public BeatmapGroup(BeatmapSetInfo beatmapSet, BeatmapManager manager) { + if (beatmapSet == null) + throw new ArgumentNullException(nameof(beatmapSet)); + if (manager == null) + throw new ArgumentNullException(nameof(manager)); + BeatmapSet = beatmapSet; WorkingBeatmap beatmap = manager.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault()); From 2f47b336e2780945fb493d118ef1439d11cc4039 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:10:30 +0100 Subject: [PATCH 17/36] beatmap and line can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 3cf3b3a168..e73e056cb4 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -134,6 +134,11 @@ namespace osu.Game.Beatmaps.Formats private void handleEditor(Beatmap beatmap, string line) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + if (line == null) + throw new ArgumentNullException(nameof(line)); + var pair = splitKeyVal(line, ':'); switch (pair.Key) From cf296d4bb22ca57d81519c52326e20527fbf6b95 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:10:41 +0100 Subject: [PATCH 18/36] beatmap and line can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index e73e056cb4..f231342234 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -163,6 +163,11 @@ namespace osu.Game.Beatmaps.Formats private void handleMetadata(Beatmap beatmap, string line) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + if (line == null) + throw new ArgumentNullException(nameof(line)); + var pair = splitKeyVal(line, ':'); var metadata = beatmap.BeatmapInfo.Metadata; From 0287d3d7a05a98a26a9faee9f310fc364c19be46 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:10:54 +0100 Subject: [PATCH 19/36] beatmap and line can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index f231342234..d240b7669c 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -209,6 +209,11 @@ namespace osu.Game.Beatmaps.Formats private void handleDifficulty(Beatmap beatmap, string line) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + if (line == null) + throw new ArgumentNullException(nameof(line)); + var pair = splitKeyVal(line, ':'); var difficulty = beatmap.BeatmapInfo.BaseDifficulty; From 34083baa4dc596ea1816af9d254eb816e8fe0a14 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:11:04 +0100 Subject: [PATCH 20/36] beatmap and line can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index d240b7669c..0d9d875f86 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -264,6 +264,11 @@ namespace osu.Game.Beatmaps.Formats private void handleEvents(Beatmap beatmap, string line, ref StoryboardSprite storyboardSprite, ref CommandTimelineGroup timelineGroup) { + if (line == null) + throw new ArgumentNullException(nameof(line)); + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + var depth = 0; while (line.StartsWith(" ") || line.StartsWith("_")) { From d27dced3af926ab0aed4591ba7fb8ac5bf7cb94c Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:11:16 +0100 Subject: [PATCH 21/36] beatmap and line can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 0d9d875f86..5277044550 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -494,6 +494,11 @@ namespace osu.Game.Beatmaps.Formats private void handleTimingPoints(Beatmap beatmap, string line) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + if (line == null) + throw new ArgumentNullException(nameof(line)); + string[] split = line.Split(','); double time = double.Parse(split[0].Trim(), NumberFormatInfo.InvariantInfo); From 8dc24a52a7fdbe4fcb461a32fe897b1abd72156d Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:11:33 +0100 Subject: [PATCH 22/36] beatmap and line can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 5277044550..1c7a08d17a 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -585,6 +585,11 @@ namespace osu.Game.Beatmaps.Formats private void handleColours(Beatmap beatmap, string line, ref bool hasCustomColours) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + if (line == null) + throw new ArgumentNullException(nameof(line)); + var pair = splitKeyVal(line, ':'); string[] split = pair.Value.Split(','); From a8acea9cdbfeae752ae8cbd7011c6d89b4056e6d Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:12:30 +0100 Subject: [PATCH 23/36] stream can not be null in BeatmapDecoder.cs --- osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 962c6ad49a..7e1a87085c 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -18,6 +18,9 @@ namespace osu.Game.Beatmaps.Formats public static BeatmapDecoder GetDecoder(StreamReader stream) { + if (stream == null) + throw new ArgumentNullException(nameof(stream)); + string line; do { line = stream.ReadLine()?.Trim(); } while (line != null && line.Length == 0); From 289a1346fc00c850f5045a298d2602133a328752 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:13:09 +0100 Subject: [PATCH 24/36] beatmap can not be null in DifficultyIcon.cs --- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 1aff764ede..8259da9492 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.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.Game.Graphics; @@ -15,6 +16,9 @@ namespace osu.Game.Beatmaps.Drawables public DifficultyIcon(BeatmapInfo beatmap) : base(beatmap) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + this.beatmap = beatmap; Size = new Vector2(20); } From dd3874daa8a6ca865eda007ff49e3c9093bee993 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:13:32 +0100 Subject: [PATCH 25/36] beatmap can not be null in BeatmapPanel.cs --- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index c0705d8f61..e6bf08eb9f 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -73,6 +73,9 @@ namespace osu.Game.Beatmaps.Drawables public BeatmapPanel(BeatmapInfo beatmap) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + Beatmap = beatmap; Height *= 0.60f; From d7dee57886e98696247ceddf2a030bed46fe4e03 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:13:56 +0100 Subject: [PATCH 26/36] set can not be null in BeatmapSetCover.cs --- osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs index df7e0905d0..614ebc236b 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.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.Sprites; using osu.Framework.Graphics.Textures; @@ -12,6 +13,9 @@ namespace osu.Game.Beatmaps.Drawables private readonly BeatmapSetInfo set; public BeatmapSetCover(BeatmapSetInfo set) { + if (set == null) + throw new ArgumentNullException(nameof(set)); + this.set = set; } From bc941790329421cec6aee6afc6c69362c0af8030 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:14:22 +0100 Subject: [PATCH 27/36] workingbeatmap can not be null in BeatmapBackgroundSprite.cs --- osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs index 9b897b4912..0ac8d12591 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.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.Sprites; @@ -12,6 +13,9 @@ namespace osu.Game.Beatmaps.Drawables public BeatmapBackgroundSprite(WorkingBeatmap working) { + if (working == null) + throw new ArgumentNullException(nameof(working)); + this.working = working; } From dc317139c90576f1c2d30b9ff885d1818c604610 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:15:02 +0100 Subject: [PATCH 28/36] beatmap can not be null in BeatmapSetHeader.cs --- osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index ee75b77747..f1dc933a3f 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -36,6 +36,9 @@ namespace osu.Game.Beatmaps.Drawables public BeatmapSetHeader(WorkingBeatmap beatmap) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + this.beatmap = beatmap; Children = new Drawable[] From 0f539d24f0926d2bdbcff6631ff5d46153c26876 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:15:21 +0100 Subject: [PATCH 29/36] Localisation can not be null in BeatmapSetHeader.cs --- osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index f1dc933a3f..6593ea6de2 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -91,6 +91,9 @@ namespace osu.Game.Beatmaps.Drawables [BackgroundDependencyLoader] private void load(LocalisationEngine localisation) { + if (localisation == null) + throw new ArgumentNullException(nameof(localisation)); + title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); } From 36ce287b886cde96d9a636c8581d62c4f172bf82 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:15:51 +0100 Subject: [PATCH 30/36] panels can not be null in BeatmapSetHeader.cs --- osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 6593ea6de2..8a589ccd30 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -160,6 +160,9 @@ namespace osu.Game.Beatmaps.Drawables public void AddDifficultyIcons(IEnumerable panels) { + if (panels == null) + throw new ArgumentNullException(nameof(panels)); + foreach (var p in panels) difficultyIcons.Add(new DifficultyIcon(p.Beatmap)); } From a15ab785f28078eb30b821922146c91b27207ee3 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:16:19 +0100 Subject: [PATCH 31/36] palette can not be null in DifficultyColouredContainer.cs --- osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs index 41b77f6584..f2bb9c62d7 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.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.Containers; using osu.Game.Graphics; @@ -23,6 +24,9 @@ namespace osu.Game.Beatmaps.Drawables [BackgroundDependencyLoader] private void load(OsuColour palette) { + if (palette == null) + throw new ArgumentNullException(nameof(palette)); + this.palette = palette; AccentColour = getColour(beatmap); } From 1e6f1d07d237cd7bcf484b508b96cd91940724dc Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:16:42 +0100 Subject: [PATCH 32/36] line can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 1c7a08d17a..2fb14c65f7 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -246,6 +246,9 @@ namespace osu.Game.Beatmaps.Formats /// The line which may contains variables. private void decodeVariables(ref string line) { + if (line == null) + throw new ArgumentNullException(nameof(line)); + while (line.IndexOf('$') >= 0) { string origLine = line; @@ -622,6 +625,9 @@ namespace osu.Game.Beatmaps.Formats private void handleVariables(string line) { + if (line == null) + throw new ArgumentNullException(nameof(line)); + var pair = splitKeyVal(line, '='); variables[pair.Key] = pair.Value; } From 13e75780d71383e7738bdc918efa35b8a60258a1 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:17:07 +0100 Subject: [PATCH 33/36] beatmap and stream can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 2fb14c65f7..34ae2ede54 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -644,6 +644,11 @@ namespace osu.Game.Beatmaps.Formats protected override void ParseFile(StreamReader stream, Beatmap beatmap) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + if (stream == null) + throw new ArgumentNullException(nameof(stream)); + beatmap.BeatmapInfo.BeatmapVersion = beatmapVersion; Section section = Section.None; From b2e49c1e7144e78a09ed4553ff613ed198750f0e Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:17:26 +0100 Subject: [PATCH 34/36] line can not be null in OsuLegacyDecoder.cs --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 34ae2ede54..11631e9447 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -725,6 +725,9 @@ namespace osu.Game.Beatmaps.Formats private KeyValuePair splitKeyVal(string line, char separator) { + if (line == null) + throw new ArgumentNullException(nameof(line)); + var split = line.Trim().Split(new[] { separator }, 2); return new KeyValuePair From 567cd6316c7803ea0ccffe818dbd6628101126f8 Mon Sep 17 00:00:00 2001 From: Miterosan Date: Tue, 7 Nov 2017 23:17:45 +0100 Subject: [PATCH 35/36] beatmap can not be null in DifficultyColouredContainer.cs --- osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs index f2bb9c62d7..57a5abc4c7 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs @@ -43,6 +43,9 @@ namespace osu.Game.Beatmaps.Drawables private DifficultyRating getDifficultyRating(BeatmapInfo beatmap) { + if (beatmap == null) + throw new ArgumentNullException(nameof(beatmap)); + var rating = beatmap.StarDifficulty; if (rating < 1.5) return DifficultyRating.Easy; From 724540ceaa614d4b3817410c721ed16432f97055 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 9 Nov 2017 20:33:39 +0900 Subject: [PATCH 36/36] Fix toolbar not appearing at main menu --- osu.Game/Screens/Menu/ButtonSystem.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 33d118d12e..af16fbd71c 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -263,17 +263,15 @@ namespace osu.Game.Screens.Menu logo.ScaleTo(0.5f, 200, Easing.In); trackingPosition = false; + logo .MoveTo(iconTrackingPosition, lastState == MenuState.EnteringMode ? 0 : 200, Easing.In) .OnComplete(o => { trackingPosition = true; - if (logo.Scale.X > 0.5f) - { - o.Impact(); - toolbar?.Show(); - } + o.Impact(); + toolbar?.Show(); }); break; default: