Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue displaying storyboard even if fully dimmed in specific circumstances #29967

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Lazy usage here is primarily intended to prevent the recalculation of the heuristic conditions described, which can get pretty heavy on maps like https://osu.ppy.sh/beatmapsets/470977#osu/1010030 (measured at least 3ms spent on computing this in profiling per call). That said, it doesn't do that much, so it could be skipped if deemed offensive.


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
Loading