2024-11-19 06:53:01 +08:00
|
|
|
// 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.Linq;
|
2024-11-21 19:17:43 +08:00
|
|
|
using osu.Game.Rulesets.Catch.Objects;
|
2024-11-19 06:53:01 +08:00
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
using osu.Game.Screens.Edit.Compose.Components;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Edit
|
|
|
|
{
|
|
|
|
public partial class CatchHitObjectInspector(CatchDistanceSnapProvider snapProvider) : HitObjectInspector
|
|
|
|
{
|
|
|
|
protected override void AddInspectorValues(HitObject[] objects)
|
|
|
|
{
|
|
|
|
base.AddInspectorValues(objects);
|
|
|
|
|
|
|
|
if (objects.Length > 0)
|
|
|
|
{
|
|
|
|
HitObject firstSelectedHitObject = objects.MinBy(ho => ho.StartTime)!;
|
|
|
|
HitObject lastSelectedHitObject = objects.MaxBy(ho => ho.GetEndTime())!;
|
|
|
|
|
|
|
|
HitObject? precedingObject = EditorBeatmap.HitObjects.LastOrDefault(ho => ho.GetEndTime() < firstSelectedHitObject.StartTime);
|
|
|
|
HitObject? nextObject = EditorBeatmap.HitObjects.FirstOrDefault(ho => ho.StartTime > lastSelectedHitObject.GetEndTime());
|
|
|
|
|
2024-11-21 19:17:43 +08:00
|
|
|
if (precedingObject != null && precedingObject is not BananaShower)
|
2024-11-19 06:53:01 +08:00
|
|
|
{
|
|
|
|
double previousSnap = snapProvider.ReadCurrentDistanceSnap(precedingObject, firstSelectedHitObject);
|
2024-11-20 02:54:12 +08:00
|
|
|
AddHeader("To previous");
|
|
|
|
AddValue($"{previousSnap:#,0.##}x");
|
2024-11-19 06:53:01 +08:00
|
|
|
}
|
|
|
|
|
2024-11-21 19:17:43 +08:00
|
|
|
if (nextObject != null && nextObject is not BananaShower)
|
2024-11-19 06:53:01 +08:00
|
|
|
{
|
|
|
|
double nextSnap = snapProvider.ReadCurrentDistanceSnap(lastSelectedHitObject, nextObject);
|
2024-11-20 02:54:12 +08:00
|
|
|
AddHeader("To next");
|
|
|
|
AddValue($"{nextSnap:#,0.##}x");
|
2024-11-19 06:53:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|