mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 13:53:10 +08:00
Merge pull request #25893 from smoogipoo/fix-early-slide-sample
Fix sliding sample playing before Slider's start time
This commit is contained in:
commit
1161e0ad0e
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
@ -160,6 +161,10 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Position = new Vector2(256 - slider_path_length / 2, 192),
|
Position = new Vector2(256 - slider_path_length / 2, 192),
|
||||||
TickDistanceMultiplier = 3,
|
TickDistanceMultiplier = 3,
|
||||||
ClassicSliderBehaviour = classic,
|
ClassicSliderBehaviour = classic,
|
||||||
|
Samples = new[]
|
||||||
|
{
|
||||||
|
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||||
|
},
|
||||||
Path = new SliderPath(PathType.LINEAR, new[]
|
Path = new SliderPath(PathType.LINEAR, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
|
@ -128,8 +128,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
foreach (var drawableHitObject in NestedHitObjects)
|
foreach (var drawableHitObject in NestedHitObjects)
|
||||||
drawableHitObject.AccentColour.Value = colour.NewValue;
|
drawableHitObject.AccentColour.Value = colour.NewValue;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
Tracking.BindValueChanged(updateSlidingSample);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnApply()
|
protected override void OnApply()
|
||||||
@ -166,14 +164,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
slidingSample?.Stop();
|
slidingSample?.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSlidingSample(ValueChangedEvent<bool> tracking)
|
|
||||||
{
|
|
||||||
if (tracking.NewValue)
|
|
||||||
slidingSample?.Play();
|
|
||||||
else
|
|
||||||
slidingSample?.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void AddNestedHitObject(DrawableHitObject hitObject)
|
protected override void AddNestedHitObject(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
base.AddNestedHitObject(hitObject);
|
base.AddNestedHitObject(hitObject);
|
||||||
@ -238,9 +228,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
Tracking.Value = SliderInputManager.Tracking;
|
Tracking.Value = SliderInputManager.Tracking;
|
||||||
|
|
||||||
if (Tracking.Value && slidingSample != null)
|
if (slidingSample != null)
|
||||||
// keep the sliding sample playing at the current tracking position
|
{
|
||||||
slidingSample.Balance.Value = CalculateSamplePlaybackBalance(CalculateDrawableRelativePosition(Ball));
|
if (Tracking.Value && Time.Current >= HitObject.StartTime)
|
||||||
|
{
|
||||||
|
// keep the sliding sample playing at the current tracking position
|
||||||
|
if (!slidingSample.IsPlaying)
|
||||||
|
slidingSample.Play();
|
||||||
|
slidingSample.Balance.Value = CalculateSamplePlaybackBalance(CalculateDrawableRelativePosition(Ball));
|
||||||
|
}
|
||||||
|
else if (slidingSample.IsPlaying)
|
||||||
|
slidingSample.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
double completionProgress = Math.Clamp((Time.Current - HitObject.StartTime) / HitObject.Duration, 0, 1);
|
double completionProgress = Math.Clamp((Time.Current - HitObject.StartTime) / HitObject.Duration, 0, 1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user