mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 11:12:54 +08:00
Improve appearing of the volume meters
This commit is contained in:
parent
00db36fdbe
commit
059e2a3c5a
@ -20,9 +20,18 @@ namespace osu.Game
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
private void volumeChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
appear();
|
||||
}
|
||||
|
||||
public override void Load(BaseGame game)
|
||||
{
|
||||
base.Load(game);
|
||||
VolumeGlobal.ValueChanged += volumeChanged;
|
||||
VolumeSample.ValueChanged += volumeChanged;
|
||||
VolumeTrack.ValueChanged += volumeChanged;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
volumeMetersContainer = new FlowContainer
|
||||
@ -44,14 +53,12 @@ namespace osu.Game
|
||||
|
||||
protected override bool OnWheelDown(InputState state)
|
||||
{
|
||||
appear();
|
||||
volumeMeterMaster.TriggerWheelDown(state);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnWheelUp(InputState state)
|
||||
{
|
||||
appear();
|
||||
volumeMeterMaster.TriggerWheelUp(state);
|
||||
return true;
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using osu.Framework;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Drawables;
|
||||
@ -53,26 +52,28 @@ namespace osu.Game
|
||||
};
|
||||
}
|
||||
|
||||
public override void Load(BaseGame game)
|
||||
public double Volume
|
||||
{
|
||||
base.Load(game);
|
||||
updateFill();
|
||||
get { return volume.Value; }
|
||||
private set
|
||||
{
|
||||
volume.Value = value;
|
||||
updateFill();
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnWheelUp(InputState state)
|
||||
{
|
||||
volume.Value += 0.05f;
|
||||
updateFill();
|
||||
Volume += 0.05f;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnWheelDown(InputState state)
|
||||
{
|
||||
volume.Value -= 0.05f;
|
||||
updateFill();
|
||||
Volume -= 0.05f;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateFill() => meterFill.ScaleTo(new Vector2(1, (float)volume.Value), 300, EasingTypes.OutQuint);
|
||||
private void updateFill() => meterFill.ScaleTo(new Vector2(1, (float)Volume), 300, EasingTypes.OutQuint);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user