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