mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Refactor WaveformOpacityMenuItem
to not receive whole config
This commit is contained in:
@ -226,7 +226,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
Items = new[]
|
Items = new[]
|
||||||
{
|
{
|
||||||
new WaveformOpacityMenu(config)
|
new WaveformOpacityMenuItem(config.GetBindable<float>(OsuSetting.EditorWaveformOpacity)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,18 +4,17 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
internal class WaveformOpacityMenu : MenuItem
|
internal class WaveformOpacityMenuItem : MenuItem
|
||||||
{
|
{
|
||||||
private readonly Bindable<float> waveformOpacity;
|
private readonly Bindable<float> waveformOpacity;
|
||||||
|
|
||||||
private readonly Dictionary<float, ToggleMenuItem> menuItemLookup = new Dictionary<float, ToggleMenuItem>();
|
private readonly Dictionary<float, ToggleMenuItem> menuItemLookup = new Dictionary<float, ToggleMenuItem>();
|
||||||
|
|
||||||
public WaveformOpacityMenu(OsuConfigManager config)
|
public WaveformOpacityMenuItem(Bindable<float> waveformOpacity)
|
||||||
: base("Waveform opacity")
|
: base("Waveform opacity")
|
||||||
{
|
{
|
||||||
Items = new[]
|
Items = new[]
|
||||||
@ -26,7 +25,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
createMenuItem(1f),
|
createMenuItem(1f),
|
||||||
};
|
};
|
||||||
|
|
||||||
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
this.waveformOpacity = waveformOpacity;
|
||||||
waveformOpacity.BindValueChanged(opacity =>
|
waveformOpacity.BindValueChanged(opacity =>
|
||||||
{
|
{
|
||||||
foreach (var kvp in menuItemLookup)
|
foreach (var kvp in menuItemLookup)
|
Reference in New Issue
Block a user