mirror of
https://github.com/ppy/osu
synced 2024-12-26 08:53:10 +00:00
Share fade in logic with repeats
This commit is contained in:
parent
5d2a8ec764
commit
2427ae43da
@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public class DrawableSliderTail : DrawableOsuHitObject, IRequireTracking, ITrackSnaking
|
public class DrawableSliderTail : DrawableOsuHitObject, IRequireTracking, ITrackSnaking
|
||||||
{
|
{
|
||||||
private readonly Slider slider;
|
private readonly SliderTailCircle tailCircle;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The judgement text is provided by the <see cref="DrawableSlider"/>.
|
/// The judgement text is provided by the <see cref="DrawableSlider"/>.
|
||||||
@ -29,10 +29,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
private readonly Container scaleContainer;
|
private readonly Container scaleContainer;
|
||||||
|
|
||||||
public DrawableSliderTail(Slider slider, SliderTailCircle hitCircle)
|
public DrawableSliderTail(Slider slider, SliderTailCircle tailCircle)
|
||||||
: base(hitCircle)
|
: base(tailCircle)
|
||||||
{
|
{
|
||||||
this.slider = slider;
|
this.tailCircle = tailCircle;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
@ -98,9 +98,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
ApplyResult(r => r.Type = Tracking ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
ApplyResult(r => r.Type = Tracking ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateSnakingPosition(Vector2 start, Vector2 end)
|
public void UpdateSnakingPosition(Vector2 start, Vector2 end) =>
|
||||||
{
|
Position = tailCircle.RepeatIndex % 2 == 0 ? end : start;
|
||||||
Position = end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,8 +174,10 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
// we need to use the LegacyLastTick here for compatibility reasons (difficulty).
|
// we need to use the LegacyLastTick here for compatibility reasons (difficulty).
|
||||||
// it is *okay* to use this because the TailCircle is not used for any meaningful purpose in gameplay.
|
// it is *okay* to use this because the TailCircle is not used for any meaningful purpose in gameplay.
|
||||||
// if this is to change, we should revisit this.
|
// if this is to change, we should revisit this.
|
||||||
AddNested(TailCircle = new SliderTailCircle(this)
|
AddNested(TailCircle = new SliderTailCircle
|
||||||
{
|
{
|
||||||
|
RepeatIndex = e.SpanIndex,
|
||||||
|
SpanDuration = SpanDuration,
|
||||||
StartTime = e.Time,
|
StartTime = e.Time,
|
||||||
Position = EndPosition,
|
Position = EndPosition,
|
||||||
StackHeight = StackHeight
|
StackHeight = StackHeight
|
||||||
|
@ -1,9 +1,34 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects
|
namespace osu.Game.Rulesets.Osu.Objects
|
||||||
{
|
{
|
||||||
public class SliderEndCircle : HitCircle
|
/// <summary>
|
||||||
|
/// A hitcircle which is at the end of a slider path (either repeat or final tail).
|
||||||
|
/// </summary>
|
||||||
|
public abstract class SliderEndCircle : HitCircle
|
||||||
{
|
{
|
||||||
|
public int RepeatIndex { get; set; }
|
||||||
|
public double SpanDuration { get; set; }
|
||||||
|
|
||||||
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||||
|
{
|
||||||
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||||
|
|
||||||
|
// Out preempt should be one span early to give the user ample warning.
|
||||||
|
TimePreempt += SpanDuration;
|
||||||
|
|
||||||
|
// We want to show the first RepeatPoint as the TimePreempt dictates but on short (and possibly fast) sliders
|
||||||
|
// we may need to cut down this time on following RepeatPoints to only show up to two RepeatPoints at any given time.
|
||||||
|
if (RepeatIndex > 0)
|
||||||
|
TimePreempt = Math.Min(SpanDuration * 2, TimePreempt);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,14 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects
|
namespace osu.Game.Rulesets.Osu.Objects
|
||||||
{
|
{
|
||||||
public class SliderRepeat : OsuHitObject
|
public class SliderRepeat : SliderEndCircle
|
||||||
{
|
{
|
||||||
public int RepeatIndex { get; set; }
|
|
||||||
public double SpanDuration { get; set; }
|
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
|
||||||
{
|
|
||||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
|
||||||
|
|
||||||
// Out preempt should be one span early to give the user ample warning.
|
|
||||||
TimePreempt += SpanDuration;
|
|
||||||
|
|
||||||
// We want to show the first RepeatPoint as the TimePreempt dictates but on short (and possibly fast) sliders
|
|
||||||
// we may need to cut down this time on following RepeatPoints to only show up to two RepeatPoints at any given time.
|
|
||||||
if (RepeatIndex > 0)
|
|
||||||
TimePreempt = Math.Min(SpanDuration * 2, TimePreempt);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new SliderRepeatJudgement();
|
public override Judgement CreateJudgement() => new SliderRepeatJudgement();
|
||||||
|
|
||||||
public class SliderRepeatJudgement : OsuJudgement
|
public class SliderRepeatJudgement : OsuJudgement
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
@ -13,18 +12,8 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
/// Note that this should not be used for timing correctness.
|
/// Note that this should not be used for timing correctness.
|
||||||
/// See <see cref="SliderEventType.LegacyLastTick"/> usage in <see cref="Slider"/> for more information.
|
/// See <see cref="SliderEventType.LegacyLastTick"/> usage in <see cref="Slider"/> for more information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SliderTailCircle : SliderCircle
|
public class SliderTailCircle : SliderEndCircle
|
||||||
{
|
{
|
||||||
private readonly IBindable<int> pathVersion = new Bindable<int>();
|
|
||||||
|
|
||||||
public SliderTailCircle(Slider slider)
|
|
||||||
{
|
|
||||||
pathVersion.BindTo(slider.Path.Version);
|
|
||||||
pathVersion.BindValueChanged(_ => Position = slider.EndPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new SliderTailJudgement();
|
public override Judgement CreateJudgement() => new SliderTailJudgement();
|
||||||
|
|
||||||
public class SliderTailJudgement : OsuJudgement
|
public class SliderTailJudgement : OsuJudgement
|
||||||
|
Loading…
Reference in New Issue
Block a user