mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +08:00
Implement tinting slider ball with combo colour
This commit is contained in:
parent
8fcfd82316
commit
f6291170b1
@ -34,6 +34,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||
private readonly IBindable<SliderPath> pathBindable = new Bindable<SliderPath>();
|
||||
|
||||
private readonly Bindable<bool> alwaysTintSliderBall = new Bindable<bool>(true);
|
||||
private bool allowSliderBallTint;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private OsuRulesetConfigManager config { get; set; }
|
||||
|
||||
@ -106,6 +109,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
config?.BindWith(OsuRulesetSetting.SnakingInSliders, Body.SnakingIn);
|
||||
config?.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut);
|
||||
config?.BindWith(OsuRulesetSetting.AlwaysTintSliderBall, alwaysTintSliderBall);
|
||||
|
||||
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||
scaleBindable.BindValueChanged(scale =>
|
||||
@ -120,9 +124,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
pathBindable.BindValueChanged(_ => Body.Refresh());
|
||||
|
||||
alwaysTintSliderBall.BindValueChanged(_ => updateSliderBallTint());
|
||||
|
||||
AccentColour.BindValueChanged(colour =>
|
||||
{
|
||||
Body.AccentColour = colour.NewValue;
|
||||
updateSliderBallTint();
|
||||
|
||||
foreach (var drawableHitObject in NestedHitObjects)
|
||||
drawableHitObject.AccentColour.Value = colour.NewValue;
|
||||
@ -173,10 +180,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
Body.AccentColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderTrackOverride)?.Value ?? AccentColour.Value;
|
||||
Body.BorderColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBorder)?.Value ?? Color4.White;
|
||||
|
||||
allowSliderBallTint = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.AllowSliderBallTint)?.Value ?? false;
|
||||
updateSliderBallTint();
|
||||
}
|
||||
|
||||
private void updatePathRadius() => Body.PathRadius = slider.Scale * sliderPathRadius;
|
||||
|
||||
private void updateSliderBallTint() => Ball.Colour = (alwaysTintSliderBall.Value | allowSliderBallTint) ? AccentColour.Value : Color4.White;
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (userTriggered || Time.Current < slider.EndTime)
|
||||
|
Loading…
Reference in New Issue
Block a user