mirror of
https://github.com/ppy/osu
synced 2025-03-25 04:18:03 +00:00
Update code in accordance with the code review
This commit is contained in:
parent
ce391301fa
commit
00db36fdbe
@ -1,9 +1,9 @@
|
|||||||
using System.Linq;
|
using osu.Framework;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
@ -30,8 +30,8 @@ namespace osu.Game
|
|||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
Position = new Vector2(10, 30),
|
Position = new Vector2(10, 30),
|
||||||
|
Spacing = new Vector2(15,0),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Padding = new Vector2(15, 0),
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
volumeMeterMaster = new VolumeMeter("Master", VolumeGlobal),
|
volumeMeterMaster = new VolumeMeter("Master", VolumeGlobal),
|
||||||
@ -45,17 +45,15 @@ namespace osu.Game
|
|||||||
protected override bool OnWheelDown(InputState state)
|
protected override bool OnWheelDown(InputState state)
|
||||||
{
|
{
|
||||||
appear();
|
appear();
|
||||||
if (volumeMetersContainer.Children.All(vm => !vm.Contains(state.Mouse.Position)))
|
volumeMeterMaster.TriggerWheelDown(state);
|
||||||
volumeMeterMaster.TriggerWheelDown(state);
|
return true;
|
||||||
return base.OnWheelDown(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnWheelUp(InputState state)
|
protected override bool OnWheelUp(InputState state)
|
||||||
{
|
{
|
||||||
appear();
|
appear();
|
||||||
if (volumeMetersContainer.Children.All(vm => !vm.Contains(state.Mouse.Position)))
|
volumeMeterMaster.TriggerWheelUp(state);
|
||||||
volumeMeterMaster.TriggerWheelUp(state);
|
return true;
|
||||||
return base.OnWheelUp(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void appear()
|
private void appear()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using osu.Framework.Configuration;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Drawables;
|
using osu.Framework.Graphics.Drawables;
|
||||||
@ -52,9 +53,9 @@ namespace osu.Game
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load();
|
base.Load(game);
|
||||||
updateFill();
|
updateFill();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,14 +63,14 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
volume.Value += 0.05f;
|
volume.Value += 0.05f;
|
||||||
updateFill();
|
updateFill();
|
||||||
return base.OnWheelUp(state);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnWheelDown(InputState state)
|
protected override bool OnWheelDown(InputState state)
|
||||||
{
|
{
|
||||||
volume.Value -= 0.05f;
|
volume.Value -= 0.05f;
|
||||||
updateFill();
|
updateFill();
|
||||||
return base.OnWheelDown(state);
|
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.Value), 300, EasingTypes.OutQuint);
|
||||||
|
Loading…
Reference in New Issue
Block a user