1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00

Refactor WaveformOpacityMenuItem to not receive whole config

This commit is contained in:
Dean Herbert 2021-04-21 18:05:26 +09:00
parent cf55383fff
commit c6c91cd9a5
2 changed files with 4 additions and 5 deletions

View File

@ -226,7 +226,7 @@ namespace osu.Game.Screens.Edit
{
Items = new[]
{
new WaveformOpacityMenu(config)
new WaveformOpacityMenuItem(config.GetBindable<float>(OsuSetting.EditorWaveformOpacity)),
}
}
}

View File

@ -4,18 +4,17 @@
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Edit
{
internal class WaveformOpacityMenu : MenuItem
internal class WaveformOpacityMenuItem : MenuItem
{
private readonly Bindable<float> waveformOpacity;
private readonly Dictionary<float, ToggleMenuItem> menuItemLookup = new Dictionary<float, ToggleMenuItem>();
public WaveformOpacityMenu(OsuConfigManager config)
public WaveformOpacityMenuItem(Bindable<float> waveformOpacity)
: base("Waveform opacity")
{
Items = new[]
@ -26,7 +25,7 @@ namespace osu.Game.Screens.Edit
createMenuItem(1f),
};
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
this.waveformOpacity = waveformOpacity;
waveformOpacity.BindValueChanged(opacity =>
{
foreach (var kvp in menuItemLookup)