1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 18:23:04 +08:00

Move spinner completion info into judgement

This commit is contained in:
Bartłomiej Dach 2020-11-14 22:42:19 +01:00
parent af392e3995
commit 727a886fb3
5 changed files with 20 additions and 6 deletions

View File

@ -38,6 +38,12 @@ namespace osu.Game.Rulesets.Osu.Judgements
/// </example>
public float RateAdjustedRotation;
/// <summary>
/// Time instant at which the spinner has been completed (the user has executed all required spins).
/// Will be null if all required spins haven't been completed.
/// </summary>
public double? TimeCompleted;
public OsuSpinnerJudgementResult(HitObject hitObject, Judgement judgement)
: base(hitObject, judgement)
{

View File

@ -211,7 +211,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
if (Time.Current < HitObject.StartTime) return;
RotationTracker.Complete.Value = Progress >= 1;
if (Progress >= 1)
Result.TimeCompleted ??= Time.Current;
if (userTriggered || Time.Current < HitObject.EndTime)
return;

View File

@ -3,6 +3,7 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -28,6 +29,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
private SpinnerTicks ticks;
private int wholeRotationCount;
private readonly BindableBool complete = new BindableBool();
private SpinnerFill fill;
private Container mainContainer;
@ -89,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
base.LoadComplete();
drawableSpinner.RotationTracker.Complete.BindValueChanged(complete => updateComplete(complete.NewValue, 200));
complete.BindValueChanged(complete => updateComplete(complete.NewValue, 200));
drawableSpinner.ApplyCustomUpdateState += updateStateTransforms;
updateStateTransforms(drawableSpinner, drawableSpinner.State.Value);
@ -99,7 +101,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
base.Update();
if (drawableSpinner.RotationTracker.Complete.Value)
complete.Value = Time.Current >= drawableSpinner.Result.TimeCompleted;
if (complete.Value)
{
if (checkNewRotationCount)
{

View File

@ -30,8 +30,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
public bool Tracking { get; set; }
public readonly BindableBool Complete = new BindableBool();
/// <summary>
/// Whether the spinning is spinning at a reasonable speed to be considered visually spinning.
/// </summary>

View File

@ -60,7 +60,6 @@ namespace osu.Game.Rulesets.Osu.Skinning
{
base.LoadComplete();
completed.BindTo(DrawableSpinner.RotationTracker.Complete);
completed.BindValueChanged(onCompletedChanged, true);
DrawableSpinner.ApplyCustomUpdateState += UpdateStateTransforms;
@ -93,6 +92,12 @@ namespace osu.Game.Rulesets.Osu.Skinning
}
}
protected override void Update()
{
base.Update();
completed.Value = Time.Current >= DrawableSpinner.Result.TimeCompleted;
}
protected virtual void UpdateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
{
switch (drawableHitObject)