mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Merge branch 'master' into slider-paste-parsing-failures-2
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osuTK;
|
||||
|
||||
@ -11,6 +12,15 @@ namespace osu.Game.Rulesets.Objects
|
||||
{
|
||||
public static class SliderPathExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Snaps the provided <paramref name="hitObject"/>'s duration using the <paramref name="snapProvider"/>.
|
||||
/// </summary>
|
||||
public static void SnapTo<THitObject>(this THitObject hitObject, IPositionSnapProvider? snapProvider)
|
||||
where THitObject : HitObject, IHasPath
|
||||
{
|
||||
hitObject.Path.ExpectedDistance.Value = snapProvider?.GetSnappedDistanceFromDistance(hitObject, (float)hitObject.Path.CalculatedDistance) ?? hitObject.Path.CalculatedDistance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reverse the direction of this path.
|
||||
/// </summary>
|
||||
|
@ -135,7 +135,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
if (result == null)
|
||||
throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}.");
|
||||
|
||||
result.Type = judgement.MaxResult;
|
||||
result.Type = GetSimulatedHitResult(judgement);
|
||||
ApplyResult(result);
|
||||
}
|
||||
}
|
||||
@ -145,5 +145,12 @@ namespace osu.Game.Rulesets.Scoring
|
||||
base.Update();
|
||||
hasCompleted.Value = JudgedHits == MaxHits && (JudgedHits == 0 || lastAppliedResult.TimeAbsolute < Clock.CurrentTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a simulated <see cref="HitResult"/> for a judgement. Used during <see cref="SimulateAutoplay"/> to simulate a "perfect" play.
|
||||
/// </summary>
|
||||
/// <param name="judgement">The judgement to simulate a <see cref="HitResult"/> for.</param>
|
||||
/// <returns>The simulated <see cref="HitResult"/> for the judgement.</returns>
|
||||
protected virtual HitResult GetSimulatedHitResult(Judgement judgement) => judgement.MaxResult;
|
||||
}
|
||||
}
|
||||
|
@ -127,6 +127,17 @@ namespace osu.Game.Rulesets.UI
|
||||
return base.Handle(e);
|
||||
}
|
||||
|
||||
protected override bool HandleMouseTouchStateChange(TouchStateChangeEvent e)
|
||||
{
|
||||
if (mouseDisabled.Value)
|
||||
{
|
||||
// Only propagate positional data when mouse buttons are disabled.
|
||||
e = new TouchStateChangeEvent(e.State, e.Input, e.Touch, false, e.LastPosition);
|
||||
}
|
||||
|
||||
return base.HandleMouseTouchStateChange(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Key Counter Attachment
|
||||
|
@ -116,25 +116,11 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
|
||||
if (RelativeScaleBeatLengths)
|
||||
{
|
||||
IReadOnlyList<TimingControlPoint> timingPoints = Beatmap.ControlPointInfo.TimingPoints;
|
||||
double maxDuration = 0;
|
||||
baseBeatLength = Beatmap.GetMostCommonBeatLength();
|
||||
|
||||
for (int i = 0; i < timingPoints.Count; i++)
|
||||
{
|
||||
if (timingPoints[i].Time > lastObjectTime)
|
||||
break;
|
||||
|
||||
double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time : lastObjectTime;
|
||||
double duration = endTime - timingPoints[i].Time;
|
||||
|
||||
if (duration > maxDuration)
|
||||
{
|
||||
maxDuration = duration;
|
||||
// The slider multiplier is post-multiplied to determine the final velocity, but for relative scale beat lengths
|
||||
// the multiplier should not affect the effective timing point (the longest in the beatmap), so it is factored out here
|
||||
baseBeatLength = timingPoints[i].BeatLength / Beatmap.Difficulty.SliderMultiplier;
|
||||
}
|
||||
}
|
||||
// The slider multiplier is post-multiplied to determine the final velocity, but for relative scale beat lengths
|
||||
// the multiplier should not affect the effective timing point (the longest in the beatmap), so it is factored out here
|
||||
baseBeatLength /= Beatmap.Difficulty.SliderMultiplier;
|
||||
}
|
||||
|
||||
// Merge sequences of timing and difficulty control points to create the aggregate "multiplier" control point
|
||||
|
Reference in New Issue
Block a user