mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:52:55 +08:00
Add slider body
This commit is contained in:
parent
403cc59208
commit
cd84503e62
@ -23,7 +23,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
{
|
||||
public class ArgonMainCirclePiece : CompositeDrawable
|
||||
{
|
||||
private readonly Circle outerFill;
|
||||
public const float BORDER_THICKNESS = 7;
|
||||
|
||||
public const float OUTER_GRADIENT_SIZE = OsuHitObject.OBJECT_RADIUS * 2 - BORDER_THICKNESS * 3;
|
||||
|
||||
private readonly Circle outerGradient;
|
||||
private readonly Circle innerGradient;
|
||||
private readonly Circle innerFill;
|
||||
@ -45,33 +48,27 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
const float border_thickness = 7;
|
||||
const float fill_thickness = 24;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
outerFill = new Circle // renders white outer border and dark fill
|
||||
{
|
||||
Size = Size,
|
||||
Alpha = 1,
|
||||
},
|
||||
outerGradient = new Circle // renders the outer bright gradient
|
||||
{
|
||||
Size = outerFill.Size - new Vector2(border_thickness * 3),
|
||||
Size = new Vector2(OUTER_GRADIENT_SIZE),
|
||||
Alpha = 1,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
innerGradient = new Circle // renders the inner bright gradient
|
||||
{
|
||||
Size = outerGradient.Size - new Vector2(fill_thickness),
|
||||
Size = new Vector2(OUTER_GRADIENT_SIZE - fill_thickness),
|
||||
Alpha = 1,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
innerFill = new Circle // renders the inner dark fill
|
||||
{
|
||||
Size = innerGradient.Size - new Vector2(fill_thickness),
|
||||
Size = new Vector2(OUTER_GRADIENT_SIZE - 2 * fill_thickness),
|
||||
Alpha = 1,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -85,7 +82,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
Text = @"1",
|
||||
},
|
||||
flash = new FlashPiece(),
|
||||
border = new RingPiece(border_thickness),
|
||||
border = new RingPiece(BORDER_THICKNESS),
|
||||
};
|
||||
}
|
||||
|
||||
@ -104,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
|
||||
accentColour.BindValueChanged(colour =>
|
||||
{
|
||||
outerFill.Colour = innerFill.Colour = colour.NewValue.Darken(4);
|
||||
innerFill.Colour = colour.NewValue.Darken(4);
|
||||
outerGradient.Colour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.1f));
|
||||
innerGradient.Colour = ColourInfo.GradientVertical(colour.NewValue.Darken(0.5f), colour.NewValue.Darken(0.6f));
|
||||
flash.Colour = colour.NewValue;
|
||||
@ -137,7 +134,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
|
||||
// The fill layers add too much noise during the explosion animation.
|
||||
// They will be hidden by the additive effects anyway.
|
||||
outerFill.FadeOut(flash_in_duration, Easing.OutQuint);
|
||||
innerFill.FadeOut(flash_in_duration, Easing.OutQuint);
|
||||
|
||||
// The inner-most gradient should actually be resizing, but is only visible for
|
||||
|
38
osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderBody.cs
Normal file
38
osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderBody.cs
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Game.Rulesets.Osu.Skinning.Default;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
{
|
||||
public class ArgonSliderBody : PlaySliderBody
|
||||
{
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
AccentColourBindable.BindValueChanged(accent =>
|
||||
{
|
||||
BorderColour = accent.NewValue;
|
||||
}, true);
|
||||
ScaleBindable.BindValueChanged(scale => PathRadius = ArgonMainCirclePiece.OUTER_GRADIENT_SIZE / 2 * scale.NewValue, true);
|
||||
|
||||
BorderSize = ArgonMainCirclePiece.BORDER_THICKNESS / 4;
|
||||
}
|
||||
|
||||
protected override Default.DrawableSliderPath CreateSliderPath() => new DrawableSliderPath();
|
||||
|
||||
private class DrawableSliderPath : Default.DrawableSliderPath
|
||||
{
|
||||
protected override Color4 ColourAt(float position)
|
||||
{
|
||||
if (CalculatedBorderPortion != 0f && position <= CalculatedBorderPortion)
|
||||
return BorderColour;
|
||||
|
||||
return AccentColour.Darken(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
case OsuSkinComponents.HitCircle:
|
||||
case OsuSkinComponents.SliderHeadHitCircle:
|
||||
return new ArgonMainCirclePiece();
|
||||
|
||||
case OsuSkinComponents.SliderBody:
|
||||
return new ArgonSliderBody();
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -16,9 +16,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
{
|
||||
public abstract class PlaySliderBody : SnakingSliderBody
|
||||
{
|
||||
private IBindable<float> scaleBindable;
|
||||
protected IBindable<float> ScaleBindable { get; private set; } = null!;
|
||||
|
||||
protected IBindable<Color4> AccentColourBindable { get; private set; } = null!;
|
||||
|
||||
private IBindable<int> pathVersion;
|
||||
private IBindable<Color4> accentColour;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private OsuRulesetConfigManager config { get; set; }
|
||||
@ -30,14 +32,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
{
|
||||
var drawableSlider = (DrawableSlider)drawableObject;
|
||||
|
||||
scaleBindable = drawableSlider.ScaleBindable.GetBoundCopy();
|
||||
scaleBindable.BindValueChanged(scale => PathRadius = OsuHitObject.OBJECT_RADIUS * scale.NewValue, true);
|
||||
ScaleBindable = drawableSlider.ScaleBindable.GetBoundCopy();
|
||||
ScaleBindable.BindValueChanged(scale => PathRadius = OsuHitObject.OBJECT_RADIUS * scale.NewValue, true);
|
||||
|
||||
pathVersion = drawableSlider.PathVersion.GetBoundCopy();
|
||||
pathVersion.BindValueChanged(_ => Refresh());
|
||||
|
||||
accentColour = drawableObject.AccentColour.GetBoundCopy();
|
||||
accentColour.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);
|
||||
AccentColourBindable = drawableObject.AccentColour.GetBoundCopy();
|
||||
AccentColourBindable.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);
|
||||
|
||||
config?.BindWith(OsuRulesetSetting.SnakingInSliders, SnakingIn);
|
||||
config?.BindWith(OsuRulesetSetting.SnakingOutSliders, configSnakingOut);
|
||||
|
Loading…
Reference in New Issue
Block a user