Skip to content

Commit

Permalink
Continue displaying storyboard even if fully dimmed in specific circu…
Browse files Browse the repository at this point in the history
…mstances

Closes ppy#9315.
Closes ppy#29867.

Notably, this does nothing about
ppy#25075, but I'm not sure what to do
with that one in the first place.
  • Loading branch information
bdach committed Sep 23, 2024
1 parent ccf1acc commit 0f758ca
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion osu.Game/Screens/Play/DimmableStoryboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

#nullable disable

using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
Expand All @@ -24,6 +26,21 @@ public partial class DimmableStoryboard : UserDimContainer
private readonly Storyboard storyboard;
private readonly IReadOnlyList<Mod> mods;

/// <summary>
/// In certain circumstances, the storyboard cannot be hidden entirely even if it is fully dimmed. Such circumstances include:
/// <list type="bullet">
/// <item>
/// cases where the storyboard has an overlay layer sprite, as it should continue to display fully dimmed
/// <i>in front of</i> the playfield (https://github.com/ppy/osu/issues/29867),
/// </item>
/// <item>
/// cases where the storyboard includes samples - as they are played back via drawable samples,
/// they must be present for the playback to occur (https://github.com/ppy/osu/issues/9315).
/// </item>
/// </list>
/// </summary>
private readonly Lazy<bool> storyboardMustAlwaysBePresent;

private DrawableStoryboard drawableStoryboard;

/// <summary>
Expand All @@ -38,6 +55,8 @@ public DimmableStoryboard(Storyboard storyboard, IReadOnlyList<Mod> mods)
{
this.storyboard = storyboard;
this.mods = mods;

storyboardMustAlwaysBePresent = new Lazy<bool>(() => storyboard.GetLayer(@"Overlay").Elements.Any() || storyboard.Layers.Any(l => l.Elements.OfType<StoryboardSampleInfo>().Any()));
}

[BackgroundDependencyLoader]
Expand All @@ -54,7 +73,7 @@ protected override void LoadComplete()
base.LoadComplete();
}

protected override bool ShowDimContent => IgnoreUserSettings.Value || (ShowStoryboard.Value && DimLevel < 1);
protected override bool ShowDimContent => IgnoreUserSettings.Value || (ShowStoryboard.Value && (DimLevel < 1 || storyboardMustAlwaysBePresent.Value));

private void initializeStoryboard(bool async)
{
Expand Down

0 comments on commit 0f758ca

Please sign in to comment.