2016-10-13 01:45:42 +08:00
|
|
|
|
using osu.Framework;
|
2016-10-12 22:36:42 +08:00
|
|
|
|
using osu.Framework.Configuration;
|
2016-10-07 02:05:26 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Input;
|
2016-10-13 01:45:42 +08:00
|
|
|
|
using OpenTK;
|
2016-10-07 02:05:26 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game
|
|
|
|
|
{
|
|
|
|
|
internal class VolumeControl : Container
|
|
|
|
|
{
|
2016-10-10 01:45:34 +08:00
|
|
|
|
private FlowContainer volumeMetersContainer;
|
2016-10-12 22:36:42 +08:00
|
|
|
|
private VolumeMeter volumeMeterMaster;
|
2016-10-07 02:05:26 +08:00
|
|
|
|
public BindableDouble VolumeGlobal { get; set; }
|
|
|
|
|
public BindableDouble VolumeSample { get; set; }
|
|
|
|
|
public BindableDouble VolumeTrack { get; set; }
|
|
|
|
|
|
|
|
|
|
public VolumeControl()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 16:17:26 +08:00
|
|
|
|
public override void Load(BaseGame game)
|
2016-10-07 02:05:26 +08:00
|
|
|
|
{
|
2016-10-10 16:17:26 +08:00
|
|
|
|
base.Load(game);
|
2016-10-07 02:05:26 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2016-10-10 22:19:05 +08:00
|
|
|
|
volumeMetersContainer = new FlowContainer
|
|
|
|
|
{
|
2016-10-07 02:05:26 +08:00
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
|
Origin = Anchor.BottomRight,
|
2016-10-10 01:45:34 +08:00
|
|
|
|
Position = new Vector2(10, 30),
|
2016-10-13 01:45:42 +08:00
|
|
|
|
Spacing = new Vector2(15,0),
|
2016-10-07 02:27:24 +08:00
|
|
|
|
Alpha = 0,
|
2016-10-07 02:05:26 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2016-10-12 22:36:42 +08:00
|
|
|
|
volumeMeterMaster = new VolumeMeter("Master", VolumeGlobal),
|
2016-10-10 22:19:05 +08:00
|
|
|
|
new VolumeMeter("Effects", VolumeSample),
|
|
|
|
|
new VolumeMeter("Music", VolumeTrack)
|
2016-10-07 02:05:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnWheelDown(InputState state)
|
|
|
|
|
{
|
|
|
|
|
appear();
|
2016-10-13 01:45:42 +08:00
|
|
|
|
volumeMeterMaster.TriggerWheelDown(state);
|
|
|
|
|
return true;
|
2016-10-07 02:05:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnWheelUp(InputState state)
|
|
|
|
|
{
|
|
|
|
|
appear();
|
2016-10-13 01:45:42 +08:00
|
|
|
|
volumeMeterMaster.TriggerWheelUp(state);
|
|
|
|
|
return true;
|
2016-10-07 02:05:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void appear()
|
|
|
|
|
{
|
2016-10-10 01:45:34 +08:00
|
|
|
|
volumeMetersContainer.ClearTransformations();
|
|
|
|
|
volumeMetersContainer.FadeIn(100);
|
|
|
|
|
volumeMetersContainer.Delay(1000);
|
|
|
|
|
volumeMetersContainer.FadeOut(100);
|
2016-10-07 02:05:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|