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

Add shadow around break overlay middle content to make sure it remains visible #29615

Merged
merged 5 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 12 additions & 3 deletions osu.Game.Tests/Visual/Gameplay/TestSceneBreakTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Timing;
using osu.Game.Beatmaps.Timing;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
using osuTK.Graphics;

namespace osu.Game.Tests.Visual.Gameplay
{
Expand All @@ -28,14 +32,19 @@ public partial class TestSceneBreakTracker : OsuTestScene

public TestSceneBreakTracker()
{
AddRange(new Drawable[]
Children = new Drawable[]
{
new Box
{
Colour = Color4.White,
RelativeSizeAxes = Axes.Both,
},
breakTracker = new TestBreakTracker(),
breakOverlay = new BreakOverlay(true, null)
breakOverlay = new BreakOverlay(true, new ScoreProcessor(new OsuRuleset()))
{
ProcessCustomClock = false,
}
});
};
}

protected override void Update()
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Screens/Play/Break/LetterboxOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace osu.Game.Screens.Play.Break
{
public partial class LetterboxOverlay : CompositeDrawable
{
private const int height = 350;

private static readonly Color4 transparent_black = new Color4(0, 0, 0, 0);

public LetterboxOverlay()
{
const int height = 150;

RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
Expand Down
40 changes: 30 additions & 10 deletions osu.Game/Screens/Play/BreakOverlay.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using System;
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Beatmaps.Timing;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.Play.Break;
Expand All @@ -29,7 +30,7 @@ public partial class BreakOverlay : Container

private readonly Container fadeContainer;

private IReadOnlyList<BreakPeriod> breaks;
private IReadOnlyList<BreakPeriod> breaks = Array.Empty<BreakPeriod>();

public IReadOnlyList<BreakPeriod> Breaks
{
Expand Down Expand Up @@ -69,6 +70,30 @@ public BreakOverlay(bool letterboxing, ScoreProcessor scoreProcessor)
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 80,
Height = 4,
Masking = true,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Radius = 260,
Colour = OsuColour.Gray(0.2f).Opacity(0.8f),
Roundness = 12
},
Children = new Drawable[]
{
new Box
{
Alpha = 0,
AlwaysPresent = true,
RelativeSizeAxes = Axes.Both,
},
}
},
remainingTimeAdjustmentBox = new Container
{
Anchor = Anchor.Centre,
Expand Down Expand Up @@ -111,11 +136,8 @@ protected override void LoadComplete()
base.LoadComplete();
initializeBreaks();

if (scoreProcessor != null)
{
info.AccuracyDisplay.Current.BindTo(scoreProcessor.Accuracy);
((IBindable<ScoreRank>)info.GradeDisplay.Current).BindTo(scoreProcessor.Rank);
}
info.AccuracyDisplay.Current.BindTo(scoreProcessor.Accuracy);
((IBindable<ScoreRank>)info.GradeDisplay.Current).BindTo(scoreProcessor.Rank);
}

protected override void Update()
Expand All @@ -130,8 +152,6 @@ private void initializeBreaks()
FinishTransforms(true);
Scheduler.CancelDelayedTasks();

if (breaks == null) return; // we need breaks.

foreach (var b in breaks)
{
if (!b.HasEffect)
Expand Down
16 changes: 8 additions & 8 deletions osu.Game/Screens/Play/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,6 @@ private Drawable createOverlayComponents(IWorkingBeatmap working)
Children = new[]
{
DimmableStoryboard.OverlayLayerContainer.CreateProxy(),
BreakOverlay = new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
{
Clock = DrawableRuleset.FrameStableClock,
ProcessCustomClock = false,
Breaks = working.Beatmap.Breaks
},
// display the cursor above some HUD elements.
DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
HUDOverlay = new HUDOverlay(DrawableRuleset, GameplayState.Mods, Configuration.AlwaysShowLeaderboard)
{
HoldToQuit =
Expand All @@ -472,6 +464,14 @@ private Drawable createOverlayComponents(IWorkingBeatmap working)
Anchor = Anchor.Centre,
Origin = Anchor.Centre
},
BreakOverlay = new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
{
Clock = DrawableRuleset.FrameStableClock,
ProcessCustomClock = false,
Breaks = working.Beatmap.Breaks
},
// display the cursor above some HUD elements.
DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
Comment on lines +473 to +474
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess I understand why this change was made but I will note that it leads to functional differences, namely that the cursor will now be above all HUD elements, not just some of them:

master this PR
osu_2024-08-27_09-52-06 osu_2024-08-27_09-52-43

(see top left area on the screenshots above - on the left, the cursor is underneath the translucent wedge, and on the right it is not).

Was this particular behaviour change intentional or not?

Copy link
Member Author

Choose a reason for hiding this comment

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

Aware, and touched on this in the commit description of abdbe51. I don't have a better solution right now. The visual design intention was to keep the cursor underneath the HUD though.

skipIntroOverlay = new SkipOverlay(DrawableRuleset.GameplayStartTime)
{
RequestSkip = performUserRequestedSkip
Expand Down
Loading