1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 16:03:01 +08:00

Change difficulty popover inspector display (yet again)

I think this makes the most sense of the iterations I've tested so far, albeit maybe being a touch too verbose.
This commit is contained in:
Dean Herbert 2023-05-08 13:43:21 +09:00
parent a91edd68d9
commit a6cb1f90e4

View File

@ -96,7 +96,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Hold shift while dragging the end of an object to adjust velocity while snapping." Text = "Hold shift while dragging the end of an object to adjust velocity while snapping."
}, },
new SliderVelocityInspector(), new SliderVelocityInspector(sliderVelocitySlider.Current),
} }
} }
}; };
@ -145,28 +145,48 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
internal partial class SliderVelocityInspector : EditorInspector internal partial class SliderVelocityInspector : EditorInspector
{ {
private readonly Bindable<double?> current;
public SliderVelocityInspector(Bindable<double?> current)
{
this.current = current;
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
EditorBeatmap.TransactionBegan += updateInspectorText; EditorBeatmap.TransactionBegan += updateInspectorText;
EditorBeatmap.TransactionEnded += updateInspectorText; EditorBeatmap.TransactionEnded += updateInspectorText;
EditorBeatmap.BeatmapReprocessed += updateInspectorText;
current.ValueChanged += _ => updateInspectorText();
updateInspectorText(); updateInspectorText();
} }
private void updateInspectorText() private void updateInspectorText()
{ {
double beatmapVelocity = EditorBeatmap.Difficulty.BaseSliderVelocity;
InspectorText.Clear(); InspectorText.Clear();
double[] sliderVelocities = EditorBeatmap.HitObjects.OfType<IHasSliderVelocity>().Select(sv => sv.SliderVelocity).OrderBy(v => v).ToArray(); double[] sliderVelocities = EditorBeatmap.HitObjects.OfType<IHasSliderVelocity>().Select(sv => sv.SliderVelocity).OrderBy(v => v).ToArray();
AddHeader("Base velocity (from beatmap setup)");
AddValue($"{beatmapVelocity:#,0.00}x");
AddHeader("Final velocity");
AddValue($"{beatmapVelocity * current.Value:#,0.00}x");
if (sliderVelocities.First() != sliderVelocities.Last()) if (sliderVelocities.First() != sliderVelocities.Last())
{ {
AddHeader("Used velocity range"); AddHeader("Beatmap velocity range");
AddValue($"{sliderVelocities.First():#,0.00}x - {sliderVelocities.Last():#,0.00}x");
}
AddHeader("Beatmap base velocity"); string range = $"{sliderVelocities.First():#,0.00}x - {sliderVelocities.Last():#,0.00}x";
AddValue($"{EditorBeatmap.Difficulty.BaseSliderVelocity:#,0.00}x"); if (beatmapVelocity != 1)
range += $" ({beatmapVelocity * sliderVelocities.First():#,0.00}x - {beatmapVelocity * sliderVelocities.Last():#,0.00}x)";
AddValue(range);
}
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)