1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Update code in accordance with the code review

This commit is contained in:
TocoToucan 2016-10-12 20:45:42 +03:00
parent ce391301fa
commit 00db36fdbe
2 changed files with 13 additions and 14 deletions

View File

@ -1,9 +1,9 @@
using System.Linq;
using osu.Framework;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Graphics.Transformations;
using OpenTK;
namespace osu.Game
{
@ -30,8 +30,8 @@ namespace osu.Game
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Position = new Vector2(10, 30),
Spacing = new Vector2(15,0),
Alpha = 0,
Padding = new Vector2(15, 0),
Children = new Drawable[]
{
volumeMeterMaster = new VolumeMeter("Master", VolumeGlobal),
@ -45,17 +45,15 @@ namespace osu.Game
protected override bool OnWheelDown(InputState state)
{
appear();
if (volumeMetersContainer.Children.All(vm => !vm.Contains(state.Mouse.Position)))
volumeMeterMaster.TriggerWheelDown(state);
return base.OnWheelDown(state);
volumeMeterMaster.TriggerWheelDown(state);
return true;
}
protected override bool OnWheelUp(InputState state)
{
appear();
if (volumeMetersContainer.Children.All(vm => !vm.Contains(state.Mouse.Position)))
volumeMeterMaster.TriggerWheelUp(state);
return base.OnWheelUp(state);
volumeMeterMaster.TriggerWheelUp(state);
return true;
}
private void appear()

View File

@ -1,4 +1,5 @@
using osu.Framework.Configuration;
using osu.Framework;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
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();
}
@ -62,14 +63,14 @@ namespace osu.Game
{
volume.Value += 0.05f;
updateFill();
return base.OnWheelUp(state);
return true;
}
protected override bool OnWheelDown(InputState state)
{
volume.Value -= 0.05f;
updateFill();
return base.OnWheelDown(state);
return true;
}
private void updateFill() => meterFill.ScaleTo(new Vector2(1, (float)volume.Value), 300, EasingTypes.OutQuint);