background dim settings for editor

View -> Background Dim

follow `DimLevel` and `BlurLevel`

Co-Authored-By: Dead_Bush_Sanpai <DeadBushSanpai@yandex.com>
This commit is contained in:
cdwcgt
2022-10-24 23:18:34 +09:00
parent de881cc5cb
commit a2682b3ce3
2 changed files with 22 additions and 3 deletions

View File

@ -122,6 +122,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.PositionalHitsoundsLevel, 0.2f, 0, 1); SetDefault(OsuSetting.PositionalHitsoundsLevel, 0.2f, 0, 1);
SetDefault(OsuSetting.DimLevel, 0.7, 0, 1, 0.01); SetDefault(OsuSetting.DimLevel, 0.7, 0, 1, 0.01);
SetDefault(OsuSetting.BlurLevel, 0, 0, 1, 0.01); SetDefault(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
SetDefault(OsuSetting.EditorUseDim, false);
SetDefault(OsuSetting.LightenDuringBreaks, true); SetDefault(OsuSetting.LightenDuringBreaks, true);
SetDefault(OsuSetting.HitLighting, true); SetDefault(OsuSetting.HitLighting, true);
@ -292,6 +293,7 @@ namespace osu.Game.Configuration
GameplayCursorDuringTouch, GameplayCursorDuringTouch,
DimLevel, DimLevel,
BlurLevel, BlurLevel,
EditorUseDim,
LightenDuringBreaks, LightenDuringBreaks,
ShowStoryboard, ShowStoryboard,
KeyOverlay, KeyOverlay,

View File

@ -176,6 +176,8 @@ namespace osu.Game.Screens.Edit
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private OnScreenDisplay onScreenDisplay { get; set; } private OnScreenDisplay onScreenDisplay { get; set; }
private Bindable<bool> useUserDim;
public Editor(EditorLoader loader = null) public Editor(EditorLoader loader = null)
{ {
this.loader = loader; this.loader = loader;
@ -260,6 +262,9 @@ namespace osu.Game.Screens.Edit
OsuMenuItem undoMenuItem; OsuMenuItem undoMenuItem;
OsuMenuItem redoMenuItem; OsuMenuItem redoMenuItem;
TernaryStateRadioMenuItem backgroundDim;
useUserDim = config.GetBindable<bool>(OsuSetting.EditorUseDim);
AddInternal(new OsuContextMenuContainer AddInternal(new OsuContextMenuContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -311,6 +316,7 @@ namespace osu.Game.Screens.Edit
Items = new MenuItem[] Items = new MenuItem[]
{ {
new WaveformOpacityMenuItem(config.GetBindable<float>(OsuSetting.EditorWaveformOpacity)), new WaveformOpacityMenuItem(config.GetBindable<float>(OsuSetting.EditorWaveformOpacity)),
backgroundDim = new TernaryStateRadioMenuItem("Background Dim", MenuItemType.Standard, _ => useUserDim.Value = !useUserDim.Value),
} }
} }
} }
@ -330,6 +336,13 @@ namespace osu.Game.Screens.Edit
changeHandler?.CanUndo.BindValueChanged(v => undoMenuItem.Action.Disabled = !v.NewValue, true); changeHandler?.CanUndo.BindValueChanged(v => undoMenuItem.Action.Disabled = !v.NewValue, true);
changeHandler?.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true); changeHandler?.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true);
useUserDim.BindValueChanged(s =>
{
dimBackground();
backgroundDim.State.Value = s.NewValue ? TernaryState.True : TernaryState.False;
});
backgroundDim.State.Value = useUserDim.Value ? TernaryState.True : TernaryState.False;
} }
[Resolved] [Resolved]
@ -626,9 +639,9 @@ namespace osu.Game.Screens.Edit
ApplyToBackground(b => ApplyToBackground(b =>
{ {
// todo: temporary. we want to be applying dim using the UserDimContainer eventually. // todo: temporary. we want to be applying dim using the UserDimContainer eventually.
b.FadeColour(Color4.DarkGray, 500); if (!useUserDim.Value) b.FadeColour(Color4.DarkGray, 500);
b.IgnoreUserSettings.Value = true; b.IgnoreUserSettings.Value = !useUserDim.Value;
b.BlurAmount.Value = 0; b.BlurAmount.Value = 0;
}); });
} }
@ -656,7 +669,11 @@ namespace osu.Game.Screens.Edit
} }
} }
ApplyToBackground(b => b.FadeColour(Color4.White, 500)); ApplyToBackground(b =>
{
b.FadeColour(Color4.White, 500);
b.IgnoreUserSettings.Value = true;
});
resetTrack(); resetTrack();
refetchBeatmap(); refetchBeatmap();