From a045f9e72f000c045a554963edf3d1b3932e1ee7 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 15 Jun 2022 22:37:05 +0800 Subject: [PATCH 1/2] Update the package to the latest. --- osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index 157dccce8..07eb25d85 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -18,7 +18,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From 56300059e4fa32b9ce66669a57ef7831cbf4b170 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 15 Jun 2022 22:37:22 +0800 Subject: [PATCH 2/2] Fix the api change. --- .../Difficulty/KaraokeDifficultyCalculator.cs | 6 +++++- .../Difficulty/Preprocessing/KaraokeDifficultyHitObject.cs | 5 +++-- osu.Game.Rulesets.Karaoke/Difficulty/Skills/Strain.cs | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyCalculator.cs b/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyCalculator.cs index 1eecb3d75..fb4fe9635 100644 --- a/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyCalculator.cs @@ -54,8 +54,12 @@ protected override IEnumerable CreateDifficultyHitObjects(I // todo : might have a sort. // LegacySortHelper.Sort(sortedObjects, Comparer.Create((a, b) => (int)Math.Round(a.StartTime) - (int)Math.Round(b.StartTime))); + List objects = new List(); + for (int i = 1; i < sortedObjects.Length; i++) - yield return new KaraokeDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate); + objects.Add(new KaraokeDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate, objects, objects.Count)); + + return objects; } // Sorting is done in CreateDifficultyHitObjects, since the full list of hitobjects is required. diff --git a/osu.Game.Rulesets.Karaoke/Difficulty/Preprocessing/KaraokeDifficultyHitObject.cs b/osu.Game.Rulesets.Karaoke/Difficulty/Preprocessing/KaraokeDifficultyHitObject.cs index 02a2435db..b8b9e2806 100644 --- a/osu.Game.Rulesets.Karaoke/Difficulty/Preprocessing/KaraokeDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Karaoke/Difficulty/Preprocessing/KaraokeDifficultyHitObject.cs @@ -1,6 +1,7 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Objects; @@ -11,8 +12,8 @@ public class KaraokeDifficultyHitObject : DifficultyHitObject { public new Note BaseObject => (Note)base.BaseObject; - public KaraokeDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate) - : base(hitObject, lastObject, clockRate) + public KaraokeDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List objects, int index) + : base(hitObject, lastObject, clockRate, objects, index) { } } diff --git a/osu.Game.Rulesets.Karaoke/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Karaoke/Difficulty/Skills/Strain.cs index 3cae281ed..d57ff035c 100644 --- a/osu.Game.Rulesets.Karaoke/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Karaoke/Difficulty/Skills/Strain.cs @@ -75,9 +75,9 @@ protected override double StrainValueOf(DifficultyHitObject current) static int getColumnIndex(Tone tone) => 0; } - protected override double CalculateInitialStrain(double time) - => applyDecay(individualStrain, time - Previous[0].StartTime, individual_decay_base) - + applyDecay(overallStrain, time - Previous[0].StartTime, overall_decay_base); + protected override double CalculateInitialStrain(double offset, DifficultyHitObject current) + => applyDecay(individualStrain, offset - current.Previous(0).StartTime, individual_decay_base) + + applyDecay(overallStrain, offset - current.Previous(0).StartTime, overall_decay_base); private double applyDecay(double value, double deltaTime, double decayBase) => value * Math.Pow(decayBase, deltaTime / 1000);