mirror of
https://github.com/ppy/osu
synced 2024-12-14 10:57:41 +00:00
Merge pull request #11626 from peppy/fix-spinner-spm-negative
Ensure spinners only handle input during their hittable time
This commit is contained in:
commit
0dd1208579
@ -243,7 +243,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (HandleUserInput)
|
if (HandleUserInput)
|
||||||
RotationTracker.Tracking = !Result.HasResult && (OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false);
|
{
|
||||||
|
bool isValidSpinningTime = Time.Current >= HitObject.StartTime && Time.Current <= HitObject.EndTime;
|
||||||
|
bool correctButtonPressed = (OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false);
|
||||||
|
|
||||||
|
RotationTracker.Tracking = !Result.HasResult
|
||||||
|
&& correctButtonPressed
|
||||||
|
&& isValidSpinningTime;
|
||||||
|
}
|
||||||
|
|
||||||
if (spinningSample != null && spinnerFrequencyModulate)
|
if (spinningSample != null && spinnerFrequencyModulate)
|
||||||
spinningSample.Frequency.Value = spinning_sample_modulated_base_frequency + Progress;
|
spinningSample.Frequency.Value = spinning_sample_modulated_base_frequency + Progress;
|
||||||
@ -255,6 +262,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
if (!SpmCounter.IsPresent && RotationTracker.Tracking)
|
if (!SpmCounter.IsPresent && RotationTracker.Tracking)
|
||||||
SpmCounter.FadeIn(HitObject.TimeFadeIn);
|
SpmCounter.FadeIn(HitObject.TimeFadeIn);
|
||||||
|
|
||||||
SpmCounter.SetRotation(Result.RateAdjustedRotation);
|
SpmCounter.SetRotation(Result.RateAdjustedRotation);
|
||||||
|
|
||||||
updateBonusScore();
|
updateBonusScore();
|
||||||
|
@ -4,16 +4,21 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||||
{
|
{
|
||||||
public class SpinnerSpmCounter : Container
|
public class SpinnerSpmCounter : Container
|
||||||
{
|
{
|
||||||
|
[Resolved]
|
||||||
|
private DrawableHitObject drawableSpinner { get; set; }
|
||||||
|
|
||||||
private readonly OsuSpriteText spmText;
|
private readonly OsuSpriteText spmText;
|
||||||
|
|
||||||
public SpinnerSpmCounter()
|
public SpinnerSpmCounter()
|
||||||
@ -38,6 +43,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
drawableSpinner.HitObjectApplied += resetState;
|
||||||
|
}
|
||||||
|
|
||||||
private double spm;
|
private double spm;
|
||||||
|
|
||||||
public double SpinsPerMinute
|
public double SpinsPerMinute
|
||||||
@ -82,5 +93,19 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
records.Enqueue(new RotationRecord { Rotation = currentRotation, Time = Time.Current });
|
records.Enqueue(new RotationRecord { Rotation = currentRotation, Time = Time.Current });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void resetState(DrawableHitObject hitObject)
|
||||||
|
{
|
||||||
|
SpinsPerMinute = 0;
|
||||||
|
records.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (drawableSpinner != null)
|
||||||
|
drawableSpinner.HitObjectApplied -= resetState;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user