From 4821938682172d2043aae38f5222934c9bd9f750 Mon Sep 17 00:00:00 2001 From: minisbett <39670899+minisbett@users.noreply.github.com> Date: Sun, 13 Oct 2024 12:32:06 +0200 Subject: [PATCH 1/3] Fix duplicate diff & pp calculation when changing mods --- PerformanceCalculatorGUI/Screens/SimulateScreen.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs index 2d70fc141..92d413439 100644 --- a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs +++ b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs @@ -511,6 +511,11 @@ protected override void Dispose(bool isDisposing) private void modsChanged(ValueChangedEvent> mods) { + // Hotfix for preventing a difficulty and performance calculation from being trigger twice, + // as the mod overlay for some reason triggers a ValueChanged twice per mod change. + if (mods.OldValue.Count == mods.NewValue.Count) + return; + modSettingChangeTracker?.Dispose(); if (working is null) From 1b846382ae8979d83e53b2c93cb7f0b31b799c08 Mon Sep 17 00:00:00 2001 From: minisbett <39670899+minisbett@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:41:16 +0200 Subject: [PATCH 2/3] replace Count check with SequenceEqual --- PerformanceCalculatorGUI/Screens/SimulateScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs index 92d413439..8eb44e508 100644 --- a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs +++ b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs @@ -513,7 +513,7 @@ private void modsChanged(ValueChangedEvent> mods) { // Hotfix for preventing a difficulty and performance calculation from being trigger twice, // as the mod overlay for some reason triggers a ValueChanged twice per mod change. - if (mods.OldValue.Count == mods.NewValue.Count) + if (mods.OldValue.SequenceEqual(mods.NewValue)) return; modSettingChangeTracker?.Dispose(); From ca6ede434e64a34ca96c707f70321361e85cbdc6 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 23 Oct 2024 15:24:58 +0900 Subject: [PATCH 3/3] Move nested function to end of parent --- .../Screens/SimulateScreen.cs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs index d254c1803..166e3be57 100644 --- a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs +++ b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs @@ -529,24 +529,6 @@ private void modsChanged(ValueChangedEvent> mods) if (mods.OldValue.SequenceEqual(mods.NewValue)) return; - void updateMissesTextboxes() - { - if (ruleset.Value.ShortName == "osu") - { - // Large tick misses and slider tail misses are only relevant in PP if slider head accuracy exists - if (mods.NewValue.OfType().Any(m => m.NoSliderHeadAccuracy.Value)) - { - missesContainer.Content = new[] { new[] { missesTextBox } }; - missesContainer.ColumnDimensions = [new Dimension()]; - } - else - { - missesContainer.Content = new[] { new[] { missesTextBox, largeTickMissesTextBox, sliderTailMissesTextBox } }; - missesContainer.ColumnDimensions = [new Dimension(), new Dimension(), new Dimension()]; - } - } - } - modSettingChangeTracker?.Dispose(); if (working is null) @@ -569,6 +551,24 @@ void updateMissesTextboxes() calculateDifficulty(); updateCombo(false); calculatePerformance(); + + void updateMissesTextboxes() + { + if (ruleset.Value.ShortName == "osu") + { + // Large tick misses and slider tail misses are only relevant in PP if slider head accuracy exists + if (mods.NewValue.OfType().Any(m => m.NoSliderHeadAccuracy.Value)) + { + missesContainer.Content = new[] { new[] { missesTextBox } }; + missesContainer.ColumnDimensions = [new Dimension()]; + } + else + { + missesContainer.Content = new[] { new[] { missesTextBox, largeTickMissesTextBox, sliderTailMissesTextBox } }; + missesContainer.ColumnDimensions = [new Dimension(), new Dimension(), new Dimension()]; + } + } + } } private void resetBeatmap()