mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Move all storyboard show logic into UserDimContainer
This commit is contained in:
@ -13,20 +13,42 @@ namespace osu.Game.Graphics.Containers
|
||||
public class UserDimContainer : Container
|
||||
{
|
||||
protected Bindable<double> DimLevel;
|
||||
|
||||
protected Bindable<bool> ShowStoryboard;
|
||||
public Bindable<bool> EnableUserDim = new Bindable<bool>();
|
||||
public Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
|
||||
|
||||
private readonly bool isStoryboard;
|
||||
|
||||
private const float BACKGROUND_FADE_DURATION = 800;
|
||||
|
||||
public UserDimContainer(bool isStoryboard = false)
|
||||
{
|
||||
this.isStoryboard = isStoryboard;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
DimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
EnableUserDim.ValueChanged += _ => updateBackgroundDim();
|
||||
DimLevel.ValueChanged += _ => updateBackgroundDim();
|
||||
ShowStoryboard.ValueChanged += _ => updateBackgroundDim();
|
||||
}
|
||||
|
||||
private void updateBackgroundDim()
|
||||
{
|
||||
this.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, 800, Easing.OutQuint);
|
||||
if (isStoryboard)
|
||||
{
|
||||
this.FadeTo(!ShowStoryboard || DimLevel == 1 ? 0 : 1, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The background needs to be hidden in the case of it being replaced
|
||||
this.FadeTo(ShowStoryboard && StoryboardReplacesBackground ? 0 : 1, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
this.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user