2017-09-16 00:39:55 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Timing;
|
|
|
|
|
using osu.Game.Beatmaps.Timing;
|
2017-09-21 03:33:07 +08:00
|
|
|
|
using osu.Game.Screens.Play.BreaksOverlay;
|
2017-09-16 00:39:55 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
2017-09-19 22:37:34 +08:00
|
|
|
|
namespace osu.Game.Tests.Visual
|
2017-09-16 00:39:55 +08:00
|
|
|
|
{
|
|
|
|
|
internal class TestCaseBreakOverlay : OsuTestCase
|
|
|
|
|
{
|
|
|
|
|
private readonly BreakOverlay breakOverlay;
|
|
|
|
|
|
|
|
|
|
public TestCaseBreakOverlay()
|
|
|
|
|
{
|
|
|
|
|
Clock = new FramedClock();
|
|
|
|
|
|
2017-09-20 20:58:28 +08:00
|
|
|
|
Child = breakOverlay = new BreakOverlay(true);
|
2017-09-16 00:39:55 +08:00
|
|
|
|
|
2017-10-05 11:17:48 +08:00
|
|
|
|
AddStep("2s break", () => startBreak(2000));
|
|
|
|
|
AddStep("5s break", () => startBreak(5000));
|
|
|
|
|
AddStep("10s break", () => startBreak(10000));
|
|
|
|
|
AddStep("15s break", () => startBreak(15000));
|
|
|
|
|
AddStep("2s, 2s", startMultipleBreaks);
|
|
|
|
|
AddStep("0.5s, 0.7s, 1s, 2s", startAnotherMultipleBreaks);
|
2017-09-16 00:39:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startBreak(double duration)
|
|
|
|
|
{
|
|
|
|
|
breakOverlay.Breaks = new List<BreakPeriod>
|
|
|
|
|
{
|
|
|
|
|
new BreakPeriod
|
|
|
|
|
{
|
|
|
|
|
StartTime = Clock.CurrentTime,
|
|
|
|
|
EndTime = Clock.CurrentTime + duration,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startMultipleBreaks()
|
|
|
|
|
{
|
|
|
|
|
double currentTime = Clock.CurrentTime;
|
|
|
|
|
|
|
|
|
|
breakOverlay.Breaks = new List<BreakPeriod>
|
|
|
|
|
{
|
|
|
|
|
new BreakPeriod
|
|
|
|
|
{
|
|
|
|
|
StartTime = currentTime,
|
|
|
|
|
EndTime = currentTime + 2000,
|
|
|
|
|
},
|
|
|
|
|
new BreakPeriod
|
|
|
|
|
{
|
|
|
|
|
StartTime = currentTime + 4000,
|
|
|
|
|
EndTime = currentTime + 6000,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
2017-10-05 11:17:48 +08:00
|
|
|
|
|
|
|
|
|
private void startAnotherMultipleBreaks()
|
|
|
|
|
{
|
|
|
|
|
double currentTime = Clock.CurrentTime;
|
|
|
|
|
|
|
|
|
|
breakOverlay.Breaks = new List<BreakPeriod>
|
|
|
|
|
{
|
|
|
|
|
new BreakPeriod // Duration is less than 650 - too short to appear
|
|
|
|
|
{
|
|
|
|
|
StartTime = currentTime,
|
|
|
|
|
EndTime = currentTime + 500,
|
|
|
|
|
},
|
|
|
|
|
new BreakPeriod
|
|
|
|
|
{
|
|
|
|
|
StartTime = currentTime + 1500,
|
|
|
|
|
EndTime = currentTime + 2200,
|
|
|
|
|
},
|
|
|
|
|
new BreakPeriod
|
|
|
|
|
{
|
|
|
|
|
StartTime = currentTime + 3200,
|
|
|
|
|
EndTime = currentTime + 4200,
|
|
|
|
|
},
|
|
|
|
|
new BreakPeriod
|
|
|
|
|
{
|
|
|
|
|
StartTime = currentTime + 5200,
|
|
|
|
|
EndTime = currentTime + 7200,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
2017-09-16 00:39:55 +08:00
|
|
|
|
}
|
2017-11-23 15:00:33 +08:00
|
|
|
|
}
|