From beee76d64ab5b7604787603a2c9c8f559910d604 Mon Sep 17 00:00:00 2001 From: DavidBeh <67109172+DavidBeh@users.noreply.github.com> Date: Mon, 22 Apr 2024 20:25:43 +0200 Subject: [PATCH] enabled and fixed judgements for the magnetised mod --- osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs | 13 ++++++++++--- osu.Game.Rulesets.Osu/Objects/Slider.cs | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs index b49fb931d1..860f96965a 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModMagnetised.cs @@ -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 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); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index cc3ffd376e..2660933a70 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -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> SliderProgress = new ConditionalWeakTable>(); + 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(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(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()