mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Merge pull request #18795 from smoogipoo/full-size-follow-circle
Track the full size of the follow circle at all times
This commit is contained in:
commit
8cda55e224
120
osu.Game.Rulesets.Osu.Tests/TestSceneSliderFollowCircleInput.cs
Normal file
120
osu.Game.Rulesets.Osu.Tests/TestSceneSliderFollowCircleInput.cs
Normal file
@ -0,0 +1,120 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Replays;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
[HeadlessTest]
|
||||
public class TestSceneSliderFollowCircleInput : RateAdjustedBeatmapTestScene
|
||||
{
|
||||
private List<JudgementResult>? judgementResults;
|
||||
private ScoreAccessibleReplayPlayer? currentPlayer;
|
||||
|
||||
[Test]
|
||||
public void TestMaximumDistanceTrackingWithoutMovement(
|
||||
[Values(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)]
|
||||
float circleSize,
|
||||
[Values(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)]
|
||||
double velocity)
|
||||
{
|
||||
const double time_slider_start = 1000;
|
||||
|
||||
float circleRadius = OsuHitObject.OBJECT_RADIUS * (1.0f - 0.7f * (circleSize - 5) / 5) / 2;
|
||||
float followCircleRadius = circleRadius * 1.2f;
|
||||
|
||||
performTest(new Beatmap<OsuHitObject>
|
||||
{
|
||||
HitObjects =
|
||||
{
|
||||
new Slider
|
||||
{
|
||||
StartTime = time_slider_start,
|
||||
Position = new Vector2(0, 0),
|
||||
DifficultyControlPoint = new DifficultyControlPoint { SliderVelocity = velocity },
|
||||
Path = new SliderPath(PathType.Linear, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(followCircleRadius, 0),
|
||||
}, followCircleRadius),
|
||||
},
|
||||
},
|
||||
BeatmapInfo =
|
||||
{
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = circleSize,
|
||||
SliderTickRate = 1
|
||||
},
|
||||
Ruleset = new OsuRuleset().RulesetInfo
|
||||
},
|
||||
}, new List<ReplayFrame>
|
||||
{
|
||||
new OsuReplayFrame { Position = new Vector2(-circleRadius + 1, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
|
||||
});
|
||||
|
||||
AddAssert("Tracking kept", assertMaxJudge);
|
||||
}
|
||||
|
||||
private bool assertMaxJudge() => judgementResults?.Any() == true && judgementResults.All(t => t.Type == t.Judgement.MaxResult);
|
||||
|
||||
private void performTest(Beatmap<OsuHitObject> beatmap, List<ReplayFrame> frames)
|
||||
{
|
||||
AddStep("load player", () =>
|
||||
{
|
||||
Beatmap.Value = CreateWorkingBeatmap(beatmap);
|
||||
|
||||
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } });
|
||||
|
||||
p.OnLoadComplete += _ =>
|
||||
{
|
||||
p.ScoreProcessor.NewJudgement += result =>
|
||||
{
|
||||
if (currentPlayer == p) judgementResults?.Add(result);
|
||||
};
|
||||
};
|
||||
|
||||
LoadScreen(currentPlayer = p);
|
||||
judgementResults = new List<JudgementResult>();
|
||||
});
|
||||
|
||||
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
|
||||
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
|
||||
AddUntilStep("Wait for completion", () => currentPlayer?.ScoreProcessor.HasCompleted.Value == true);
|
||||
}
|
||||
|
||||
private class ScoreAccessibleReplayPlayer : ReplayPlayer
|
||||
{
|
||||
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||
|
||||
protected override bool PauseOnFocusLost => false;
|
||||
|
||||
public ScoreAccessibleReplayPlayer(Score score)
|
||||
: base(score, new PlayerConfiguration
|
||||
{
|
||||
AllowPause = false,
|
||||
ShowResults = false,
|
||||
})
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -30,9 +30,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
[SettingSource("Apply classic note lock", "Applies note lock to the full hit window.")]
|
||||
public Bindable<bool> ClassicNoteLock { get; } = new BindableBool(true);
|
||||
|
||||
[SettingSource("Use fixed slider follow circle hit area", "Makes the slider follow circle track its final size at all times.")]
|
||||
public Bindable<bool> FixedFollowCircleHitArea { get; } = new BindableBool(true);
|
||||
|
||||
[SettingSource("Always play a slider's tail sample", "Always plays a slider's tail sample regardless of whether it was hit or not.")]
|
||||
public Bindable<bool> AlwaysPlayTailSample { get; } = new BindableBool(true);
|
||||
|
||||
@ -62,10 +59,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
switch (obj)
|
||||
{
|
||||
case DrawableSlider slider:
|
||||
slider.Ball.InputTracksVisualSize = !FixedFollowCircleHitArea.Value;
|
||||
break;
|
||||
|
||||
case DrawableSliderHead head:
|
||||
head.TrackFollowCircle = !NoSliderHeadMovement.Value;
|
||||
break;
|
||||
|
@ -34,13 +34,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
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 InputTracksVisualSize = true;
|
||||
|
||||
private readonly Drawable followCircle;
|
||||
private readonly Drawable fullSizeFollowCircle;
|
||||
private readonly DrawableSlider drawableSlider;
|
||||
private readonly Drawable ball;
|
||||
|
||||
@ -62,6 +57,13 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
Alpha = 0,
|
||||
Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderFollowCircle), _ => new DefaultFollowCircle()),
|
||||
},
|
||||
fullSizeFollowCircle = new CircularContainer
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true
|
||||
},
|
||||
ball = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderBall), _ => new DefaultSliderBall())
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
@ -104,14 +106,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
|
||||
tracking = value;
|
||||
|
||||
if (InputTracksVisualSize)
|
||||
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);
|
||||
}
|
||||
fullSizeFollowCircle.Scale = new Vector2(tracking ? 2.4f : 1f);
|
||||
|
||||
followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint);
|
||||
followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
@ -170,7 +167,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
// in valid time range
|
||||
Time.Current >= drawableSlider.HitObject.StartTime && Time.Current < drawableSlider.HitObject.EndTime &&
|
||||
// in valid position range
|
||||
lastScreenSpaceMousePosition.HasValue && followCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
|
||||
lastScreenSpaceMousePosition.HasValue && fullSizeFollowCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
|
||||
// valid action
|
||||
(actions?.Any(isValidTrackingAction) ?? false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user