mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Rename SpeedAdjustment -> MultiplierControlPoint + reworking.
This commit is contained in:
28
osu.Game/Rulesets/Timing/MultiplierControlPoint.cs
Normal file
28
osu.Game/Rulesets/Timing/MultiplierControlPoint.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// 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.Game.Beatmaps.ControlPoints;
|
||||
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
public class MultiplierControlPoint
|
||||
{
|
||||
/// <summary>
|
||||
/// The time in milliseconds at which this control point starts.
|
||||
/// </summary>
|
||||
public readonly double StartTime;
|
||||
|
||||
/// <summary>
|
||||
/// The multiplier which this control point provides.
|
||||
/// </summary>
|
||||
public double Multiplier => 1000 / TimingPoint.BeatLength / DifficultyPoint.SpeedMultiplier;
|
||||
|
||||
public TimingControlPoint TimingPoint = new TimingControlPoint();
|
||||
public DifficultyControlPoint DifficultyPoint = new DifficultyControlPoint();
|
||||
|
||||
public MultiplierControlPoint(double startTime)
|
||||
{
|
||||
StartTime = startTime;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
public class SpeedAdjustment
|
||||
{
|
||||
/// <summary>
|
||||
/// The time in milliseconds at which this timing section starts.
|
||||
/// </summary>
|
||||
public double Time;
|
||||
|
||||
/// <summary>
|
||||
/// The length of one beat in milliseconds.
|
||||
/// </summary>
|
||||
public double BeatLength = 500;
|
||||
|
||||
/// <summary>
|
||||
/// An arbitrary speed multiplier which should be used to when adjusting the visual representation of entities represented by this section.
|
||||
/// This is usually applied in adition to a multiplier based on the <see cref="BeatLength"/> relative to a constant.
|
||||
/// </summary>
|
||||
public double SpeedMultiplier = 1;
|
||||
}
|
||||
}
|
@ -73,11 +73,11 @@ namespace osu.Game.Rulesets.Timing
|
||||
var timingChangeY = y as SpeedAdjustmentContainer;
|
||||
|
||||
// If either of the two drawables are not hit objects, fall back to the base comparer
|
||||
if (timingChangeX?.TimingSection == null || timingChangeY?.TimingSection == null)
|
||||
if (timingChangeX?.MultiplierControlPoint == null || timingChangeY?.MultiplierControlPoint == null)
|
||||
return base.Compare(x, y);
|
||||
|
||||
// Compare by start time
|
||||
int i = timingChangeY.TimingSection.Time.CompareTo(timingChangeX.TimingSection.Time);
|
||||
int i = timingChangeY.MultiplierControlPoint.StartTime.CompareTo(timingChangeX.MultiplierControlPoint.StartTime);
|
||||
|
||||
return i != 0 ? i : base.Compare(x, y);
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ using OpenTK;
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
/// <summary>
|
||||
/// A container for hit objects which applies applies the speed changes defined by the <see cref="Timing.SpeedAdjustment.BeatLength"/> and <see cref="Timing.SpeedAdjustment.SpeedMultiplier"/>
|
||||
/// properties to its <see cref="Container{T}.Content"/> to affect the <see cref="Drawables.DrawableTimingSection"/> scroll speed.
|
||||
/// A container for hit objects which applies applies the speed adjustments defined by the <see cref="Timing.MultiplierControlPoint"/> properties
|
||||
/// to its <see cref="Container{T}.Content"/> to affect the <see cref="DrawableTimingSection"/> scroll speed.
|
||||
/// </summary>
|
||||
public abstract class SpeedAdjustmentContainer : Container<DrawableHitObject>
|
||||
{
|
||||
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Timing
|
||||
set { visibleTimeRange.BindTo(value); }
|
||||
}
|
||||
|
||||
public readonly SpeedAdjustment TimingSection;
|
||||
public readonly MultiplierControlPoint MultiplierControlPoint;
|
||||
|
||||
protected override Container<DrawableHitObject> Content => content;
|
||||
private Container<DrawableHitObject> content;
|
||||
@ -35,13 +35,13 @@ namespace osu.Game.Rulesets.Timing
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SpeedAdjustmentContainer"/>.
|
||||
/// </summary>
|
||||
/// <param name="timingSection">The encapsulated timing section that provides the speed changes.</param>
|
||||
/// <param name="multiplierControlPoint">The multiplier control point that provides the speed adjustments for this container.</param>
|
||||
/// <param name="scrollingAxes">The axes through which this drawable timing section scrolls through.</param>
|
||||
protected SpeedAdjustmentContainer(SpeedAdjustment timingSection, Axes scrollingAxes)
|
||||
protected SpeedAdjustmentContainer(MultiplierControlPoint multiplierControlPoint, Axes scrollingAxes)
|
||||
{
|
||||
this.scrollingAxes = scrollingAxes;
|
||||
|
||||
TimingSection = timingSection;
|
||||
MultiplierControlPoint = multiplierControlPoint;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Timing
|
||||
DrawableTimingSection timingSection = CreateTimingSection();
|
||||
|
||||
timingSection.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||
timingSection.RelativeChildOffset = new Vector2((scrollingAxes & Axes.X) > 0 ? (float)TimingSection.Time : 0, (scrollingAxes & Axes.Y) > 0 ? (float)TimingSection.Time : 0);
|
||||
timingSection.RelativeChildOffset = new Vector2((scrollingAxes & Axes.X) > 0 ? (float)MultiplierControlPoint.StartTime : 0, (scrollingAxes & Axes.Y) > 0 ? (float)MultiplierControlPoint.StartTime : 0);
|
||||
|
||||
AddInternal(content = timingSection);
|
||||
}
|
||||
@ -63,17 +63,17 @@ namespace osu.Game.Rulesets.Timing
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
float speedAdjustedSize = (float)(1000 / TimingSection.BeatLength / TimingSection.SpeedMultiplier);
|
||||
float multiplier = (float)MultiplierControlPoint.Multiplier;
|
||||
|
||||
// The speed adjustment happens by modifying our size while maintaining the visible time range as the relatve size for our children
|
||||
Size = new Vector2((scrollingAxes & Axes.X) > 0 ? speedAdjustedSize : 1, (scrollingAxes & Axes.Y) > 0 ? speedAdjustedSize : 1);
|
||||
// The speed adjustment happens by modifying our size by the multiplier while maintaining the visible time range as the relatve size for our children
|
||||
Size = new Vector2((scrollingAxes & Axes.X) > 0 ? multiplier : 1, (scrollingAxes & Axes.Y) > 0 ? multiplier : 1);
|
||||
RelativeChildSize = new Vector2((scrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (scrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether this speed adjustment can contain a hit object. This is true if the hit object occurs after this speed adjustment with respect to time.
|
||||
/// </summary>
|
||||
public bool CanContain(DrawableHitObject hitObject) => TimingSection.Time <= hitObject.HitObject.StartTime;
|
||||
public bool CanContain(DrawableHitObject hitObject) => MultiplierControlPoint.StartTime <= hitObject.HitObject.StartTime;
|
||||
|
||||
/// <summary>
|
||||
/// Creates the container which handles the movement of a collection of hit objects.
|
||||
|
Reference in New Issue
Block a user