diff --git a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs
index 2a735c89d9..37a12b20b4 100644
--- a/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs
+++ b/osu.Game.Rulesets.Osu/Utils/OsuHitObjectGenerationUtils_Reposition.cs
@@ -23,14 +23,14 @@ namespace osu.Game.Rulesets.Osu.Utils
private static readonly Vector2 playfield_centre = OsuPlayfield.BASE_SIZE / 2;
///
- /// Generate a list of s containing information for how the given list of
+ /// Generate a list of s containing information for how the given list of
/// s are positioned.
///
/// A list of s to process.
- /// A list of s describing how each hit object is positioned relative to the previous one.
- public static List GeneratePositionInfos(IEnumerable hitObjects)
+ /// A list of s describing how each hit object is positioned relative to the previous one.
+ public static List GeneratePositionInfos(IEnumerable hitObjects)
{
- var positionInfos = new List();
+ var positionInfos = new List();
Vector2 previousPosition = playfield_centre;
float previousAngle = 0;
@@ -56,12 +56,12 @@ namespace osu.Game.Rulesets.Osu.Utils
///
/// Reposition the hit objects according to the information in .
///
- ///
+ /// Position information for each hit object.
/// The repositioned hit objects.
- public static List RepositionHitObjects(IEnumerable objectPositionInfos)
+ public static List RepositionHitObjects(IEnumerable objectPositionInfos)
{
- List positionInfos = objectPositionInfos.Cast().ToList();
- ObjectPositionInfo? previous = null;
+ List positionInfos = objectPositionInfos.Select(o => new ObjectPositionInfoInternal(o)).ToList();
+ ObjectPositionInfoInternal? previous = null;
for (int i = 0; i < positionInfos.Count; i++)
{
@@ -115,10 +115,10 @@ namespace osu.Game.Rulesets.Osu.Utils
///
/// Compute the modified position of a hit object while attempting to keep it inside the playfield.
///
- /// The representing the hit object to have the modified position computed for.
- /// The representing the hit object immediately preceding the current one.
- /// The representing the hit object immediately preceding the one.
- private static void computeModifiedPosition(ObjectPositionInfo current, ObjectPositionInfo? previous, ObjectPositionInfo? beforePrevious)
+ /// The representing the hit object to have the modified position computed for.
+ /// The representing the hit object immediately preceding the current one.
+ /// The representing the hit object immediately preceding the one.
+ private static void computeModifiedPosition(ObjectPositionInfoInternal current, ObjectPositionInfoInternal? previous, ObjectPositionInfoInternal? beforePrevious)
{
float previousAbsoluteAngle = 0f;
@@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Osu.Utils
/// Move the modified position of a hit circle so that it fits inside the playfield.
///
/// The deviation from the original modified position in order to fit within the playfield.
- private static Vector2 clampHitCircleToPlayfield(HitCircle circle, ObjectPositionInfo objectPositionInfo)
+ private static Vector2 clampHitCircleToPlayfield(HitCircle circle, ObjectPositionInfoInternal objectPositionInfo)
{
var previousPosition = objectPositionInfo.PositionModified;
objectPositionInfo.EndPositionModified = objectPositionInfo.PositionModified = clampToPlayfieldWithPadding(
@@ -164,7 +164,7 @@ namespace osu.Game.Rulesets.Osu.Utils
/// Moves the and all necessary nested s into the if they aren't already.
///
/// The deviation from the original modified position in order to fit within the playfield.
- private static Vector2 clampSliderToPlayfield(Slider slider, ObjectPositionInfo objectPositionInfo)
+ private static Vector2 clampSliderToPlayfield(Slider slider, ObjectPositionInfoInternal objectPositionInfo)
{
var possibleMovementBounds = calculatePossibleMovementBounds(slider);
@@ -286,7 +286,7 @@ namespace osu.Game.Rulesets.Osu.Utils
);
}
- public interface IObjectPositionInfo
+ public class ObjectPositionInfo
{
///
/// The jump angle from the previous hit object to this one, relative to the previous hit object's jump angle.
@@ -298,7 +298,7 @@ namespace osu.Game.Rulesets.Osu.Utils
/// If is 0, the player's cursor doesn't need to change its direction of movement when passing
/// the previous object to reach this one.
///
- float RelativeAngle { get; set; }
+ public float RelativeAngle { get; set; }
///
/// The jump distance from the previous hit object to this one.
@@ -306,32 +306,33 @@ namespace osu.Game.Rulesets.Osu.Utils
///
/// of the first hit object in a beatmap is relative to the playfield center.
///
- float DistanceFromPrevious { get; set; }
-
- ///
- /// The hit object associated with this .
- ///
- OsuHitObject HitObject { get; }
- }
-
- private class ObjectPositionInfo : IObjectPositionInfo
- {
- public float RelativeAngle { get; set; }
-
public float DistanceFromPrevious { get; set; }
- public Vector2 PositionOriginal { get; }
- public Vector2 PositionModified { get; set; }
- public Vector2 EndPositionModified { get; set; }
-
+ ///
+ /// The hit object associated with this .
+ ///
public OsuHitObject HitObject { get; }
public ObjectPositionInfo(OsuHitObject hitObject)
{
- PositionModified = PositionOriginal = hitObject.Position;
- EndPositionModified = hitObject.EndPosition;
HitObject = hitObject;
}
}
+
+ private class ObjectPositionInfoInternal : ObjectPositionInfo
+ {
+ public Vector2 PositionOriginal { get; }
+ public Vector2 PositionModified { get; set; }
+ public Vector2 EndPositionModified { get; set; }
+
+ public ObjectPositionInfoInternal(ObjectPositionInfo original)
+ : base(original.HitObject)
+ {
+ RelativeAngle = original.RelativeAngle;
+ DistanceFromPrevious = original.DistanceFromPrevious;
+ PositionModified = PositionOriginal = HitObject.Position;
+ EndPositionModified = HitObject.EndPosition;
+ }
+ }
}
}