enabled and fixed judgements for the magnetised mod

This commit is contained in:
DavidBeh 2024-04-22 20:25:43 +02:00
parent b9b341affd
commit beee76d64a
2 changed files with 19 additions and 3 deletions

View File

@ -13,7 +13,6 @@
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;
using osuTK;
@ -37,12 +36,16 @@ internal class OsuModMagnetised : Mod, IUpdatableByPlayfield, IApplicableToDrawa
MaxValue = 1.0f,
};
// Bindable Setting for Show Judgements
[SettingSource("Show Judgements", "Whether to show judgements or not.")]
public BindableBool ShowJudgements { get; } = new BindableBool(true);
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
{
// Hide judgment displays and follow points as they won't make any sense.
// Judgements can potentially be turned on in a future where they display at a position relative to their drawable counterpart.
drawableRuleset.Playfield.DisplayJudgements.Value = false;
(drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide();
drawableRuleset.Playfield.DisplayJudgements.Value = ShowJudgements.Value;
//(drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide();
}
public void Update(Playfield playfield)
@ -78,6 +81,10 @@ private void easeTo(IFrameBasedClock clock, DrawableHitObject hitObject, Vector2
float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, clock.ElapsedFrameTime);
float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, clock.ElapsedFrameTime);
// I added these two lines
if (hitObject is DrawableOsuHitObject h)
h.HitObject.Position = new Vector2(x, y);
hitObject.Position = new Vector2(x, y);
}
}

View File

@ -8,6 +8,7 @@
using System.Collections.Generic;
using osu.Game.Rulesets.Objects;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using Newtonsoft.Json;
using osu.Framework.Bindables;
@ -24,6 +25,8 @@ namespace osu.Game.Rulesets.Osu.Objects
{
public class Slider : OsuHitObject, IHasPathWithRepeats, IHasSliderVelocity, IHasGenerateTicks
{
private static readonly ConditionalWeakTable<HitObject, StrongBox<double>> SliderProgress = new ConditionalWeakTable<HitObject, StrongBox<double>>();
public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
[JsonIgnore]
@ -201,6 +204,7 @@ protected override void CreateNestedHitObjects(CancellationToken cancellationTok
Position = Position + Path.PositionAt(e.PathProgress),
StackHeight = StackHeight,
});
SliderProgress.AddOrUpdate(NestedHitObjects.Last(), new StrongBox<double>(e.PathProgress));
break;
case SliderEventType.Head:
@ -232,6 +236,7 @@ protected override void CreateNestedHitObjects(CancellationToken cancellationTok
Position = Position + Path.PositionAt(e.PathProgress),
StackHeight = StackHeight,
});
SliderProgress.Add(NestedHitObjects.Last(), new StrongBox<double>(e.PathProgress));
break;
}
}
@ -248,6 +253,10 @@ private void updateNestedPositions()
if (TailCircle != null)
TailCircle.Position = EndPosition;
foreach (var hitObject in NestedHitObjects)
if (hitObject is SliderTick or SliderRepeat)
((OsuHitObject)hitObject).Position = Position + Path.PositionAt(SliderProgress.TryGetValue(hitObject, out var progress) ? progress?.Value ?? 0 : 0);
}
protected void UpdateNestedSamples()