1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:43:10 +08:00

Merge pull request #29615 from peppy/break-overlay-improvements

Add shadow around break overlay middle content to make sure it remains visible
This commit is contained in:
Bartłomiej Dach 2024-08-27 11:16:08 +02:00 committed by GitHub
commit 321e509f11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 52 additions and 23 deletions

View File

@ -7,9 +7,13 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Gameplay namespace osu.Game.Tests.Visual.Gameplay
{ {
@ -28,14 +32,19 @@ namespace osu.Game.Tests.Visual.Gameplay
public TestSceneBreakTracker() public TestSceneBreakTracker()
{ {
AddRange(new Drawable[] Children = new Drawable[]
{ {
new Box
{
Colour = Color4.White,
RelativeSizeAxes = Axes.Both,
},
breakTracker = new TestBreakTracker(), breakTracker = new TestBreakTracker(),
breakOverlay = new BreakOverlay(true, null) breakOverlay = new BreakOverlay(true, new ScoreProcessor(new OsuRuleset()))
{ {
ProcessCustomClock = false, ProcessCustomClock = false,
} }
}); };
} }
protected override void Update() protected override void Update()

View File

@ -11,12 +11,12 @@ namespace osu.Game.Screens.Play.Break
{ {
public partial class LetterboxOverlay : CompositeDrawable public partial class LetterboxOverlay : CompositeDrawable
{ {
private const int height = 350;
private static readonly Color4 transparent_black = new Color4(0, 0, 0, 0); private static readonly Color4 transparent_black = new Color4(0, 0, 0, 0);
public LetterboxOverlay() public LetterboxOverlay()
{ {
const int height = 150;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {

View File

@ -1,16 +1,17 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Play.Break; using osu.Game.Screens.Play.Break;
@ -29,7 +30,7 @@ namespace osu.Game.Screens.Play
private readonly Container fadeContainer; private readonly Container fadeContainer;
private IReadOnlyList<BreakPeriod> breaks; private IReadOnlyList<BreakPeriod> breaks = Array.Empty<BreakPeriod>();
public IReadOnlyList<BreakPeriod> Breaks public IReadOnlyList<BreakPeriod> Breaks
{ {
@ -69,6 +70,30 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = 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 remainingTimeAdjustmentBox = new Container
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -111,11 +136,8 @@ namespace osu.Game.Screens.Play
base.LoadComplete(); base.LoadComplete();
initializeBreaks(); 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() protected override void Update()
@ -130,8 +152,6 @@ namespace osu.Game.Screens.Play
FinishTransforms(true); FinishTransforms(true);
Scheduler.CancelDelayedTasks(); Scheduler.CancelDelayedTasks();
if (breaks == null) return; // we need breaks.
foreach (var b in breaks) foreach (var b in breaks)
{ {
if (!b.HasEffect) if (!b.HasEffect)

View File

@ -446,14 +446,6 @@ namespace osu.Game.Screens.Play
Children = new[] Children = new[]
{ {
DimmableStoryboard.OverlayLayerContainer.CreateProxy(), 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) HUDOverlay = new HUDOverlay(DrawableRuleset, GameplayState.Mods, Configuration.AlwaysShowLeaderboard)
{ {
HoldToQuit = HoldToQuit =
@ -472,6 +464,14 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = 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) skipIntroOverlay = new SkipOverlay(DrawableRuleset.GameplayStartTime)
{ {
RequestSkip = performUserRequestedSkip RequestSkip = performUserRequestedSkip