private void setActive(VolumeControl newControl) { if (activeControl == newControl) { return; } activeControl.Active = false; activeControl = newControl; activeControl.Active = true; showControls(); }
public VolumeControlSet() : base(GameBase.Instance) { controls.Add(controlEffect = new VolumeControl(AudioEngine.VolumeEffect, @"effect", new Vector2(115, 75), Vector2.Zero, 0.5f, false, onReceivedHover, onRenewVisibleTime)); controls.Add(controlMaster = new VolumeControl(AudioEngine.VolumeMaster, @"master", new Vector2(57, 57), new Vector2(5, 20), 1, true, onReceivedHover, onRenewVisibleTime)); controls.Add(controlMusic = new VolumeControl(AudioEngine.VolumeMusic, @"music", new Vector2(87.5f, 110f), Vector2.Zero, 0.5f, false, onReceivedHover, onRenewVisibleTime)); spriteManager.Add( background = new pSprite(TextureManager.Load(@"volume-background-gradient", SkinSource.Osu), Fields.BottomRight, Origins.BottomRight, Clocks.Game, Vector2.Zero, 0, true, Color.TransparentWhite)); activeControl = controlMaster; InputManager.Bind(InputEventType.OnMouseWheelUp, onMouseWheelUp, InputTargetPriority.Volume, BindLifetime.Permanent); InputManager.Bind(InputEventType.OnMouseWheelDown, onMouseWheelDown, InputTargetPriority.Volume, BindLifetime.Permanent); InputManager.Bind(InputEventType.OnMouseWheelUp, onMouseWheelUpOverride, InputTargetPriority.AltOverrides, BindLifetime.Permanent); InputManager.Bind(InputEventType.OnMouseWheelDown, onMouseWheelDownOverride, InputTargetPriority.AltOverrides, BindLifetime.Permanent); InputManager.Bind(InputEventType.OnMouseWheelUp, onMouseWheelUpVisible, InputTargetPriority.Highest, BindLifetime.Permanent); InputManager.Bind(InputEventType.OnMouseWheelDown, onMouseWheelDownVisible, InputTargetPriority.Highest, BindLifetime.Permanent); }