From ef234057334eb899030e824d837cf6d53b80ebc1 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sun, 14 May 2017 06:45:35 +0300 Subject: [PATCH] Applied suggested changes --- .../Objects/Drawables/DrawableSpinner.cs | 15 +-------------- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 59a381149c..e06e72a8bf 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -10,7 +10,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Game.Rulesets.Osu.UI; -using osu.Framework.Allocation; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -23,8 +22,6 @@ public class DrawableSpinner : DrawableOsuHitObject private readonly Container circleContainer; private readonly DrawableHitCircle circle; - private float beatmapOd; - public DrawableSpinner(Spinner s) : base(s) { AlwaysReceiveInput = true; @@ -74,12 +71,6 @@ public DrawableSpinner(Spinner s) : base(s) disc.Scale = scaleToCircle; } - [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuGame game) - { - beatmapOd = game?.Beatmap?.Value.Beatmap.BeatmapInfo.Difficulty.OverallDifficulty ?? 5; - } - protected override void CheckJudgement(bool userTriggered) { if (Time.Current < HitObject.StartTime) return; @@ -117,11 +108,7 @@ protected override void CheckJudgement(bool userTriggered) private Vector2 scaleToCircle => circle.Scale * circle.DrawWidth / DrawWidth * 0.95f; - private float spinsPerMinuteNeeded => 100 + beatmapOd * 15; - - private float rotationsNeeded => (float)(spinsPerMinuteNeeded * (spinner.EndTime - spinner.StartTime) / 60000f); - - public float Progress => MathHelper.Clamp(disc.RotationAbsolute / 360 / rotationsNeeded, 0, 1); + public float Progress => MathHelper.Clamp(disc.RotationAbsolute / 360 / (float)spinner.SpinsRequired, 0, 1); protected override void UpdatePreemptState() { diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 0a2c05833a..ab5d03dadc 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -2,6 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Objects.Types; +using osu.Game.Beatmaps.Timing; +using osu.Game.Database; namespace osu.Game.Rulesets.Osu.Objects { @@ -10,6 +12,18 @@ public class Spinner : OsuHitObject, IHasEndTime public double EndTime { get; set; } public double Duration => EndTime - StartTime; + /// + /// Number of spins required to finish the spinner without miss. + /// + public double SpinsRequired { get; protected set; } + public override bool NewCombo => true; + + public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(timing, difficulty); + + SpinsRequired = Duration / 1000 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); + } } }