1
0
Fork 0
mirror of https://github.com/ppy/osu-tools.git synced 2025-06-10 01:50:46 +09:00

Add taiko and catch object inspectors

This commit is contained in:
StanR 2022-04-15 04:28:14 +03:00
parent b10f5e07f8
commit 03ebbd4e3b
3 changed files with 210 additions and 0 deletions

View file

@ -0,0 +1,90 @@

using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
using osu.Game.Rulesets.Catch.Edit;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawables;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;
namespace PerformanceCalculatorGUI.Screens.ObjectInspection
{
internal class CatchObjectInspectorRuleset : DrawableCatchRuleset
{
private readonly CatchDifficultyHitObject[] difficultyHitObjects;
public CatchObjectInspectorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods, ExtendedCatchDifficultyCalculator difficultyCalculator, double clockRate)
: base(ruleset, beatmap, mods)
{
difficultyHitObjects = difficultyCalculator.GetDifficultyHitObjects(beatmap, clockRate)
.Select(x => (CatchDifficultyHitObject)x).ToArray();
}
public override bool PropagatePositionalInputSubTree => false;
public override bool PropagateNonPositionalInputSubTree => false;
protected override Playfield CreatePlayfield() => new CatchObjectInspectorPlayfield(Beatmap.Difficulty, difficultyHitObjects);
private class CatchObjectInspectorPlayfield : CatchEditorPlayfield
{
private readonly IReadOnlyList<CatchDifficultyHitObject> difficultyHitObjects;
protected override GameplayCursorContainer CreateCursor() => null;
public CatchObjectInspectorPlayfield(IBeatmapDifficultyInfo difficulty, IReadOnlyList<CatchDifficultyHitObject> difficultyHitObjects)
: base(difficulty)
{
this.difficultyHitObjects = difficultyHitObjects;
DisplayJudgements.Value = false;
}
[BackgroundDependencyLoader]
private void load()
{
foreach (var dho in difficultyHitObjects)
{
HitObjectContainer.Add(new CatchInspectorDrawableHitObject(dho));
}
}
private class CatchInspectorDrawableHitObject : DrawableCatchHitObject
{
private readonly CatchDifficultyHitObject dho;
public CatchInspectorDrawableHitObject(CatchDifficultyHitObject dho)
: base(new CatchInspectorHitObject(dho.BaseObject))
{
this.dho = dho;
}
[BackgroundDependencyLoader]
private void load()
{
ObjectInspectionPanel panel;
AddInternal(panel = new ObjectInspectionPanel
{
X = -50
});
panel.AddParagraph($"Strain Time: {dho.StrainTime:N3}");
panel.AddParagraph($"Normalized Position: {dho.NormalizedPosition:N3}");
}
private class CatchInspectorHitObject : CatchHitObject
{
public CatchInspectorHitObject(HitObject obj)
{
StartTime = obj.StartTime;
}
}
}
}
}
}