mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
update to everything
This commit is contained in:
@ -11,6 +11,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class BarGraph : FillFlowContainer<Bar>
|
||||
{
|
||||
/// <summary>
|
||||
/// Manually sets the max value, if null <see cref="Enumerable.Max(IEnumerable{float})"/> is instead used
|
||||
/// </summary>
|
||||
public float? MaxValue { get; set; }
|
||||
|
||||
private BarDirection direction = BarDirection.BottomToTop;
|
||||
public new BarDirection Direction
|
||||
{
|
||||
@ -30,6 +35,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list of floats that defines the length of each <see cref="Bar"/>
|
||||
/// </summary>
|
||||
public IEnumerable<float> Values
|
||||
{
|
||||
set
|
||||
@ -39,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
if (graphBars.Count > i)
|
||||
{
|
||||
graphBars[i].Length = values[i] / values.Max();
|
||||
graphBars[i].Length = values[i] / (MaxValue ?? values.Max());
|
||||
graphBars[i].Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1);
|
||||
}
|
||||
else
|
||||
@ -47,9 +55,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1),
|
||||
Length = values[i] / values.Max(),
|
||||
Length = values[i] / (MaxValue ?? values.Max()),
|
||||
Direction = Direction,
|
||||
});
|
||||
Remove(Children.Where((bar, index) => index >= values.Count));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user