private void updateColour() { Colour4 baseColour = colours.Blue; if (user.Value?.IsSupporter ?? false) { baseColour = skin.Value.GetConfig <GlobalSkinColours, Colour4>(GlobalSkinColours.MenuGlow)?.Value ?? baseColour; } // linear colour looks better in this case, so let's use it for now. Colour4 gradientDark = baseColour.Opacity(0).ToLinear(); Colour4 gradientLight = baseColour.Opacity(0.6f).ToLinear(); leftBox.Colour = ColourInfo.GradientHorizontal(gradientLight, gradientDark); rightBox.Colour = ColourInfo.GradientHorizontal(gradientDark, gradientLight); }
/// <summary> /// Forces an alpha of 1 if a given <see cref="Colour4"/> is fully transparent. /// </summary> /// <remarks> /// This is equivalent to setting colour post-constructor in osu!stable. /// </remarks> /// <param name="colour">The <see cref="Colour4"/> to disallow zero alpha on.</param> /// <returns>The resultant <see cref="Colour4"/>.</returns> public static Colour4 DisallowZeroAlpha(Colour4 colour) { if (colour.A == 0) { colour = colour.Opacity(1); } return(colour); }
protected virtual void UpdateLayout() { paths.Clear(); headings.Clear(); int id = 1; foreach (var match in MatchesContainer.OrderBy(d => d.Y).ThenBy(d => d.X)) { match.Match.ID = id++; if (match.Match.Progression.Value != null) { var dest = MatchesContainer.FirstOrDefault(p => p.Match == match.Match.Progression.Value); if (dest == null) { // clean up outdated progressions. match.Match.Progression.Value = null; } else { paths.Add(new ProgressionPath(match, dest) { Colour = match.Match.Losers.Value ? losersPathColour : normalPathColour }); } } if (DrawLoserPaths) { if (match.Match.LosersProgression.Value != null) { var dest = MatchesContainer.FirstOrDefault(p => p.Match == match.Match.LosersProgression.Value); if (dest == null) { // clean up outdated progressions. match.Match.LosersProgression.Value = null; } else { paths.Add(new ProgressionPath(match, dest) { Colour = losersPathColour.Opacity(0.1f) }); } } } } foreach (var round in LadderInfo.Rounds) { var topMatch = MatchesContainer.Where(p => !p.Match.Losers.Value && p.Match.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); if (topMatch == null) { continue; } headings.Add(new DrawableTournamentRound(round) { Position = headings.ToLocalSpace((topMatch.ScreenSpaceDrawQuad.TopLeft + topMatch.ScreenSpaceDrawQuad.TopRight) / 2), Margin = new MarginPadding { Bottom = 10 }, Origin = Anchor.BottomCentre, }); } foreach (var round in LadderInfo.Rounds) { var topMatch = MatchesContainer.Where(p => p.Match.Losers.Value && p.Match.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); if (topMatch == null) { continue; } headings.Add(new DrawableTournamentRound(round, true) { Position = headings.ToLocalSpace((topMatch.ScreenSpaceDrawQuad.TopLeft + topMatch.ScreenSpaceDrawQuad.TopRight) / 2), Margin = new MarginPadding { Bottom = 10 }, Origin = Anchor.BottomCentre, }); } layout.Validate(); }