1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 22:29:28 +08:00

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
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2
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.DimLevel, 0.7, 0, 1, 0.01);
SetDefault(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
SetDefault(OsuSetting.EditorUseDim, false);
SetDefault(OsuSetting.LightenDuringBreaks, true);
SetDefault(OsuSetting.HitLighting, true);
@ -292,6 +293,7 @@ namespace osu.Game.Configuration
GameplayCursorDuringTouch,
DimLevel,
BlurLevel,
EditorUseDim,
LightenDuringBreaks,
ShowStoryboard,
KeyOverlay,

View File

@ -176,6 +176,8 @@ namespace osu.Game.Screens.Edit
[Resolved(canBeNull: true)]
private OnScreenDisplay onScreenDisplay { get; set; }
private Bindable<bool> useUserDim;
public Editor(EditorLoader loader = null)
{
this.loader = loader;
@ -260,6 +262,9 @@ namespace osu.Game.Screens.Edit
OsuMenuItem undoMenuItem;
OsuMenuItem redoMenuItem;
TernaryStateRadioMenuItem backgroundDim;
useUserDim = config.GetBindable<bool>(OsuSetting.EditorUseDim);
AddInternal(new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both,
@ -311,6 +316,7 @@ namespace osu.Game.Screens.Edit
Items = new MenuItem[]
{
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?.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]
@ -626,9 +639,9 @@ namespace osu.Game.Screens.Edit
ApplyToBackground(b =>
{
// 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;
});
}
@ -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();
refetchBeatmap();