retries and fails hide if they're not present

This commit is contained in:
Jorolf 2017-04-07 20:19:03 +02:00
parent 899e559b5c
commit 6a87fd6112
1 changed files with 31 additions and 15 deletions

View File

@ -37,6 +37,7 @@ public class BeatmapDetails : Container
private readonly OsuSpriteText positiveRatings;
private readonly BarGraph ratingsGraph;
private readonly FillFlowContainer retryAndFailContainer;
private readonly BarGraph retryGraph;
private readonly BarGraph failGraph;
@ -119,8 +120,14 @@ public IEnumerable<int> Fails
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] ?? 0) ?? new List<float>();
retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]) ?? new List<float>();
}
}
public BeatmapDetails()
@ -304,6 +311,13 @@ public BeatmapDetails()
},
},
},
retryAndFailContainer = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Alpha = 0,
Children = new Drawable[]
{
new OsuSpriteText
{
Text = "Points of Failure",
@ -325,6 +339,8 @@ public BeatmapDetails()
},
},
},
}
},
},
},
};