private void createColourBars(OsuColour colours) { var windows = HitWindows.GetAllAvailableWindows().ToArray(); maxHitWindow = windows.First().length; for (var i = 0; i < windows.Length; i++) { var(result, length) = windows[i]; colourBarsEarly.Add(createColourBar(result, (float)(length / maxHitWindow), i == 0)); colourBarsLate.Add(createColourBar(result, (float)(length / maxHitWindow), i == 0)); } // a little nub to mark the centre point. var centre = createColourBar(windows.Last().result, 0.01f); centre.Anchor = centre.Origin = Anchor.y1 | (alignment == Anchor.x2 ? Anchor.x0 : Anchor.x2); centre.Width = 2.5f; colourBars.Add(centre); Drawable createColourBar(HitResult result, float height, bool first = false) { var colour = GetColourForHitResult(result); if (first) { // the first bar needs gradient rendering. const float gradient_start = 0.8f; return(new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colour, Height = height * gradient_start }, new Box { RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Colour = ColourInfo.GradientVertical(colour, colour.Opacity(0)), Y = gradient_start, Height = height * (1 - gradient_start) }, } }); } return(new Box { RelativeSizeAxes = Axes.Both, Colour = colour, Height = height }); } }
private void load() { const int centre_marker_size = 8; const int bar_height = 200; const int bar_width = 2; const float chevron_size = 8; const float icon_size = 14; var hitWindows = HitWindows.GetAllAvailableWindows().ToArray(); InternalChild = new Container { AutoSizeAxes = Axes.X, Height = bar_height, Margin = new MarginPadding(2), Children = new Drawable[] { colourBars = new Container { Name = "colour axis", X = chevron_size, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Width = judgement_line_width, RelativeSizeAxes = Axes.Y, Children = new Drawable[] { iconEarly = new SpriteIcon { Y = -10, Size = new Vector2(icon_size), Icon = FontAwesome.Solid.ShippingFast, Anchor = Anchor.TopCentre, Origin = Anchor.Centre, }, iconLate = new SpriteIcon { Y = 10, Size = new Vector2(icon_size), Icon = FontAwesome.Solid.Bicycle, Anchor = Anchor.BottomCentre, Origin = Anchor.Centre, }, colourBarsEarly = new Container { Anchor = Anchor.Centre, Origin = Anchor.TopCentre, Width = bar_width, RelativeSizeAxes = Axes.Y, Height = 0.5f, Scale = new Vector2(1, -1), }, colourBarsLate = new Container { Anchor = Anchor.Centre, Origin = Anchor.TopCentre, Width = bar_width, RelativeSizeAxes = Axes.Y, Height = 0.5f, }, new Circle { Name = "middle marker behind", Colour = GetColourForHitResult(hitWindows.Last().result), Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(centre_marker_size), }, judgementsContainer = new Container { Name = "judgements", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, Width = judgement_line_width, }, new Circle { Name = "middle marker in front", Colour = GetColourForHitResult(hitWindows.Last().result).Darken(0.3f), Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(centre_marker_size), Scale = new Vector2(0.5f), }, } }, new Container { Name = "average chevron", Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Width = chevron_size, RelativeSizeAxes = Axes.Y, Child = arrow = new SpriteIcon { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, RelativePositionAxes = Axes.Y, Y = 0.5f, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(chevron_size), } }, } }; createColourBars(hitWindows); }