Skip to content

Commit 067ec1c

Browse files
authored
Merge pull request #2334 from andy840119/update-package-to-latest-one
Update package to latest one.
2 parents 68a1793 + 84e2b69 commit 067ec1c

File tree

8 files changed

+69
-21
lines changed

8 files changed

+69
-21
lines changed

osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapProperty.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ public IEnumerable<Issue> Run(BeatmapVerifierContext context)
2929
return Array.Empty<Issue>();
3030

3131
var issues = CheckProperty(property);
32-
var hitObjectIssues = context.Beatmap.HitObjects.OfType<THitObject>().SelectMany(x => CheckHitObject(property, x));
33-
var hitObjectsIssues = CheckHitObjects(property, context.Beatmap.HitObjects.OfType<THitObject>().ToList());
32+
var hitObjects = context.CurrentDifficulty.Playable.HitObjects;
33+
34+
var hitObjectIssues = hitObjects.OfType<THitObject>().SelectMany(x => CheckHitObject(property, x));
35+
var hitObjectsIssues = CheckHitObjects(property, hitObjects.OfType<THitObject>().ToList());
3436

3537
return issues.Concat(hitObjectIssues).Concat(hitObjectsIssues);
3638
}
@@ -55,7 +57,7 @@ protected virtual IEnumerable<Issue> CheckHitObjects(TProperty property, IReadOn
5557
private static KaraokeBeatmap getBeatmap(BeatmapVerifierContext context)
5658
{
5759
// follow the usage in the IssueList in osu.Game
58-
if (context.Beatmap is EditorBeatmap editorBeatmap)
60+
if (context.CurrentDifficulty.Playable is EditorBeatmap editorBeatmap)
5961
return EditorBeatmapUtils.GetPlayableBeatmap(editorBeatmap);
6062

6163
throw new InvalidOperationException();

osu.Game.Rulesets.Karaoke/Edit/Checks/CheckHitObjectProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public abstract class CheckHitObjectProperty<THitObject> : ICheck where THitObje
1919

2020
public virtual IEnumerable<Issue> Run(BeatmapVerifierContext context)
2121
{
22-
var hitObjects = context.Beatmap.HitObjects.OfType<THitObject>();
22+
var hitObjects = context.CurrentDifficulty.Playable.HitObjects.OfType<THitObject>();
2323

2424
return hitObjects.Select(Check).SelectMany(x => x);
2525
}

osu.Game.Rulesets.Karaoke/Edit/Checks/CheckHitObjectReferenceProperty.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public abstract class CheckHitObjectReferenceProperty<THitObject, TReferencedHit
1515
{
1616
public override IEnumerable<Issue> Run(BeatmapVerifierContext context)
1717
{
18-
var hitObjects = context.Beatmap.HitObjects.OfType<THitObject>();
19-
var allAvailableReferencedHitObjects = context.Beatmap.HitObjects.OfType<TReferencedHitObject>().ToArray();
18+
var hitObjects = context.CurrentDifficulty.Playable.HitObjects.OfType<THitObject>();
19+
var allAvailableReferencedHitObjects = context.CurrentDifficulty.Playable.HitObjects.OfType<TReferencedHitObject>().ToArray();
2020

2121
var issues = base.Run(context);
2222
var referenceIssues = hitObjects.Select(x => CheckReferenceProperty(x, allAvailableReferencedHitObjects)).SelectMany(x => x);

osu.Game.Rulesets.Karaoke/Edit/Checks/CheckStageInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public IEnumerable<Issue> Run(BeatmapVerifierContext context)
9090
if (property == null)
9191
return Array.Empty<Issue>();
9292

93-
var hitObjects = context.Beatmap.HitObjects.OfType<KaraokeHitObject>().ToList();
93+
var hitObjects = context.CurrentDifficulty.Playable.HitObjects.OfType<KaraokeHitObject>().ToList();
9494
var issues = CheckStageInfoWithHitObjects(property, hitObjects).ToList();
9595

9696
foreach (var stageInfoCategoryAction in stageInfoCategoryActions)
Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
// Copyright (c) andy840119 <andy840119@gmail.com>. Licensed under the GPL Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

4+
using System;
5+
using osu.Game.Beatmaps;
46
using osu.Game.Rulesets.Scoring;
57

68
namespace osu.Game.Rulesets.Karaoke.Scoring;
79

810
public class KaraokeLyricHitWindows : KaraokeHitWindows
911
{
10-
private static readonly DifficultyRange[] lyric_ranges =
11-
{
12-
new(HitResult.Perfect, 40, 20, 10),
13-
};
12+
private static readonly DifficultyRange perfect_window_range = new(40D, 20D, 10D);
13+
14+
private double perfect;
1415

1516
public override bool IsHitResultAllowed(HitResult result) =>
1617
result switch
@@ -21,5 +22,24 @@ public override bool IsHitResultAllowed(HitResult result) =>
2122
_ => false,
2223
};
2324

24-
protected override DifficultyRange[] GetRanges() => lyric_ranges;
25+
public override void SetDifficulty(double difficulty)
26+
{
27+
perfect = IBeatmapDifficultyInfo.DifficultyRange(difficulty, perfect_window_range) ;
28+
}
29+
30+
public override double WindowFor(HitResult result)
31+
{
32+
switch (result)
33+
{
34+
case HitResult.Perfect:
35+
return perfect;
36+
37+
// todo: add this in order not to throw error in some test cases.
38+
case HitResult.Miss:
39+
return 1000;
40+
41+
default:
42+
throw new ArgumentOutOfRangeException(nameof(result), result, null);
43+
}
44+
}
2545
}
Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
// Copyright (c) andy840119 <andy840119@gmail.com>. Licensed under the GPL Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

4+
using System;
5+
using osu.Game.Beatmaps;
46
using osu.Game.Rulesets.Scoring;
57

68
namespace osu.Game.Rulesets.Karaoke.Scoring;
79

810
public class KaraokeNoteHitWindows : KaraokeHitWindows
911
{
10-
private static readonly DifficultyRange[] karaoke_ranges =
11-
{
12-
new(HitResult.Perfect, 80, 50, 20),
13-
new(HitResult.Meh, 80, 50, 20),
14-
new(HitResult.Miss, 2000, 1500, 1000),
15-
};
12+
private static readonly DifficultyRange perfect_window_range = new(80D, 50D, 20D);
13+
private static readonly DifficultyRange meh_window_range = new(80D, 50D, 20D);
14+
private static readonly DifficultyRange miss_window_range = new(2000D, 1500D, 1000D);
15+
16+
private double perfect;
17+
private double meh;
18+
private double miss;
1619

1720
public override bool IsHitResultAllowed(HitResult result) =>
1821
result switch
@@ -23,5 +26,28 @@ public override bool IsHitResultAllowed(HitResult result) =>
2326
_ => false,
2427
};
2528

26-
protected override DifficultyRange[] GetRanges() => karaoke_ranges;
29+
public override void SetDifficulty(double difficulty)
30+
{
31+
perfect = IBeatmapDifficultyInfo.DifficultyRange(difficulty, perfect_window_range) ;
32+
meh = IBeatmapDifficultyInfo.DifficultyRange(difficulty, meh_window_range);
33+
miss = IBeatmapDifficultyInfo.DifficultyRange(difficulty, miss_window_range);
34+
}
35+
36+
public override double WindowFor(HitResult result)
37+
{
38+
switch (result)
39+
{
40+
case HitResult.Perfect:
41+
return perfect;
42+
43+
case HitResult.Meh:
44+
return meh;
45+
46+
case HitResult.Miss:
47+
return miss;
48+
49+
default:
50+
throw new ArgumentOutOfRangeException(nameof(result), result, null);
51+
}
52+
}
2753
}

osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorVerifier.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private IEnumerable<Issue> getIssueByHitObject(KaraokeHitObject karaokeHitObject
172172
{
173173
return CreateIssues(context =>
174174
{
175-
if (context.Beatmap is not Beatmap<HitObject> beatmap)
175+
if (context.CurrentDifficulty.Playable is not Beatmap<HitObject> beatmap)
176176
throw new InvalidCastException();
177177

178178
beatmap.HitObjects.Add(karaokeHitObject);

osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
</PackageReference>
20-
<PackageReference Include="ppy.osu.Game" Version="2025.618.0" />
20+
<PackageReference Include="ppy.osu.Game" Version="2025.816.0" />
2121
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00016" />
2222
<PackageReference Include="Lucene.Net.Analysis.Kuromoji" Version="4.8.0-beta00016" />
2323
<PackageReference Include="SixLabors.Fonts" Version="2.1.3" />

0 commit comments

Comments
 (0)