private void load(OsuColour colours) { Children = new Drawable[] { new CircularContainer { RelativeSizeAxes = Axes.Both, Scale = new Vector2(0.84f), Anchor = Anchor.Centre, Origin = Anchor.Centre, Masking = true, EdgeEffect = new EdgeEffectParameters { Colour = Color4.Black.Opacity(0.08f), Type = EdgeEffectType.Shadow, Radius = 5, }, Child = new Box { RelativeSizeAxes = Axes.Both, Colour = colours.ForDifficultyRating(beatmap.DifficultyRating), }, }, new ConstrainedIconContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, // the null coalesce here is only present to make unit tests work (ruleset dlls aren't copied correctly for testing at the moment) Icon = ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.Regular.QuestionCircle } } }; }
private void load(SentakkiRulesetConfigManager settings, OsuColour colours, DrawableSentakkiRuleset ruleset, IAPIProvider api, SkinManager skinManager) { settings?.BindWith(SentakkiRulesetSettings.RingOpacity, RingOpacity); RingOpacity.BindValueChanged(opacity => Alpha = opacity.NewValue); settings?.BindWith(SentakkiRulesetSettings.ShowNoteStartIndicators, NoteStartIndicators); NoteStartIndicators.BindValueChanged(opacity => spawnIndicator.FadeTo(Convert.ToSingle(opacity.NewValue), 200)); user = api.LocalUser.GetBoundCopy(); skin = skinManager.CurrentSkin.GetBoundCopy(); user.ValueChanged += _ => colorOption.TriggerChange(); skin.BindValueChanged(_ => colorOption.TriggerChange(), true); settings?.BindWith(SentakkiRulesetSettings.RingColor, colorOption); colorOption.BindValueChanged(option => { if (option.NewValue == ColorOption.Default) { this.FadeColour(Color4.White, 200); } else if (option.NewValue == ColorOption.Difficulty) { this.FadeColour(colours.ForDifficultyRating(ruleset?.Beatmap.BeatmapInfo.DifficultyRating ?? DifficultyRating.Normal, true), 200); } else if (option.NewValue == ColorOption.Skin) { this.FadeColour(skin.Value.GetConfig <GlobalSkinColours, Color4>(GlobalSkinColours.MenuGlow)?.Value ?? Color4.White, 200); } }); settings?.BindWith(SentakkiRulesetSettings.KiaiEffects, kiaiEffect); }
public bool SetContent(object content) { if (!(content is BeatmapInfo beatmap)) { return(false); } difficultyName.Text = beatmap.Version; starRating.Text = $"{beatmap.StarDifficulty:0.##}"; difficultyFlow.Colour = colours.ForDifficultyRating(beatmap.DifficultyRating); return(true); }
private void load(SentakkiRulesetConfigManager settings, OsuColour colours, DrawableSentakkiRuleset ruleset, IAPIProvider api, SkinManager skinManager) { FillAspectRatio = 1; FillMode = FillMode.Fit; RelativeSizeAxes = Axes.Both; Size = new Vector2(.99f); Anchor = Anchor.Centre; Origin = Anchor.Centre; Child = visualisation = new LogoVisualisation { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, }; user = api.LocalUser.GetBoundCopy(); skin = skinManager.CurrentSkin.GetBoundCopy(); user.ValueChanged += _ => colorOption.TriggerChange(); skin.BindValueChanged(_ => colorOption.TriggerChange(), true); settings?.BindWith(SentakkiRulesetSettings.KiaiEffects, kiaiEffect); kiaiEffect.TriggerChange(); settings?.BindWith(SentakkiRulesetSettings.RingColor, colorOption); // I know that these colors should directly affect AccentColour, but the outcome is not desireable with certain colors // Instead, I'll just change the main drawable color to retain the better looking transparency with all colors. // AccentColour is being forced to be White to counter the LogoVisualisation's bindables // Definitely needs cleaner code to do this, perhaps another Visualisation class... colorOption.BindValueChanged(option => { if (option.NewValue == ColorOption.Default) { visualisation.FadeColour(Color4.White, 200); visualisation.AccentColour = Color4.White.Opacity(.2f); } else if (option.NewValue == ColorOption.Difficulty) { visualisation.FadeColour(colours.ForDifficultyRating(ruleset?.Beatmap.BeatmapInfo.DifficultyRating ?? DifficultyRating.Normal, true), 200); visualisation.AccentColour = Color4.White.Opacity(.2f); } else if (option.NewValue == ColorOption.Skin) { visualisation.FadeColour(skin.Value.GetConfig <GlobalSkinColours, Color4>(GlobalSkinColours.MenuGlow)?.Value ?? Color4.White, 200); visualisation.AccentColour = Color4.White.Opacity(.2f); } }); }
private void load(ShaderManager shaders, IBindable <WorkingBeatmap> beatmap, SkinManager skinManager, SentakkiRulesetConfigManager settings, OsuColour colours, DrawableSentakkiRuleset ruleset) { this.beatmap.BindTo(beatmap); shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED); skin = skinManager.CurrentSkin.GetBoundCopy(); skin.BindValueChanged(_ => colorOption.TriggerChange()); settings?.BindWith(SentakkiRulesetSettings.KiaiEffects, kiaiEffect); kiaiEffect.BindValueChanged(k => { if (k.NewValue) { this.FadeIn(200); } else { this.FadeOut(500); } }); settings?.BindWith(SentakkiRulesetSettings.RingColor, colorOption); colorOption.BindValueChanged(c => { AccentColour = Color4.White.Opacity(0.2f); if (c.NewValue == ColorOption.Default) { this.FadeColour(Color4.White, 200); } else if (c.NewValue == ColorOption.Difficulty) { this.FadeColour(colours.ForDifficultyRating(ruleset?.Beatmap.BeatmapInfo.DifficultyRating ?? DifficultyRating.Normal, true), 200); } else if (c.NewValue == ColorOption.Skin) { this.FadeColour(skin.Value.GetConfig <GlobalSkinColours, Color4>(GlobalSkinColours.MenuGlow)?.Value ?? Color4.White, 200); } }); }
private void load(OsuColour colours) { var starRatingParts = beatmap.StarDifficulty.ToString("0.00", CultureInfo.InvariantCulture).Split('.'); string wholePart = starRatingParts[0]; string fractionPart = starRatingParts[1]; string separator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator; ColourInfo backgroundColour = beatmap.DifficultyRating == DifficultyRating.ExpertPlus ? ColourInfo.GradientVertical(Color4Extensions.FromHex("#C1C1C1"), Color4Extensions.FromHex("#595959")) : (ColourInfo)colours.ForDifficultyRating(beatmap.DifficultyRating); InternalChildren = new Drawable[] { new CircularContainer { RelativeSizeAxes = Axes.Both, Masking = true, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = backgroundColour }, } }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = 8, Vertical = 4 }, Direction = FillDirection.Horizontal, Spacing = new Vector2(2, 0), Children = new Drawable[] { new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(7), Icon = FontAwesome.Solid.Star, Colour = Color4.Black }, new OsuTextFlowContainer(s => s.Font = OsuFont.Numeric.With(weight: FontWeight.Black)) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, TextAnchor = Anchor.BottomLeft, }.With(t => { t.AddText($"{wholePart}", s => { s.Colour = Color4.Black; s.Font = s.Font.With(size: 14); s.UseFullGlyphHeight = false; }); t.AddText($"{separator}{fractionPart}", s => { s.Colour = Color4.Black; s.Font = s.Font.With(size: 7); s.UseFullGlyphHeight = false; }); }) } } }; }