Give Slider a tail hitobject to make slider ends counts towards score

This commit is contained in:
smoogipoo
2018-01-30 16:24:23 +09:00
parent b293408147
commit 702c4efb88
7 changed files with 89 additions and 14 deletions

View File

@ -18,14 +18,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
{
private readonly Slider slider;
public readonly DrawableHitCircle HeadCircle;
private readonly List<Drawable> components = new List<Drawable>();
private readonly Container<DrawableSliderTick> ticks;
private readonly Container<DrawableRepeatPoint> repeatPoints;
public readonly DrawableHitCircle HeadCircle;
public readonly SliderBody Body;
public readonly SliderBall Ball;
@ -34,6 +29,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
slider = s;
DrawableSliderTail tail;
Container<DrawableSliderTick> ticks;
Container<DrawableRepeatPoint> repeatPoints;
Children = new Drawable[]
{
Body = new SliderBody(s)
@ -51,7 +50,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AlwaysPresent = true,
Alpha = 0
},
HeadCircle = new DrawableHitCircle(s.HeadCircle)
HeadCircle = new DrawableHitCircle(s.HeadCircle),
tail = new DrawableSliderTail(s.TailCircle)
};
components.Add(Body);
@ -59,6 +59,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AddNested(HeadCircle);
AddNested(tail);
components.Add(tail);
foreach (var tick in s.NestedHitObjects.OfType<SliderTick>())
{
var spanStartTime = s.StartTime + tick.SpanIndex * s.SpanDuration;
@ -73,6 +76,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
};
ticks.Add(drawableTick);
components.Add(drawableTick);
AddNested(drawableTick);
}
@ -112,17 +116,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
foreach (var c in components.OfType<ISliderProgress>()) c.UpdateProgress(progress, span);
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 ticks.Children) t.Tracking = Ball.Tracking;
foreach (var t in components.OfType<IRequireTracking>()) t.Tracking = Ball.Tracking;
}
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{
if (!userTriggered && Time.Current >= slider.EndTime)
{
var judgementsCount = ticks.Children.Count + repeatPoints.Children.Count + 1;
var judgementsHit = ticks.Children.Count(t => t.Judgements.Any(j => j.IsHit)) + repeatPoints.Children.Count(t => t.Judgements.Any(j => j.IsHit));
if (HeadCircle.Judgements.Any(j => j.IsHit))
judgementsHit++;
var judgementsCount = NestedHitObjects.Count;
var judgementsHit = NestedHitObjects.Count(h => h.IsHit);
var hitFraction = (double)judgementsHit / judgementsCount;
if (hitFraction == 1 && HeadCircle.Judgements.Any(j => j.Result == HitResult.Great))