Expose break fade duration and add it in the calculation

This commit is contained in:
iiSaLMaN 2019-08-07 16:59:35 +03:00
parent d3657d82cd
commit ba269a49ee
2 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,8 @@
// 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.
using osu.Game.Screens.Play;
namespace osu.Game.Beatmaps.Timing namespace osu.Game.Beatmaps.Timing
{ {
public class BreakPeriod public class BreakPeriod
@ -35,6 +37,6 @@ namespace osu.Game.Beatmaps.Timing
/// </summary> /// </summary>
/// <param name="time">The time to check in milliseconds.</param> /// <param name="time">The time to check in milliseconds.</param>
/// <returns>Whether the time falls within this <see cref="BreakPeriod"/>.</returns> /// <returns>Whether the time falls within this <see cref="BreakPeriod"/>.</returns>
public bool Contains(double time) => time >= StartTime && time <= EndTime; public bool Contains(double time) => time >= StartTime && time <= EndTime - BreakOverlay.BREAK_FADE_DURATION;
} }
} }

View File

@ -17,7 +17,11 @@ namespace osu.Game.Screens.Play
{ {
public class BreakOverlay : Container public class BreakOverlay : Container
{ {
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2; /// <summary>
/// The duration of the break overlay fading.
/// </summary>
public const double BREAK_FADE_DURATION = BreakPeriod.MIN_BREAK_DURATION / 2;
private const float remaining_time_container_max_size = 0.3f; private const float remaining_time_container_max_size = 0.3f;
private const int vertical_margin = 25; private const int vertical_margin = 25;
@ -172,25 +176,25 @@ namespace osu.Game.Screens.Play
using (BeginAbsoluteSequence(b.StartTime, true)) using (BeginAbsoluteSequence(b.StartTime, true))
{ {
fadeContainer.FadeIn(fade_duration); fadeContainer.FadeIn(BREAK_FADE_DURATION);
breakArrows.Show(fade_duration); breakArrows.Show(BREAK_FADE_DURATION);
remainingTimeAdjustmentBox remainingTimeAdjustmentBox
.ResizeWidthTo(remaining_time_container_max_size, fade_duration, Easing.OutQuint) .ResizeWidthTo(remaining_time_container_max_size, BREAK_FADE_DURATION, Easing.OutQuint)
.Delay(b.Duration - fade_duration) .Delay(b.Duration - BREAK_FADE_DURATION)
.ResizeWidthTo(0); .ResizeWidthTo(0);
remainingTimeBox remainingTimeBox
.ResizeWidthTo(0, b.Duration - fade_duration) .ResizeWidthTo(0, b.Duration - BREAK_FADE_DURATION)
.Then() .Then()
.ResizeWidthTo(1); .ResizeWidthTo(1);
remainingTimeCounter.CountTo(b.Duration).CountTo(0, b.Duration); remainingTimeCounter.CountTo(b.Duration).CountTo(0, b.Duration);
using (BeginDelayedSequence(b.Duration - fade_duration, true)) using (BeginDelayedSequence(b.Duration - BREAK_FADE_DURATION, true))
{ {
fadeContainer.FadeOut(fade_duration); fadeContainer.FadeOut(BREAK_FADE_DURATION);
breakArrows.Hide(fade_duration); breakArrows.Hide(BREAK_FADE_DURATION);
} }
} }
} }