mirror of
https://github.com/osukey/osukey.git
synced 2025-07-04 01:40:02 +09:00
add feature to adjust ScalingContainer
background dim
This commit is contained in:
@ -46,6 +46,8 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
private BackgroundScreenStack backgroundStack;
|
||||
|
||||
private Bindable<float> scalingMenuBackgroundDim;
|
||||
|
||||
private RectangleF? customRect;
|
||||
private bool customRectIsRelativePosition;
|
||||
|
||||
@ -138,6 +140,9 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
safeAreaPadding = safeArea.SafeAreaPadding.GetBoundCopy();
|
||||
safeAreaPadding.BindValueChanged(_ => Scheduler.AddOnce(updateSize));
|
||||
|
||||
scalingMenuBackgroundDim = config.GetBindable<float>(OsuSetting.ScalingMenuBackgroundDim);
|
||||
scalingMenuBackgroundDim.ValueChanged += _ => Scheduler.AddOnce(updateSize);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -148,7 +153,9 @@ namespace osu.Game.Graphics.Containers
|
||||
sizableContainer.FinishTransforms();
|
||||
}
|
||||
|
||||
private bool requiresBackgroundVisible => (scalingMode.Value == ScalingMode.Everything || scalingMode.Value == ScalingMode.ExcludeOverlays) && (sizeX.Value != 1 || sizeY.Value != 1);
|
||||
private bool requiresBackgroundVisible => (scalingMode.Value == ScalingMode.Everything || scalingMode.Value == ScalingMode.ExcludeOverlays)
|
||||
&& (sizeX.Value != 1 || sizeY.Value != 1)
|
||||
&& scalingMenuBackgroundDim.Value != 1f;
|
||||
|
||||
private void updateSize()
|
||||
{
|
||||
@ -161,7 +168,6 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
AddInternal(backgroundStack = new BackgroundScreenStack
|
||||
{
|
||||
Colour = OsuColour.Gray(0.1f),
|
||||
Alpha = 0,
|
||||
Depth = float.MaxValue
|
||||
});
|
||||
@ -170,6 +176,7 @@ namespace osu.Game.Graphics.Containers
|
||||
}
|
||||
|
||||
backgroundStack.FadeIn(TRANSITION_DURATION);
|
||||
backgroundStack.FadeColour(OsuColour.Gray(1.0f - scalingMenuBackgroundDim.Value), 800, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
backgroundStack?.FadeOut(TRANSITION_DURATION);
|
||||
|
Reference in New Issue
Block a user