mirror of
https://github.com/ppy/osu.git
synced 2024-12-17 11:12:55 +08:00
better maxValue calculation for the retry and fail graph
This commit is contained in:
parent
7bd13d76a8
commit
ab4d1c7725
@ -13,7 +13,6 @@ using osu.Game.Database;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
@ -126,19 +125,20 @@ namespace osu.Game.Screens.Select
|
|||||||
private void calcRetryAndFailBarLength()
|
private void calcRetryAndFailBarLength()
|
||||||
{
|
{
|
||||||
List<RetryAndFailBar> retryAndFailGraphBars = retryAndFailGraph.Children.ToList();
|
List<RetryAndFailBar> retryAndFailGraphBars = retryAndFailGraph.Children.ToList();
|
||||||
|
float maxValue = fails.Select((value, index) => value + retries[index]).Max();
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
if (retryAndFailGraphBars.Count > i)
|
if (retryAndFailGraphBars.Count > i)
|
||||||
{
|
{
|
||||||
retryAndFailGraphBars[i].FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0));
|
retryAndFailGraphBars[i].FailLength = fails[i] / maxValue;
|
||||||
retryAndFailGraphBars[i].RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0));
|
retryAndFailGraphBars[i].RetryLength = retries[i] / maxValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
retryAndFailGraph.Add(new RetryAndFailBar
|
retryAndFailGraph.Add(new RetryAndFailBar
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Width = 0.01f,
|
Width = 0.01f,
|
||||||
FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)),
|
FailLength = fails[i] / maxValue,
|
||||||
RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)),
|
RetryLength = retries[i] / maxValue,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user