mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 08:12:55 +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.Objects.Drawables;
|
||||||
using osu.Game.Modes.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Modes.Osu.Objects.Drawables.Pieces;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
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) },
|
bouncer1 = new SliderBouncer(slider, false) { Position = slider.Curve.PositionAt(1) },
|
||||||
bouncer2 = new SliderBouncer(slider, true) { Position = slider.Position },
|
bouncer2 = new SliderBouncer(slider, true) { Position = slider.Position },
|
||||||
ball = new SliderBall(slider),
|
|
||||||
initialCircle = new DrawableHitCircle(new HitCircle
|
initialCircle = new DrawableHitCircle(new HitCircle
|
||||||
{
|
{
|
||||||
StartTime = s.StartTime,
|
StartTime = s.StartTime,
|
||||||
Position = s.Position,
|
Position = s.Position,
|
||||||
Colour = s.Colour,
|
Colour = s.Colour,
|
||||||
Sample = s.Sample,
|
Sample = s.Sample,
|
||||||
})
|
}),
|
||||||
{
|
ball = new SliderBall(slider),
|
||||||
Depth = -1 //override time-based depth.
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
components.Add(body);
|
components.Add(body);
|
||||||
@ -104,14 +102,22 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
base.UpdateInitialState();
|
base.UpdateInitialState();
|
||||||
body.Alpha = 1;
|
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)
|
protected override void UpdateState(ArmedState state)
|
||||||
{
|
{
|
||||||
base.UpdateState(state);
|
base.UpdateState(state);
|
||||||
|
|
||||||
|
ball.FadeIn();
|
||||||
|
|
||||||
Delay(HitObject.Duration, true);
|
Delay(HitObject.Duration, true);
|
||||||
|
|
||||||
body.FadeOut(160);
|
body.FadeOut(160);
|
||||||
|
ball.FadeOut(160);
|
||||||
|
|
||||||
FadeOut(800);
|
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()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
CornerRadius = DrawWidth / 2;
|
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)
|
public void UpdateProgress(double progress, int repeat)
|
||||||
{
|
{
|
||||||
Alpha = Time.Current >= slider.StartTime && Time.Current <= slider.EndTime ? 1 : 0;
|
|
||||||
Position = slider.Curve.PositionAt(progress);
|
Position = slider.Curve.PositionAt(progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
|
|
||||||
public override void Add(DrawableHitObject h)
|
public override void Add(DrawableHitObject h)
|
||||||
{
|
{
|
||||||
|
h.Depth = (float)h.HitObject.StartTime;
|
||||||
DrawableHitCircle c = h as DrawableHitCircle;
|
DrawableHitCircle c = h as DrawableHitCircle;
|
||||||
if (c != null)
|
if (c != null)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,6 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
public DrawableHitObject(HitObject hitObject)
|
public DrawableHitObject(HitObject hitObject)
|
||||||
{
|
{
|
||||||
HitObject = hitObject;
|
HitObject = hitObject;
|
||||||
Depth = (float)hitObject.StartTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArmedState state;
|
private ArmedState state;
|
||||||
|
Loading…
Reference in New Issue
Block a user