mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:32:55 +08:00
Add classic slider ball tracking
This commit is contained in:
parent
3aa3692ed4
commit
ee3367d7c5
@ -1,19 +1,22 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModClassic : Mod, IApplicableToHitObject, IApplicableToDrawableRuleset<OsuHitObject>
|
public class OsuModClassic : Mod, IApplicableToHitObject, IApplicableToDrawableHitObjects, IApplicableToDrawableRuleset<OsuHitObject>
|
||||||
{
|
{
|
||||||
public override string Name => "Classic";
|
public override string Name => "Classic";
|
||||||
|
|
||||||
@ -36,6 +39,9 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
[SettingSource("Disable note lock lenience", "Applies note lock to the full hit window.")]
|
[SettingSource("Disable note lock lenience", "Applies note lock to the full hit window.")]
|
||||||
public Bindable<bool> DisableLenientNoteLock { get; } = new BindableBool(true);
|
public Bindable<bool> DisableLenientNoteLock { get; } = new BindableBool(true);
|
||||||
|
|
||||||
|
[SettingSource("Disable exact slider follow circle tracking", "Makes the slider follow circle track its final size at all times.")]
|
||||||
|
public Bindable<bool> DisableExactFollowCircleTracking { get; } = new BindableBool(true);
|
||||||
|
|
||||||
public void ApplyToHitObject(HitObject hitObject)
|
public void ApplyToHitObject(HitObject hitObject)
|
||||||
{
|
{
|
||||||
switch (hitObject)
|
switch (hitObject)
|
||||||
@ -60,5 +66,14 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
if (!DisableLenientNoteLock.Value)
|
if (!DisableLenientNoteLock.Value)
|
||||||
osuRuleset.Playfield.HitPolicy = new ObjectOrderedHitPolicy();
|
osuRuleset.Playfield.HitPolicy = new ObjectOrderedHitPolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
|
{
|
||||||
|
foreach (var obj in drawables)
|
||||||
|
{
|
||||||
|
if (obj is DrawableSlider slider)
|
||||||
|
slider.Ball.TrackVisualSize = !DisableExactFollowCircleTracking.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
set => ball.Colour = value;
|
set => ball.Colour = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to track accurately to the visual size of this <see cref="SliderBall"/>.
|
||||||
|
/// If <c>false</c>, tracking will be performed at the final scale at all times.
|
||||||
|
/// </summary>
|
||||||
|
public bool TrackVisualSize = true;
|
||||||
|
|
||||||
private readonly Drawable followCircle;
|
private readonly Drawable followCircle;
|
||||||
private readonly DrawableSlider drawableSlider;
|
private readonly DrawableSlider drawableSlider;
|
||||||
private readonly Drawable ball;
|
private readonly Drawable ball;
|
||||||
@ -94,7 +100,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
tracking = value;
|
tracking = value;
|
||||||
|
|
||||||
followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint);
|
if (TrackVisualSize)
|
||||||
|
followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We need to always be tracking the final size, at both endpoints. For now, this is achieved by removing the scale duration.
|
||||||
|
followCircle.ScaleTo(tracking ? 2.4f : 1f);
|
||||||
|
}
|
||||||
|
|
||||||
followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
|
followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user