1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Merge pull request #204 from peppy/general-fixes

General fixes
This commit is contained in:
Thomas Müller 2016-11-29 11:55:29 +01:00 committed by GitHub
commit aea3df257c
3 changed files with 14 additions and 19 deletions

View File

@ -14,10 +14,6 @@ namespace osu.Game.Graphics.UserInterface.Volume
{ {
internal class VolumeControl : OverlayContainer internal class VolumeControl : OverlayContainer
{ {
private BindableDouble volumeGlobal = new BindableDouble();
private BindableDouble volumeSample = new BindableDouble();
private BindableDouble volumeTrack = new BindableDouble();
private VolumeMeter volumeMeterMaster; private VolumeMeter volumeMeterMaster;
private void volumeChanged(object sender, EventArgs e) private void volumeChanged(object sender, EventArgs e)
@ -55,21 +51,18 @@ namespace osu.Game.Graphics.UserInterface.Volume
{ {
base.LoadComplete(); base.LoadComplete();
volumeGlobal.ValueChanged += volumeChanged; volumeMeterMaster.Bindable.ValueChanged += volumeChanged;
volumeSample.ValueChanged += volumeChanged; volumeMeterEffect.Bindable.ValueChanged += volumeChanged;
volumeTrack.ValueChanged += volumeChanged; volumeMeterMusic.Bindable.ValueChanged += volumeChanged;
volumeMeterMaster.Bindable.Weld(volumeGlobal);
volumeMeterEffect.Bindable.Weld(volumeSample);
volumeMeterMusic.Bindable.Weld(volumeTrack);
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
volumeGlobal.ValueChanged -= volumeChanged;
volumeSample.ValueChanged -= volumeChanged;
volumeTrack.ValueChanged -= volumeChanged;
base.Dispose(isDisposing); base.Dispose(isDisposing);
volumeMeterMaster.Bindable.ValueChanged -= volumeChanged;
volumeMeterEffect.Bindable.ValueChanged -= volumeChanged;
volumeMeterMusic.Bindable.ValueChanged -= volumeChanged;
} }
public void Adjust(InputState state) public void Adjust(InputState state)
@ -86,9 +79,9 @@ namespace osu.Game.Graphics.UserInterface.Volume
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
volumeGlobal.Weld(audio.Volume); volumeMeterMaster.Bindable.Weld(audio.Volume);
volumeSample.Weld(audio.VolumeSample); volumeMeterEffect.Bindable.Weld(audio.VolumeSample);
volumeTrack.Weld(audio.VolumeTrack); volumeMeterMusic.Bindable.Weld(audio.VolumeTrack);
} }
ScheduledDelegate popOutDelegate; ScheduledDelegate popOutDelegate;

View File

@ -41,6 +41,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
meterFill = new Box meterFill = new Box
{ {
Colour = Color4.White, Colour = Color4.White,
Scale = new Vector2(1, 0),
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre Anchor = Anchor.BottomCentre
@ -54,6 +55,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
Origin = Anchor.TopCentre Origin = Anchor.TopCentre
} }
}; };
Bindable.ValueChanged += delegate { updateFill(); };
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -68,7 +71,6 @@ namespace osu.Game.Graphics.UserInterface.Volume
private set private set
{ {
Bindable.Value = value; Bindable.Value = value;
updateFill();
} }
} }

View File

@ -41,7 +41,7 @@ namespace osu.Game
private void load() private void load()
{ {
Dependencies.Cache(this); Dependencies.Cache(this);
Dependencies.Cache(new OsuConfigManager(Host.Storage)); Dependencies.Cache(Config);
Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host)); Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host));
//this completely overrides the framework default. will need to change once we make a proper FontStore. //this completely overrides the framework default. will need to change once we make a proper FontStore.