2018-01-05 11:21:19 +00:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-03-15 03:57:17 +00:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-04-18 07:05:58 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2017-03-15 03:57:17 +00:00
|
|
|
|
using System.Collections.Generic;
|
2017-04-21 11:29:27 +00:00
|
|
|
|
using OpenTK;
|
2017-04-21 07:18:34 +00:00
|
|
|
|
using osu.Game.Audio;
|
2017-07-26 04:22:46 +00:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-05-29 03:10:29 +00:00
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2017-03-15 03:52:25 +00:00
|
|
|
|
|
2017-04-21 11:29:27 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Objects.Legacy
|
2017-03-15 03:52:25 +00:00
|
|
|
|
{
|
2017-04-22 12:33:11 +00:00
|
|
|
|
internal abstract class ConvertSlider : HitObject, IHasCurve
|
2017-03-15 03:52:25 +00:00
|
|
|
|
{
|
2017-05-29 03:10:29 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private const float base_scoring_distance = 100;
|
|
|
|
|
|
2018-01-23 04:37:25 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <see cref="ConvertSlider"/>s don't need a curve since they're converted to ruleset-specific hitobjects.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public SliderCurve Curve { get; } = null;
|
2017-04-22 11:43:20 +00:00
|
|
|
|
public List<Vector2> ControlPoints { get; set; }
|
|
|
|
|
public CurveType CurveType { get; set; }
|
2017-05-29 03:10:29 +00:00
|
|
|
|
|
2017-05-29 03:19:38 +00:00
|
|
|
|
public double Distance { get; set; }
|
2017-03-15 03:52:25 +00:00
|
|
|
|
|
2017-12-25 06:35:28 +00:00
|
|
|
|
public List<List<SampleInfo>> RepeatSamples { get; set; }
|
2018-01-23 04:37:25 +00:00
|
|
|
|
public int RepeatCount { get; set; }
|
2017-04-21 07:18:34 +00:00
|
|
|
|
|
2018-01-23 04:37:25 +00:00
|
|
|
|
public double EndTime => StartTime + this.SpanCount() * Distance / Velocity;
|
2017-05-29 03:10:29 +00:00
|
|
|
|
public double Duration => EndTime - StartTime;
|
|
|
|
|
|
2017-05-29 03:19:51 +00:00
|
|
|
|
public double Velocity = 1;
|
2017-04-21 11:29:27 +00:00
|
|
|
|
|
2017-12-22 12:42:54 +00:00
|
|
|
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
2017-05-29 03:10:29 +00:00
|
|
|
|
{
|
2017-12-22 12:42:54 +00:00
|
|
|
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
2017-05-29 03:10:29 +00:00
|
|
|
|
|
|
|
|
|
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
|
|
|
|
DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(StartTime);
|
|
|
|
|
|
2017-08-21 02:45:57 +00:00
|
|
|
|
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
|
2017-05-29 03:10:29 +00:00
|
|
|
|
|
|
|
|
|
Velocity = scoringDistance / timingPoint.BeatLength;
|
|
|
|
|
}
|
2017-03-15 03:52:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|