More formatting fixes

This commit is contained in:
Dean Herbert 2019-02-28 20:30:23 +09:00
parent 86913e720f
commit 53eb0e7e4e
2 changed files with 15 additions and 12 deletions

View File

@ -18,9 +18,9 @@ namespace osu.Game.Graphics.Containers
{ {
private const float background_fade_duration = 800; private const float background_fade_duration = 800;
protected Bindable<double> DimLevel { get; private set; } private Bindable<double> dimLevel { get; set; }
protected Bindable<bool> ShowStoryboard { get; private set; } private Bindable<bool> showStoryboard { get; set; }
/// <summary> /// <summary>
/// Whether or not user-configured dim levels should be applied to the container. /// Whether or not user-configured dim levels should be applied to the container.
@ -41,10 +41,11 @@ namespace osu.Game.Graphics.Containers
/// <summary> /// <summary>
/// Creates a new <see cref="UserDimContainer"/>. /// Creates a new <see cref="UserDimContainer"/>.
/// </summary> /// </summary>
/// <param name="isStoryboard"> /// <param name="isStoryboard"> Whether or not this instance of UserDimContainer contains a storyboard.
/// Whether or not this instance of UserDimContainer contains a storyboard. /// <remarks>
/// While both backgrounds and storyboards allow user dim levels to be applied, storyboards can be toggled via <see cref="ShowStoryboard"/> /// While both backgrounds and storyboards allow user dim levels to be applied, storyboards can be toggled via <see cref="showStoryboard"/>
/// and can cause backgrounds to become hidden via <see cref="StoryboardReplacesBackground"/>. /// and can cause backgrounds to become hidden via <see cref="StoryboardReplacesBackground"/>.
/// </remarks>
/// </param> /// </param>
public UserDimContainer(bool isStoryboard = false) public UserDimContainer(bool isStoryboard = false)
{ {
@ -55,11 +56,11 @@ namespace osu.Game.Graphics.Containers
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)
{ {
DimLevel = config.GetBindable<double>(OsuSetting.DimLevel); dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard); showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
EnableUserDim.ValueChanged += _ => updateBackgroundDim(); EnableUserDim.ValueChanged += _ => updateBackgroundDim();
DimLevel.ValueChanged += _ => updateBackgroundDim(); dimLevel.ValueChanged += _ => updateBackgroundDim();
ShowStoryboard.ValueChanged += _ => updateBackgroundDim(); showStoryboard.ValueChanged += _ => updateBackgroundDim();
StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim(); StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim();
} }
@ -73,15 +74,15 @@ namespace osu.Game.Graphics.Containers
{ {
if (isStoryboard) if (isStoryboard)
{ {
DimContainer.FadeTo(!ShowStoryboard.Value || DimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); DimContainer.FadeTo(!showStoryboard.Value || dimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint);
} }
else else
{ {
// The background needs to be hidden in the case of it being replaced by the storyboard // The background needs to be hidden in the case of it being replaced by the storyboard
DimContainer.FadeTo(ShowStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint); DimContainer.FadeTo(showStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint);
} }
DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)DimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint); DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)dimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint);
} }
} }
} }

View File

@ -359,6 +359,7 @@ namespace osu.Game.Screens.Play
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable;
Task.Run(() => Task.Run(() =>
@ -417,6 +418,7 @@ namespace osu.Game.Screens.Play
{ {
float fadeOutDuration = instant ? 0 : 250; float fadeOutDuration = instant ? 0 : 250;
this.FadeOut(fadeOutDuration); this.FadeOut(fadeOutDuration);
Background.EnableUserDim.Value = false; Background.EnableUserDim.Value = false;
storyboardReplacesBackground.Value = false; storyboardReplacesBackground.Value = false;
} }