2019-01-24 17:43:03 +09: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 18:19:50 +09:00
|
|
|
|
|
2022-06-17 16:37:17 +09:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2017-04-18 16:05:58 +09:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2017-03-15 12:57:17 +09:00
|
|
|
|
using System.Collections.Generic;
|
2020-09-14 17:08:22 +09:00
|
|
|
|
using Newtonsoft.Json;
|
2023-04-25 18:12:53 +02:00
|
|
|
|
using osu.Framework.Bindables;
|
2017-04-21 16:18:34 +09:00
|
|
|
|
using osu.Game.Audio;
|
2017-07-26 13:22:46 +09:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-05-29 12:10:29 +09:00
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-04-21 20:29:27 +09:00
|
|
|
|
namespace osu.Game.Rulesets.Objects.Legacy
|
2017-03-15 12:52:25 +09:00
|
|
|
|
{
|
2023-09-29 14:19:26 +09:00
|
|
|
|
internal abstract class ConvertSlider : ConvertHitObject, IHasPathWithRepeats, IHasSliderVelocity
|
2017-03-15 12:52:25 +09:00
|
|
|
|
{
|
2017-05-29 12:10:29 +09:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private const float base_scoring_distance = 100;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2018-01-23 13:37:25 +09:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <see cref="ConvertSlider"/>s don't need a curve since they're converted to ruleset-specific hitobjects.
|
|
|
|
|
/// </summary>
|
2023-10-17 17:48:51 +09:00
|
|
|
|
public SliderPath Path { get; set; } = null!;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2018-11-12 14:07:48 +09:00
|
|
|
|
public double Distance => Path.Distance;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2023-10-17 17:48:51 +09:00
|
|
|
|
public IList<IList<HitSampleInfo>> NodeSamples { get; set; } = null!;
|
|
|
|
|
|
2018-01-23 13:37:25 +09:00
|
|
|
|
public int RepeatCount { get; set; }
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2020-09-14 17:08:22 +09:00
|
|
|
|
[JsonIgnore]
|
2020-05-27 12:37:44 +09:00
|
|
|
|
public double Duration
|
2020-02-05 17:12:26 +09:00
|
|
|
|
{
|
2020-05-27 12:37:44 +09:00
|
|
|
|
get => this.SpanCount() * Distance / Velocity;
|
2020-02-06 13:16:32 +09:00
|
|
|
|
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
2020-02-05 17:12:26 +09:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-27 12:37:44 +09:00
|
|
|
|
public double EndTime => StartTime + Duration;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-05-29 12:19:51 +09:00
|
|
|
|
public double Velocity = 1;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2023-09-06 18:59:15 +09:00
|
|
|
|
public BindableNumber<double> SliderVelocityMultiplierBindable { get; } = new BindableDouble(1);
|
2023-04-25 18:12:53 +02:00
|
|
|
|
|
2023-09-06 18:59:15 +09:00
|
|
|
|
public double SliderVelocityMultiplier
|
2023-04-25 18:12:53 +02:00
|
|
|
|
{
|
2023-09-06 18:59:15 +09:00
|
|
|
|
get => SliderVelocityMultiplierBindable.Value;
|
|
|
|
|
set => SliderVelocityMultiplierBindable.Value = value;
|
2023-04-25 18:12:53 +02:00
|
|
|
|
}
|
2023-04-25 11:34:09 +02:00
|
|
|
|
|
2021-10-01 14:56:42 +09:00
|
|
|
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
2017-05-29 12:10:29 +09:00
|
|
|
|
{
|
2017-12-22 21:42:54 +09:00
|
|
|
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-05-29 12:10:29 +09:00
|
|
|
|
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2023-09-06 18:59:15 +09:00
|
|
|
|
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * SliderVelocityMultiplier;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-05-29 12:10:29 +09:00
|
|
|
|
Velocity = scoringDistance / timingPoint.BeatLength;
|
|
|
|
|
}
|
2017-03-15 12:52:25 +09:00
|
|
|
|
}
|
|
|
|
|
}
|