1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-01 22:05:48 +08:00
osu-lazer/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs

38 lines
1.2 KiB
C#

using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Screens.Select.Details
{
public class BeatmapDetailsGraph : FillFlowContainer<BeatmapDetailsBar>
{
public IEnumerable<float> Values
{
set
{
List<float> values = value.ToList();
List<BeatmapDetailsBar> graphBars = Children.ToList();
for (int i = 0; i < values.Count; i++)
if (graphBars.Count > i)
{
graphBars[i].Length = values[i] / values.Max();
graphBars[i].Width = 1.0f / values.Count;
}
else
Add(new BeatmapDetailsBar
{
RelativeSizeAxes = Axes.Both,
Width = 1.0f / values.Count,
Length = values[i] / values.Max(),
Direction = BarDirection.BottomToTop,
BackgroundColour = new Color4(0, 0, 0, 0),
});
}
}
}
}