2017-06-09 01:43:48 +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.Graphics;
|
|
|
|
using osu.Game.Rulesets.Timing;
|
|
|
|
|
2017-06-09 15:20:55 +08:00
|
|
|
namespace osu.Game.Rulesets.Mania.Timing
|
2017-06-09 01:43:48 +08:00
|
|
|
{
|
2017-06-09 15:11:31 +08:00
|
|
|
public class ManiaSpeedAdjustmentContainer : SpeedAdjustmentContainer
|
2017-06-09 01:43:48 +08:00
|
|
|
{
|
|
|
|
private readonly ScrollingAlgorithm scrollingAlgorithm;
|
|
|
|
|
2017-06-09 15:57:17 +08:00
|
|
|
public ManiaSpeedAdjustmentContainer(MultiplierControlPoint timingSection, ScrollingAlgorithm scrollingAlgorithm)
|
2017-06-09 01:43:48 +08:00
|
|
|
: base(timingSection, Axes.Y)
|
|
|
|
{
|
|
|
|
this.scrollingAlgorithm = scrollingAlgorithm;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void UpdateAfterChildren()
|
|
|
|
{
|
|
|
|
base.UpdateAfterChildren();
|
|
|
|
|
2017-06-09 15:11:31 +08:00
|
|
|
var parent = Parent as SpeedAdjustmentCollection;
|
2017-06-09 01:43:48 +08:00
|
|
|
|
|
|
|
if (parent == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// This is very naive and can be improved, but is adequate for now
|
2017-06-12 16:31:24 +08:00
|
|
|
LifetimeStart = ControlPoint.StartTime - VisibleTimeRange;
|
|
|
|
LifetimeEnd = ControlPoint.StartTime + Content.Height * 2;
|
2017-06-09 01:43:48 +08:00
|
|
|
}
|
|
|
|
|
2017-06-09 15:11:31 +08:00
|
|
|
protected override DrawableTimingSection CreateTimingSection()
|
2017-06-09 01:43:48 +08:00
|
|
|
{
|
|
|
|
switch (scrollingAlgorithm)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case ScrollingAlgorithm.Basic:
|
2017-06-12 16:31:24 +08:00
|
|
|
return new BasicScrollingDrawableTimingSection(ControlPoint);
|
2017-06-09 01:43:48 +08:00
|
|
|
case ScrollingAlgorithm.Gravity:
|
2017-06-12 16:31:24 +08:00
|
|
|
return new GravityScrollingDrawableTimingSection(ControlPoint);
|
2017-06-09 01:43:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|