mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Refactor volume control to load asynchronously.
This commit is contained in:
@ -19,9 +19,6 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
|
|
||||||
private VolumeMeter volumeMeterMaster;
|
private VolumeMeter volumeMeterMaster;
|
||||||
|
|
||||||
private FlowContainer content;
|
|
||||||
protected override Container<Drawable> Content => content;
|
|
||||||
|
|
||||||
private void volumeChanged(object sender, EventArgs e)
|
private void volumeChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Show();
|
Show();
|
||||||
@ -34,14 +31,23 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
Anchor = Anchor.BottomRight;
|
Anchor = Anchor.BottomRight;
|
||||||
Origin = Anchor.BottomRight;
|
Origin = Anchor.BottomRight;
|
||||||
|
|
||||||
AddInternal(content = new FlowContainer
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new FlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
Margin = new MarginPadding { Left = 10, Right = 10, Top = 30, Bottom = 30 },
|
Margin = new MarginPadding { Left = 10, Right = 10, Top = 30, Bottom = 30 },
|
||||||
Spacing = new Vector2(15, 0),
|
Spacing = new Vector2(15, 0),
|
||||||
});
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
volumeMeterMaster = new VolumeMeter("Master"),
|
||||||
|
volumeMeterEffect = new VolumeMeter("Effects"),
|
||||||
|
volumeMeterMusic = new VolumeMeter("Music")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -52,12 +58,9 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
VolumeSample.ValueChanged += volumeChanged;
|
VolumeSample.ValueChanged += volumeChanged;
|
||||||
VolumeTrack.ValueChanged += volumeChanged;
|
VolumeTrack.ValueChanged += volumeChanged;
|
||||||
|
|
||||||
Add(new[]
|
volumeMeterMaster.Bindable = VolumeGlobal;
|
||||||
{
|
volumeMeterEffect.Bindable = VolumeSample;
|
||||||
volumeMeterMaster = new VolumeMeter("Master", VolumeGlobal),
|
volumeMeterMusic.Bindable = VolumeTrack;
|
||||||
new VolumeMeter("Effects", VolumeSample),
|
|
||||||
new VolumeMeter("Music", VolumeTrack)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
@ -81,6 +84,9 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
|
|
||||||
ScheduledDelegate popOutDelegate;
|
ScheduledDelegate popOutDelegate;
|
||||||
|
|
||||||
|
private VolumeMeter volumeMeterEffect;
|
||||||
|
private VolumeMeter volumeMeterMusic;
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
ClearTransformations();
|
ClearTransformations();
|
||||||
|
@ -13,11 +13,10 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
internal class VolumeMeter : Container
|
internal class VolumeMeter : Container
|
||||||
{
|
{
|
||||||
private Box meterFill;
|
private Box meterFill;
|
||||||
private BindableDouble volume;
|
public BindableDouble Bindable;
|
||||||
|
|
||||||
public VolumeMeter(string meterName, BindableDouble volume)
|
public VolumeMeter(string meterName)
|
||||||
{
|
{
|
||||||
this.volume = volume;
|
|
||||||
Size = new Vector2(40, 180);
|
Size = new Vector2(40, 180);
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -65,10 +64,10 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
|
|
||||||
public double Volume
|
public double Volume
|
||||||
{
|
{
|
||||||
get { return volume.Value; }
|
get { return Bindable.Value; }
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
volume.Value = value;
|
Bindable.Value = value;
|
||||||
updateFill();
|
updateFill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user