Skip to content

Commit 458d4f0

Browse files
committed
feat(ScoreProcessor): Record additional information in score processing and support two-player rendering
Add an ExtraInfo field to StdDevScoreProcessor and FitLevelScoreProcessor for storing standard deviation and fit level during calculation. Modify the Drawer class to support an optional second player parameter, enabling rendering for two-player score comparison.
1 parent c47385a commit 458d4f0

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/Render/Drawer.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ public sealed class Drawer
1111
{
1212
public async Task<Image> DrawBestsAsync(CommonUser user, IReadOnlyList<CommonRecord> ever,
1313
IReadOnlyList<CommonRecord> current, int everTotal, int currentTotal, string? condition, string prober, IEnumerable<string> tags) =>
14-
await DrawBestsAsync(user, ever, current, everTotal, currentTotal, condition, prober, tags, "./Resources/Layouts/bests.xml");
14+
await DrawBestsAsync(user, ever, current, everTotal, currentTotal, condition, prober, tags, null, "./Resources/Layouts/bests.xml");
1515

1616
public async Task<Image> DrawBestsAsync(CommonUser user, IReadOnlyList<CommonRecord> ever,
17-
IReadOnlyList<CommonRecord> current, int everTotal, int currentTotal, string? condition, string prober, IEnumerable<string> tags, string xmlPath)
17+
IReadOnlyList<CommonRecord> current, int everTotal, int currentTotal, string? condition, string prober, IEnumerable<string> tags, CommonUser? user2p) =>
18+
await DrawBestsAsync(user, ever, current, everTotal, currentTotal, condition, prober, tags, user2p, "./Resources/Layouts/bests.xml");
19+
20+
public async Task<Image> DrawBestsAsync(CommonUser user, IReadOnlyList<CommonRecord> ever,
21+
IReadOnlyList<CommonRecord> current, int everTotal, int currentTotal, string? condition, string prober, IEnumerable<string> tags, CommonUser? user2p, string xmlPath)
1822
{
1923
int everMax = ever.Count > 0 ? ever[0].DXRating : 0;
2024
int everMin = ever.Count > 0 ? ever[^1].DXRating : 0;
@@ -32,6 +36,7 @@ public async Task<Image> DrawBestsAsync(CommonUser user, IReadOnlyList<CommonRec
3236
["proberName"] = prober,
3337
["tags"] = tags,
3438
["mayMask"] = mayMask,
39+
["2pUserInfo"] = user2p,
3540
["everMax"] = everMax,
3641
["everMin"] = everMin,
3742
["currentMax"] = currentMax,

src/ScoreProcesser/FitLevelScoreProcesser.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public sealed class FitLevelScoreProcesser : IScoreProcesser
2121
foreach (CommonRecord record in records.SortRecordForBests())
2222
{
2323
double fitLevel = record.Chart.LevelValue;
24-
if (Limekuma.Prober.DivingFish.Models.Status.Shared.ChartStatus.TryGetValue(record.Chart.Song.Id.ToString(), out List<ChartState>? chartState))
24+
if (Prober.DivingFish.Models.Status.Shared.ChartStatus.TryGetValue(record.Chart.Song.Id.ToString(), out List<ChartState>? chartState))
2525
{
2626
fitLevel = chartState[(int)record.Chart.Difficulty - 1].FitLevel;
2727
}
@@ -46,7 +46,8 @@ public sealed class FitLevelScoreProcesser : IScoreProcesser
4646
DXScore = record.DXScore,
4747
DXScoreRank = record.DXScoreRank,
4848
Rank = record.Rank,
49-
SyncFlag = record.SyncFlag
49+
SyncFlag = record.SyncFlag,
50+
ExtraInfo = (float)fitLevel
5051
};
5152

5253
(record.Chart.Song.InCurrentGenre switch

src/ScoreProcesser/StdDevScoreProcesser.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public sealed class StdDevScoreProcesser : IScoreProcesser
2222
fitLevel = chart.FitLevel;
2323
}
2424

25+
x.ExtraInfo = (float)stdDev;
2526
return x.DXRating * (1 + (stdDev / 10)) * (1 + (fitLevel / (fitLevel > 0 ? 10 : 1)));
2627
}).ThenByDescending(x => x.Chart.LevelValue).ThenByDescending(x => x.Achievements))
2728
{

0 commit comments

Comments
 (0)