From ab4d1c772574d301398a7c5721d1468147a08e36 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 15:33:36 +0200 Subject: [PATCH] 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, }); }