// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. 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.Mods; namespace PerformanceCalculatorGUI.Screens.ObjectInspection { public partial class CatchObjectInspectorRuleset : DrawableCatchEditorRuleset { private readonly CatchDifficultyHitObject[] difficultyHitObjects; [Resolved] private ObjectDifficultyValuesContainer objectDifficultyValuesContainer { get; set; } public CatchObjectInspectorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods, ExtendedCatchDifficultyCalculator difficultyCalculator, double clockRate) : base(ruleset, beatmap, mods) { difficultyHitObjects = difficultyCalculator.GetDifficultyHitObjects(beatmap, clockRate) .Cast().ToArray(); } public override bool PropagatePositionalInputSubTree => false; public override bool PropagateNonPositionalInputSubTree => false; public override bool AllowBackwardsSeeks => true; protected override void Update() { base.Update(); objectDifficultyValuesContainer.CurrentDifficultyHitObject.Value = difficultyHitObjects.LastOrDefault(x => x.StartTime < Clock.CurrentTime); } } }