From 00db36fdbea4ce1895864fde7b7874380ea52ec1 Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Wed, 12 Oct 2016 20:45:42 +0300 Subject: [PATCH] Update code in accordance with the code review --- osu.Game/VolumeControl.cs | 16 +++++++--------- osu.Game/VolumeMeter.cs | 11 ++++++----- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/osu.Game/VolumeControl.cs b/osu.Game/VolumeControl.cs index dd789d1934..a63b2147fc 100644 --- a/osu.Game/VolumeControl.cs +++ b/osu.Game/VolumeControl.cs @@ -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() diff --git a/osu.Game/VolumeMeter.cs b/osu.Game/VolumeMeter.cs index 0f173ea465..23cd771098 100644 --- a/osu.Game/VolumeMeter.cs +++ b/osu.Game/VolumeMeter.cs @@ -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);