mirror of
https://github.com/ppy/osu.git
synced 2025-03-22 21:00:33 +08:00
Update SliderBar to use OnUserChange method.
This commit is contained in:
parent
ca1fb81ff5
commit
d6fa51dc5c
@ -63,15 +63,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
rightBox.Colour = colours.Pink;
|
||||
}
|
||||
|
||||
private void playSample()
|
||||
{
|
||||
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50)
|
||||
return;
|
||||
lastSampleTime = Clock.CurrentTime;
|
||||
sample.Frequency.Value = 1 + NormalizedValue * 0.2f;
|
||||
sample.Play();
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
nub.Glowing = true;
|
||||
@ -84,11 +75,19 @@ namespace osu.Game.Graphics.UserInterface
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
protected override void OnUserChange()
|
||||
{
|
||||
if (args.Key == Key.Left || args.Key == Key.Right)
|
||||
playSample();
|
||||
return base.OnKeyDown(state, args);
|
||||
base.OnUserChange();
|
||||
playSample();
|
||||
}
|
||||
|
||||
private void playSample()
|
||||
{
|
||||
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50)
|
||||
return;
|
||||
lastSampleTime = Clock.CurrentTime;
|
||||
sample.Frequency.Value = 1 + NormalizedValue * 0.2f;
|
||||
sample.Play();
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
@ -103,18 +102,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
return base.OnMouseUp(state, args);
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
playSample();
|
||||
return base.OnClick(state);
|
||||
}
|
||||
|
||||
protected override bool OnDrag(InputState state)
|
||||
{
|
||||
playSample();
|
||||
return base.OnDrag(state);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
Loading…
x
Reference in New Issue
Block a user