2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
|
|
|
|
using System.Collections.Generic;
|
2020-09-14 08:08:22 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2023-04-25 16:12:53 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Audio;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Objects.Legacy
|
|
|
|
|
{
|
2023-04-25 09:34:09 +00:00
|
|
|
|
internal abstract class ConvertSlider : ConvertHitObject, IHasPathWithRepeats, IHasLegacyLastTickOffset, IHasSliderVelocity
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private const float base_scoring_distance = 100;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <see cref="ConvertSlider"/>s don't need a curve since they're converted to ruleset-specific hitobjects.
|
|
|
|
|
/// </summary>
|
2018-11-01 06:38:19 +00:00
|
|
|
|
public SliderPath Path { get; set; }
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-11-12 05:07:48 +00:00
|
|
|
|
public double Distance => Path.Distance;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-10-23 08:59:07 +00:00
|
|
|
|
public IList<IList<HitSampleInfo>> NodeSamples { get; set; }
|
2018-04-13 09:19:50 +00:00
|
|
|
|
public int RepeatCount { get; set; }
|
|
|
|
|
|
2020-09-14 08:08:22 +00:00
|
|
|
|
[JsonIgnore]
|
2020-05-27 03:37:44 +00:00
|
|
|
|
public double Duration
|
2020-02-05 08:12:26 +00:00
|
|
|
|
{
|
2020-05-27 03:37:44 +00:00
|
|
|
|
get => this.SpanCount() * Distance / Velocity;
|
2020-02-06 04:16:32 +00:00
|
|
|
|
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
2020-02-05 08:12:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-27 03:37:44 +00:00
|
|
|
|
public double EndTime => StartTime + Duration;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
public double Velocity = 1;
|
|
|
|
|
|
2023-04-25 16:22:22 +00:00
|
|
|
|
public BindableNumber<double> SliderVelocityBindable { get; } = new BindableDouble(1);
|
2023-04-25 16:12:53 +00:00
|
|
|
|
|
|
|
|
|
public double SliderVelocity
|
|
|
|
|
{
|
|
|
|
|
get => SliderVelocityBindable.Value;
|
|
|
|
|
set => SliderVelocityBindable.Value = value;
|
|
|
|
|
}
|
2023-04-25 09:34:09 +00:00
|
|
|
|
|
2021-10-01 05:56:42 +00:00
|
|
|
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
|
|
|
|
|
|
|
|
|
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
|
|
|
|
|
2023-04-25 09:34:09 +00:00
|
|
|
|
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * SliderVelocity;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
Velocity = scoringDistance / timingPoint.BeatLength;
|
|
|
|
|
}
|
2018-06-13 13:20:34 +00:00
|
|
|
|
|
|
|
|
|
public double LegacyLastTickOffset => 36;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|