mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 11:22:54 +08:00
Fix slider ball not tracking when mouse hasn't been moved since slider appeared.
This commit is contained in:
parent
6cfb174f02
commit
f8395c4d3f
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Osu.Objects.Drawables.Pieces;
|
||||
using OpenTK;
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
@ -39,17 +40,14 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
},
|
||||
bouncer1 = new SliderBouncer(slider, false) { Position = slider.Curve.PositionAt(1) },
|
||||
bouncer2 = new SliderBouncer(slider, true) { Position = slider.Position },
|
||||
ball = new SliderBall(slider),
|
||||
initialCircle = new DrawableHitCircle(new HitCircle
|
||||
{
|
||||
StartTime = s.StartTime,
|
||||
Position = s.Position,
|
||||
Colour = s.Colour,
|
||||
Sample = s.Sample,
|
||||
})
|
||||
{
|
||||
Depth = -1 //override time-based depth.
|
||||
},
|
||||
}),
|
||||
ball = new SliderBall(slider),
|
||||
};
|
||||
|
||||
components.Add(body);
|
||||
@ -104,14 +102,22 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
base.UpdateInitialState();
|
||||
body.Alpha = 1;
|
||||
|
||||
//we need to be visible to handle input events. note that we still don't get enough events (we don't get a position if the mouse hasn't moved since the slider appeared).
|
||||
ball.Alpha = 0.01f;
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
|
||||
ball.FadeIn();
|
||||
|
||||
Delay(HitObject.Duration, true);
|
||||
|
||||
body.FadeOut(160);
|
||||
ball.FadeOut(160);
|
||||
|
||||
FadeOut(800);
|
||||
}
|
||||
}
|
||||
|
@ -98,17 +98,18 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
}
|
||||
}
|
||||
|
||||
private bool validTrackingTime => Time.Current >= slider.StartTime && Time.Current <= slider.EndTime;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
CornerRadius = DrawWidth / 2;
|
||||
Tracking = lastState != null && Contains(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed;
|
||||
Tracking = validTrackingTime && lastState != null && Contains(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed;
|
||||
}
|
||||
|
||||
public void UpdateProgress(double progress, int repeat)
|
||||
{
|
||||
Alpha = Time.Current >= slider.StartTime && Time.Current <= slider.EndTime ? 1 : 0;
|
||||
Position = slider.Curve.PositionAt(progress);
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ namespace osu.Game.Modes.Osu.UI
|
||||
|
||||
public override void Add(DrawableHitObject h)
|
||||
{
|
||||
h.Depth = (float)h.HitObject.StartTime;
|
||||
DrawableHitCircle c = h as DrawableHitCircle;
|
||||
if (c != null)
|
||||
{
|
||||
|
@ -30,7 +30,6 @@ namespace osu.Game.Modes.Objects.Drawables
|
||||
public DrawableHitObject(HitObject hitObject)
|
||||
{
|
||||
HitObject = hitObject;
|
||||
Depth = (float)hitObject.StartTime;
|
||||
}
|
||||
|
||||
private ArmedState state;
|
||||
|
Loading…
Reference in New Issue
Block a user