1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 20:22:55 +08:00

better maxValue calculation for the retry and fail graph

This commit is contained in:
Jorolf 2017-03-29 15:33:36 +02:00
parent 7bd13d76a8
commit ab4d1c7725

View File

@ -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<RetryAndFailBar> 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,
});
}