Skip to content

Commit

Permalink
Merge pull request #29615 from peppy/break-overlay-improvements
Browse files Browse the repository at this point in the history
Add shadow around break overlay middle content to make sure it remains visible
  • Loading branch information
bdach authored Aug 27, 2024
2 parents 334b25f + e59689f commit 321e509
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 23 deletions.
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(),
skipIntroOverlay = new SkipOverlay(DrawableRuleset.GameplayStartTime)
{
RequestSkip = performUserRequestedSkip
Expand Down

0 comments on commit 321e509

Please sign in to comment.