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.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Screens.Play;
namespace osu.Game.Beatmaps.Timing
{
public class BreakPeriod
@ -35,6 +37,6 @@ namespace osu.Game.Beatmaps.Timing
/// </summary>
/// <param name="time">The time to check in milliseconds.</param>
/// <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
{
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 int vertical_margin = 25;
@ -172,25 +176,25 @@ namespace osu.Game.Screens.Play
using (BeginAbsoluteSequence(b.StartTime, true))
{
fadeContainer.FadeIn(fade_duration);
breakArrows.Show(fade_duration);
fadeContainer.FadeIn(BREAK_FADE_DURATION);
breakArrows.Show(BREAK_FADE_DURATION);
remainingTimeAdjustmentBox
.ResizeWidthTo(remaining_time_container_max_size, fade_duration, Easing.OutQuint)
.Delay(b.Duration - fade_duration)
.ResizeWidthTo(remaining_time_container_max_size, BREAK_FADE_DURATION, Easing.OutQuint)
.Delay(b.Duration - BREAK_FADE_DURATION)
.ResizeWidthTo(0);
remainingTimeBox
.ResizeWidthTo(0, b.Duration - fade_duration)
.ResizeWidthTo(0, b.Duration - BREAK_FADE_DURATION)
.Then()
.ResizeWidthTo(1);
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);
breakArrows.Hide(fade_duration);
fadeContainer.FadeOut(BREAK_FADE_DURATION);
breakArrows.Hide(BREAK_FADE_DURATION);
}
}
}