Applied suggested changes

This commit is contained in:
EVAST9919 2017-05-14 06:45:35 +03:00
parent 6d9e11a74f
commit ef23405733
2 changed files with 15 additions and 14 deletions

View File

@ -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()
{

View File

@ -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;
/// <summary>
/// Number of spins required to finish the spinner without miss.
/// </summary>
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);
}
}
}