mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 10:22:54 +08:00
Store tracking history to slider judgement result instead
This commit is contained in:
parent
1d1db951f0
commit
876b806423
20
osu.Game.Rulesets.Osu/Judgements/OsuSliderJudgementResult.cs
Normal file
20
osu.Game.Rulesets.Osu/Judgements/OsuSliderJudgementResult.cs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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 osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Judgements
|
||||
{
|
||||
public class OsuSliderJudgementResult : OsuJudgementResult
|
||||
{
|
||||
public readonly Stack<(double time, bool tracking)> TrackingHistory = new Stack<(double, bool)>();
|
||||
|
||||
public OsuSliderJudgementResult(HitObject hitObject, Judgement judgement)
|
||||
: base(hitObject, judgement)
|
||||
{
|
||||
TrackingHistory.Push((double.NegativeInfinity, false));
|
||||
}
|
||||
}
|
||||
}
|
@ -14,8 +14,10 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Layout;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Skinning.Default;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
@ -27,6 +29,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
public new Slider HitObject => (Slider)base.HitObject;
|
||||
|
||||
public new OsuSliderJudgementResult Result => (OsuSliderJudgementResult)base.Result;
|
||||
|
||||
public DrawableSliderHead HeadCircle => headContainer.Child;
|
||||
public DrawableSliderTail TailCircle => tailContainer.Child;
|
||||
|
||||
@ -134,6 +138,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override JudgementResult CreateResult(Judgement judgement) => new OsuSliderJudgementResult(HitObject, judgement);
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
base.OnApply();
|
||||
|
@ -27,8 +27,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
[Resolved]
|
||||
private IGameplayClock? gameplayClock { get; set; }
|
||||
|
||||
private readonly Stack<(double time, bool tracking)> trackingHistory = new Stack<(double, bool)>();
|
||||
|
||||
/// <summary>
|
||||
/// The point in time after which we can accept any key for tracking. Before this time, we may need to restrict tracking to the key used to hit the head circle.
|
||||
///
|
||||
@ -219,6 +217,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
if (gameplayClock?.IsRewinding == true)
|
||||
{
|
||||
var trackingHistory = slider.Result.TrackingHistory;
|
||||
while (trackingHistory.TryPeek(out var historyEntry) && Time.Current < historyEntry.time)
|
||||
trackingHistory.Pop();
|
||||
|
||||
@ -271,7 +270,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
&& validTrackingAction;
|
||||
|
||||
if (wasTracking != Tracking)
|
||||
trackingHistory.Push((Time.Current, Tracking));
|
||||
slider.Result.TrackingHistory.Push((Time.Current, Tracking));
|
||||
}
|
||||
|
||||
private OsuAction? getInitialHitAction() => slider.HeadCircle?.HitAction;
|
||||
@ -293,8 +292,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
private void resetState(DrawableHitObject obj)
|
||||
{
|
||||
Tracking = false;
|
||||
trackingHistory.Clear();
|
||||
trackingHistory.Push((double.NegativeInfinity, false));
|
||||
timeToAcceptAnyKeyAfter = null;
|
||||
lastPressedActions.Clear();
|
||||
screenSpaceMousePosition = null;
|
||||
|
Loading…
Reference in New Issue
Block a user