mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:52:55 +08:00
Clean up and document better what "progress" means
This commit is contained in:
parent
b3424c14f1
commit
f877b642da
@ -10,7 +10,6 @@ using System.Linq;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
@ -87,7 +86,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int currentSpan;
|
|
||||||
public bool Tracking;
|
public bool Tracking;
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -96,19 +94,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
Tracking = Ball.Tracking;
|
Tracking = Ball.Tracking;
|
||||||
|
|
||||||
double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
|
double completionProgress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
|
||||||
|
|
||||||
int span = slider.SpanAt(progress);
|
|
||||||
progress = slider.ProgressAt(progress);
|
|
||||||
|
|
||||||
if (span > currentSpan)
|
|
||||||
currentSpan = span;
|
|
||||||
|
|
||||||
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
|
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
|
||||||
if (!HeadCircle.IsHit)
|
if (!HeadCircle.IsHit)
|
||||||
HeadCircle.Position = slider.Curve.PositionAt(progress);
|
HeadCircle.Position = slider.Curve.PositionAt(progress);
|
||||||
|
|
||||||
foreach (var c in components.OfType<ISliderProgress>()) c.UpdateProgress(progress, span);
|
foreach (var c in components.OfType<ISliderProgress>()) c.UpdateProgress(completionProgress);
|
||||||
foreach (var c in components.OfType<ITrackSnaking>()) c.UpdateSnakingPosition(slider.Curve.PositionAt(Body.SnakedStart ?? 0), slider.Curve.PositionAt(Body.SnakedEnd ?? 0));
|
foreach (var c in components.OfType<ITrackSnaking>()) c.UpdateSnakingPosition(slider.Curve.PositionAt(Body.SnakedStart ?? 0), slider.Curve.PositionAt(Body.SnakedEnd ?? 0));
|
||||||
foreach (var t in components.OfType<IRequireTracking>()) t.Tracking = Ball.Tracking;
|
foreach (var t in components.OfType<IRequireTracking>()) t.Tracking = Ball.Tracking;
|
||||||
}
|
}
|
||||||
|
@ -139,9 +139,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateProgress(double progress, int span)
|
public void UpdateProgress(double completionProgress)
|
||||||
{
|
{
|
||||||
Position = slider.Curve.PositionAt(progress);
|
Position = slider.StackedPositionAt(completionProgress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateProgress(double progress, int span)
|
public void UpdateProgress(double completionProgress)
|
||||||
{
|
{
|
||||||
|
var span = slider.SpanAt(completionProgress);
|
||||||
|
var spanProgress = slider.ProgressAt(completionProgress);
|
||||||
|
|
||||||
double start = 0;
|
double start = 0;
|
||||||
double end = snakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadein, 0, 1) : 1;
|
double end = snakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadein, 0, 1) : 1;
|
||||||
|
|
||||||
@ -177,11 +180,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
if (Math.Min(span, slider.SpanCount() - 1) % 2 == 1)
|
if (Math.Min(span, slider.SpanCount() - 1) % 2 == 1)
|
||||||
{
|
{
|
||||||
start = 0;
|
start = 0;
|
||||||
end = snakingOut ? progress : 1;
|
end = snakingOut ? spanProgress : 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start = snakingOut ? progress : 0;
|
start = snakingOut ? spanProgress : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
public interface ISliderProgress
|
public interface ISliderProgress
|
||||||
{
|
{
|
||||||
void UpdateProgress(double progress, int span);
|
/// <summary>
|
||||||
|
/// Updates the progress of this <see cref="ISliderProgress"/> element along the slider.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="completionProgress">Amount of the slider completed.</param>
|
||||||
|
void UpdateProgress(double completionProgress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user