mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Rename *ScrollingDrawableTimingSection -> *ScrollingContainer, move LinearScrollingContainer to osu.Game, make SpeedAdjustmentContainer non-abstract.
This commit is contained in:
32
osu.Game/Rulesets/Timing/LinearScrollingContainer.cs
Normal file
32
osu.Game/Rulesets/Timing/LinearScrollingContainer.cs
Normal file
@ -0,0 +1,32 @@
|
||||
// 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;
|
||||
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="ScrollingContainer"/> which scrolls relative to the control point start time.
|
||||
/// This is the default <see cref="ScrollingContainer"/> returned by the base <see cref="SpeedAdjustmentContainer"/>.
|
||||
/// </summary>
|
||||
internal class LinearScrollingContainer : ScrollingContainer
|
||||
{
|
||||
private readonly Axes scrollingAxes;
|
||||
private readonly MultiplierControlPoint controlPoint;
|
||||
|
||||
public LinearScrollingContainer(Axes scrollingAxes, MultiplierControlPoint controlPoint)
|
||||
{
|
||||
this.scrollingAxes = scrollingAxes;
|
||||
this.controlPoint = controlPoint;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if ((scrollingAxes & Axes.X) > 0) X = (float)(controlPoint.StartTime - Time.Current);
|
||||
if ((scrollingAxes & Axes.Y) > 0) Y = (float)(controlPoint.StartTime - Time.Current);
|
||||
}
|
||||
}
|
||||
}
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Timing
|
||||
/// and <see cref="Container{T}.RelativeChildOffset"/> to apply further time offsets to this collection of hit objects.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public abstract class DrawableTimingSection : Container<DrawableHitObject>
|
||||
public abstract class ScrollingContainer : Container<DrawableHitObject>
|
||||
{
|
||||
private readonly BindableDouble visibleTimeRange = new BindableDouble();
|
||||
/// <summary>
|
||||
@ -71,9 +71,9 @@ namespace osu.Game.Rulesets.Timing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DrawableTimingSection"/>.
|
||||
/// Creates a new <see cref="ScrollingContainer"/>.
|
||||
/// </summary>
|
||||
protected DrawableTimingSection()
|
||||
protected ScrollingContainer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
RelativePositionAxes = Axes.Both;
|
||||
@ -128,8 +128,8 @@ namespace osu.Game.Rulesets.Timing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The maximum duration of any one hit object inside this <see cref="DrawableTimingSection"/>. This is calculated as the maximum
|
||||
/// end time between all hit objects relative to this <see cref="DrawableTimingSection"/>'s <see cref="MultiplierControlPoint.StartTime"/>.
|
||||
/// The maximum duration of any one hit object inside this <see cref="ScrollingContainer"/>. This is calculated as the maximum
|
||||
/// end time between all hit objects relative to this <see cref="ScrollingContainer"/>'s <see cref="MultiplierControlPoint.StartTime"/>.
|
||||
/// </summary>
|
||||
public double Duration => durationBacking.IsValid ? durationBacking : (durationBacking.Value = computeDuration());
|
||||
|
@ -12,14 +12,14 @@ namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
/// <summary>
|
||||
/// A container for hit objects which applies applies the speed adjustments defined by the properties of a <see cref="Timing.MultiplierControlPoint"/>
|
||||
/// to affect the scroll speed of the contained <see cref="DrawableTimingSection"/>.
|
||||
/// to affect the scroll speed of the contained <see cref="ScrollingContainer"/>.
|
||||
///
|
||||
/// <para>
|
||||
/// This container must always be relatively-sized to its parent to provide the speed adjustments. This container will provide the speed adjustments
|
||||
/// by modifying its size while maintaining a constant <see cref="Container{T}.RelativeChildSize"/> for its children
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public abstract class SpeedAdjustmentContainer : Container<DrawableHitObject>
|
||||
public class SpeedAdjustmentContainer : Container<DrawableHitObject>
|
||||
{
|
||||
private readonly Bindable<double> visibleTimeRange = new Bindable<double>();
|
||||
/// <summary>
|
||||
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Timing
|
||||
|
||||
public readonly MultiplierControlPoint ControlPoint;
|
||||
|
||||
private DrawableTimingSection timingSection;
|
||||
private ScrollingContainer scrollingContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SpeedAdjustmentContainer"/>.
|
||||
@ -58,14 +58,14 @@ namespace osu.Game.Rulesets.Timing
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
timingSection = CreateTimingSection();
|
||||
scrollingContainer = CreateScrollingContainer();
|
||||
|
||||
timingSection.ScrollingAxes = ScrollingAxes;
|
||||
timingSection.ControlPoint = ControlPoint;
|
||||
timingSection.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||
timingSection.RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)ControlPoint.StartTime : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)ControlPoint.StartTime : 0);
|
||||
scrollingContainer.ScrollingAxes = ScrollingAxes;
|
||||
scrollingContainer.ControlPoint = ControlPoint;
|
||||
scrollingContainer.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||
scrollingContainer.RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)ControlPoint.StartTime : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)ControlPoint.StartTime : 0);
|
||||
|
||||
AddInternal(content = timingSection);
|
||||
AddInternal(content = scrollingContainer);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Timing
|
||||
}
|
||||
|
||||
public override double LifetimeStart => ControlPoint.StartTime - VisibleTimeRange;
|
||||
public override double LifetimeEnd => ControlPoint.StartTime + timingSection.Duration + VisibleTimeRange;
|
||||
public override double LifetimeEnd => ControlPoint.StartTime + scrollingContainer.Duration + VisibleTimeRange;
|
||||
|
||||
public override void Add(DrawableHitObject drawable)
|
||||
{
|
||||
@ -99,9 +99,9 @@ namespace osu.Game.Rulesets.Timing
|
||||
public bool CanContain(double startTime) => ControlPoint.StartTime <= startTime;
|
||||
|
||||
/// <summary>
|
||||
/// Creates the container which handles the movement of a collection of hit objects.
|
||||
/// Creates the container which contains a collection of hit objects and scrolls through this SpeedAdjustmentContainer.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="DrawableTimingSection"/>.</returns>
|
||||
protected abstract DrawableTimingSection CreateTimingSection();
|
||||
/// <returns>The <see cref="ScrollingContainer"/>.</returns>
|
||||
protected virtual ScrollingContainer CreateScrollingContainer() => new LinearScrollingContainer(ScrollingAxes, ControlPoint);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user