mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 16:03:14 +08:00
Use scale correctly in DrawableSliderTick
This commit is contained in:
parent
efad9b3150
commit
5e153a3dd3
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -16,36 +18,49 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public const double ANIM_DURATION = 150;
|
public const double ANIM_DURATION = 150;
|
||||||
|
|
||||||
|
private const float default_tick_size = 16;
|
||||||
|
|
||||||
public bool Tracking { get; set; }
|
public bool Tracking { get; set; }
|
||||||
|
|
||||||
public override bool DisplayResult => false;
|
public override bool DisplayResult => false;
|
||||||
|
|
||||||
|
private readonly SkinnableDrawable scaleContainer;
|
||||||
|
|
||||||
public DrawableSliderTick(SliderTick sliderTick)
|
public DrawableSliderTick(SliderTick sliderTick)
|
||||||
: base(sliderTick)
|
: base(sliderTick)
|
||||||
{
|
{
|
||||||
Size = new Vector2(16 * sliderTick.Scale);
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChild = scaleContainer = new SkinnableDrawable("Play/osu/sliderscorepoint", _ => new CircularContainer
|
||||||
{
|
{
|
||||||
new SkinnableDrawable("Play/osu/sliderscorepoint", _ => new Container
|
Masking = true,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(default_tick_size),
|
||||||
|
BorderThickness = default_tick_size / 4,
|
||||||
|
BorderColour = Color4.White,
|
||||||
|
Child = new Box
|
||||||
{
|
{
|
||||||
Masking = true,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.Centre,
|
Colour = AccentColour.Value,
|
||||||
CornerRadius = Size.X / 2,
|
Alpha = 0.3f,
|
||||||
BorderThickness = 2,
|
}
|
||||||
BorderColour = Color4.White,
|
})
|
||||||
Child = new Box
|
{
|
||||||
{
|
Anchor = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
Origin = Anchor.Centre,
|
||||||
Colour = AccentColour.Value,
|
|
||||||
Alpha = 0.3f,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true);
|
||||||
|
scaleBindable.BindTo(HitObject.ScaleBindable);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
if (timeOffset >= 0)
|
if (timeOffset >= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user