1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Specify types explicitly and don't handle non-nullable values with fallbacks

This commit is contained in:
Dean Herbert 2021-06-16 16:24:30 +09:00
parent a5c09454e6
commit 5944c45f55
2 changed files with 12 additions and 6 deletions

View File

@ -37,9 +37,10 @@ namespace osu.Game.Rulesets.Taiko.Mods
protected double MultiplierAt(double position)
{
var beatLength = controlPointInfo.TimingPointAt(position)?.BeatLength;
var speedMultiplier = controlPointInfo.DifficultyPointAt(position)?.SpeedMultiplier;
return originalSliderMultiplier * (speedMultiplier ?? 1.0) * TimingControlPoint.DEFAULT_BEAT_LENGTH / (beatLength ?? TimingControlPoint.DEFAULT_BEAT_LENGTH);
double beatLength = controlPointInfo.TimingPointAt(position).BeatLength;
double speedMultiplier = controlPointInfo.DifficultyPointAt(position).SpeedMultiplier;
return originalSliderMultiplier * speedMultiplier * TimingControlPoint.DEFAULT_BEAT_LENGTH / beatLength;
}
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
@ -56,9 +57,9 @@ namespace osu.Game.Rulesets.Taiko.Mods
return;
}
var preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime);
var start = hitObject.HitObject.StartTime - preempt * 0.6;
var duration = preempt * 0.3;
double preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime);
double start = hitObject.HitObject.StartTime - preempt * 0.6;
double duration = preempt * 0.3;
using (hitObject.BeginAbsoluteSequence(start))
{

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Newtonsoft.Json;
using osu.Framework.Bindables;
using osu.Framework.Lists;
@ -66,6 +67,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary>
/// <param name="time">The time to find the difficulty control point at.</param>
/// <returns>The difficulty control point.</returns>
[NotNull]
public DifficultyControlPoint DifficultyPointAt(double time) => binarySearchWithFallback(DifficultyPoints, time, DifficultyControlPoint.DEFAULT);
/// <summary>
@ -73,6 +75,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary>
/// <param name="time">The time to find the effect control point at.</param>
/// <returns>The effect control point.</returns>
[NotNull]
public EffectControlPoint EffectPointAt(double time) => binarySearchWithFallback(EffectPoints, time, EffectControlPoint.DEFAULT);
/// <summary>
@ -80,6 +83,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary>
/// <param name="time">The time to find the sound control point at.</param>
/// <returns>The sound control point.</returns>
[NotNull]
public SampleControlPoint SamplePointAt(double time) => binarySearchWithFallback(SamplePoints, time, SamplePoints.Count > 0 ? SamplePoints[0] : SampleControlPoint.DEFAULT);
/// <summary>
@ -87,6 +91,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary>
/// <param name="time">The time to find the timing control point at.</param>
/// <returns>The timing control point.</returns>
[NotNull]
public TimingControlPoint TimingPointAt(double time) => binarySearchWithFallback(TimingPoints, time, TimingPoints.Count > 0 ? TimingPoints[0] : TimingControlPoint.DEFAULT);
/// <summary>