From c67393ddefc1d1d6953afb550bcdd32b421a09a1 Mon Sep 17 00:00:00 2001 From: StanR Date: Tue, 25 Jun 2024 23:19:35 +0500 Subject: [PATCH 1/3] Fix object inspectors not working --- .../CatchObjectInspectorRuleset.cs | 34 ++----------------- .../ObjectInspection/ObjectInspector.cs | 1 - .../OsuObjectInspectorRuleset.cs | 9 ++--- .../TaikoObjectInspectorRuleset.cs | 5 ++- 4 files changed, 11 insertions(+), 38 deletions(-) diff --git a/PerformanceCalculatorGUI/Screens/ObjectInspection/CatchObjectInspectorRuleset.cs b/PerformanceCalculatorGUI/Screens/ObjectInspection/CatchObjectInspectorRuleset.cs index 5079936..ce397f7 100644 --- a/PerformanceCalculatorGUI/Screens/ObjectInspection/CatchObjectInspectorRuleset.cs +++ b/PerformanceCalculatorGUI/Screens/ObjectInspection/CatchObjectInspectorRuleset.cs @@ -4,21 +4,15 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; -using osu.Game.Graphics; using osu.Game.Rulesets; using osu.Game.Rulesets.Catch.Difficulty.Preprocessing; using osu.Game.Rulesets.Catch.Edit; -using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.UI; namespace PerformanceCalculatorGUI.Screens.ObjectInspection { - public partial class CatchObjectInspectorRuleset : DrawableCatchRuleset + public partial class CatchObjectInspectorRuleset : DrawableCatchEditorRuleset { private readonly CatchDifficultyHitObject[] difficultyHitObjects; @@ -36,36 +30,12 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection public override bool PropagateNonPositionalInputSubTree => false; - protected override Playfield CreatePlayfield() => new CatchObjectInspectorPlayfield(Beatmap.Difficulty); + public override bool AllowBackwardsSeeks => true; protected override void Update() { base.Update(); objectDifficultyValuesContainer.CurrentDifficultyHitObject.Value = difficultyHitObjects.LastOrDefault(x => x.StartTime < Clock.CurrentTime); } - - private partial class CatchObjectInspectorPlayfield : CatchEditorPlayfield - { - protected override GameplayCursorContainer CreateCursor() => null!; - - public CatchObjectInspectorPlayfield(IBeatmapDifficultyInfo difficulty) - : base(difficulty) - { - DisplayJudgements.Value = false; - AddInternal(new Container - { - RelativeSizeAxes = Axes.X, - Y = 440, - Height = 6.0f, - CornerRadius = 4.0f, - Masking = true, - Child = new Box - { - Colour = OsuColour.Gray(0.5f), - RelativeSizeAxes = Axes.Both - } - }); - } - } } } diff --git a/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectInspector.cs b/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectInspector.cs index 1b795ce..f52a1f6 100644 --- a/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectInspector.cs +++ b/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectInspector.cs @@ -178,7 +178,6 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection }, "taiko" => new TaikoPlayfieldAdjustmentContainer { - RelativeSizeAxes = Axes.Both, Child = new TaikoObjectInspectorRuleset(rulesetInstance, playableBeatmap, modifiedMods, difficultyCalculator.Value as ExtendedTaikoDifficultyCalculator, processorBeatmap.Track.Rate) { diff --git a/PerformanceCalculatorGUI/Screens/ObjectInspection/OsuObjectInspectorRuleset.cs b/PerformanceCalculatorGUI/Screens/ObjectInspection/OsuObjectInspectorRuleset.cs index 12d8785..999148d 100644 --- a/PerformanceCalculatorGUI/Screens/ObjectInspection/OsuObjectInspectorRuleset.cs +++ b/PerformanceCalculatorGUI/Screens/ObjectInspection/OsuObjectInspectorRuleset.cs @@ -10,13 +10,14 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.UI; namespace PerformanceCalculatorGUI.Screens.ObjectInspection { - public partial class OsuObjectInspectorRuleset : DrawableOsuRuleset + public partial class OsuObjectInspectorRuleset : DrawableOsuEditorRuleset { private readonly OsuDifficultyHitObject[] difficultyHitObjects; @@ -39,6 +40,8 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection public override bool PropagateNonPositionalInputSubTree => false; + public override bool AllowBackwardsSeeks => true; + protected override Playfield CreatePlayfield() => new OsuObjectInspectorPlayfield(difficultyHitObjects); private partial class OsuObjectInspectorPlayfield : OsuPlayfield @@ -55,14 +58,12 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection protected override void OnNewDrawableHitObject(DrawableHitObject d) { + base.OnNewDrawableHitObject(d); d.ApplyCustomUpdateState += updateState; } private void updateState(DrawableHitObject hitObject, ArmedState state) { - if (state == ArmedState.Idle) - return; - if (hitObject is DrawableSliderRepeat repeat) { repeat.Arrow.ApplyTransformsAt(hitObject.StateUpdateTime, true); diff --git a/PerformanceCalculatorGUI/Screens/ObjectInspection/TaikoObjectInspectorRuleset.cs b/PerformanceCalculatorGUI/Screens/ObjectInspection/TaikoObjectInspectorRuleset.cs index d08fc80..34f9646 100644 --- a/PerformanceCalculatorGUI/Screens/ObjectInspection/TaikoObjectInspectorRuleset.cs +++ b/PerformanceCalculatorGUI/Screens/ObjectInspection/TaikoObjectInspectorRuleset.cs @@ -8,12 +8,13 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing; +using osu.Game.Rulesets.Taiko.Edit; using osu.Game.Rulesets.Taiko.UI; using osu.Game.Rulesets.UI; namespace PerformanceCalculatorGUI.Screens.ObjectInspection { - public partial class TaikoObjectInspectorRuleset : DrawableTaikoRuleset + public partial class TaikoObjectInspectorRuleset : DrawableTaikoEditorRuleset { private readonly TaikoDifficultyHitObject[] difficultyHitObjects; @@ -31,6 +32,8 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection public override bool PropagateNonPositionalInputSubTree => false; + public override bool AllowBackwardsSeeks => true; + protected override Playfield CreatePlayfield() => new TaikoObjectInspectorPlayfield(); protected override void Update() From 26bf2b6f9397cd7075c636e29e652e4032f71715 Mon Sep 17 00:00:00 2001 From: StanR Date: Tue, 25 Jun 2024 23:21:26 +0500 Subject: [PATCH 2/3] Update packages, address warnings --- .../Components/StrainVisualizer.cs | 2 +- .../Components/TextBoxes/FileChooserLabelledTextBox.cs | 2 +- .../TextBoxes/LimitedLabelledFractionalNumberBox.cs | 2 +- .../PerformanceCalculatorGUI.csproj | 10 +++++----- .../ObjectDifficultyValuesContainer.cs | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PerformanceCalculatorGUI/Components/StrainVisualizer.cs b/PerformanceCalculatorGUI/Components/StrainVisualizer.cs index 93a2af0..5954fa3 100644 --- a/PerformanceCalculatorGUI/Components/StrainVisualizer.cs +++ b/PerformanceCalculatorGUI/Components/StrainVisualizer.cs @@ -97,7 +97,7 @@ namespace PerformanceCalculatorGUI.Components { graphsContainer.Clear(); - var skills = val.NewValue.Where(x => x is StrainSkill).ToArray(); + var skills = val.NewValue.Where(x => x is StrainSkill or StrainDecaySkill).ToArray(); // dont bother if there are no strain skills to draw if (skills.Length == 0) diff --git a/PerformanceCalculatorGUI/Components/TextBoxes/FileChooserLabelledTextBox.cs b/PerformanceCalculatorGUI/Components/TextBoxes/FileChooserLabelledTextBox.cs index aefe287..c77d0ca 100644 --- a/PerformanceCalculatorGUI/Components/TextBoxes/FileChooserLabelledTextBox.cs +++ b/PerformanceCalculatorGUI/Components/TextBoxes/FileChooserLabelledTextBox.cs @@ -101,7 +101,7 @@ namespace PerformanceCalculatorGUI.Components.TextBoxes OnFocused?.Invoke(); base.OnFocus(e); - GetContainingInputManager().TriggerFocusContention(this); + GetContainingFocusManager()?.TriggerFocusContention(this); } } diff --git a/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs b/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs index 3924203..d5eb260 100644 --- a/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs +++ b/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs @@ -14,7 +14,7 @@ namespace PerformanceCalculatorGUI.Components.TextBoxes { protected override bool AllowIme => false; - protected override bool CanAddCharacter(char character) => character.IsAsciiDigit() || character == CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator[0]; + protected override bool CanAddCharacter(char character) => char.IsAsciiDigit(character) || character == CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator[0]; protected override void OnUserTextAdded(string added) { diff --git a/PerformanceCalculatorGUI/PerformanceCalculatorGUI.csproj b/PerformanceCalculatorGUI/PerformanceCalculatorGUI.csproj index b38b52b..5657446 100644 --- a/PerformanceCalculatorGUI/PerformanceCalculatorGUI.csproj +++ b/PerformanceCalculatorGUI/PerformanceCalculatorGUI.csproj @@ -6,10 +6,10 @@ latest - - - - - + + + + + diff --git a/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs b/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs index 928cfff..065bd8e 100644 --- a/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs +++ b/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs @@ -132,7 +132,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection }); if (hitObject.Angle is not null) - flowContainer.Add(new ObjectInspectorDifficultyValue("Angle", MathUtils.RadiansToDegrees(hitObject.Angle.Value))); + flowContainer.Add(new ObjectInspectorDifficultyValue("Angle", double.RadiansToDegrees(hitObject.Angle.Value))); if (hitObject.BaseObject is Slider) { From 430fe6ef0f2adc2c144a1cd7da43076c81db6542 Mon Sep 17 00:00:00 2001 From: StanR Date: Tue, 25 Jun 2024 23:32:55 +0500 Subject: [PATCH 3/3] usings --- .../Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs | 1 - .../Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs b/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs index d5eb260..f1d4841 100644 --- a/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs +++ b/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs @@ -3,7 +3,6 @@ using System.Globalization; using osu.Framework.Bindables; -using osu.Framework.Extensions; using osu.Game.Graphics.UserInterface; namespace PerformanceCalculatorGUI.Components.TextBoxes diff --git a/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs b/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs index 065bd8e..f14cae6 100644 --- a/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs +++ b/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Utils; using osu.Game.Graphics.Containers; using osu.Game.Overlays; using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;