mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Remove current ruleset from function call
This commit is contained in:
@ -588,7 +588,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
BeatmapInfo recommender(IEnumerable<BeatmapInfo> beatmaps)
|
BeatmapInfo recommender(IEnumerable<BeatmapInfo> beatmaps)
|
||||||
{
|
{
|
||||||
return DifficultyRecommender?.GetRecommendedBeatmap(beatmaps, decoupledRuleset.Value);
|
return DifficultyRecommender?.GetRecommendedBeatmap(beatmaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
var set = new CarouselBeatmapSet(beatmapSet, recommender);
|
var set = new CarouselBeatmapSet(beatmapSet, recommender);
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -22,6 +23,9 @@ namespace osu.Game.Screens.Select
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Bindable<RulesetInfo> ruleset { get; set; }
|
||||||
|
|
||||||
private readonly Dictionary<RulesetInfo, double> recommendedStarDifficulty = new Dictionary<RulesetInfo, double>();
|
private readonly Dictionary<RulesetInfo, double> recommendedStarDifficulty = new Dictionary<RulesetInfo, double>();
|
||||||
|
|
||||||
private int pendingAPIRequests;
|
private int pendingAPIRequests;
|
||||||
@ -57,9 +61,9 @@ namespace osu.Game.Screens.Select
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapInfo GetRecommendedBeatmap(IEnumerable<BeatmapInfo> beatmaps, RulesetInfo currentRuleset)
|
public BeatmapInfo GetRecommendedBeatmap(IEnumerable<BeatmapInfo> beatmaps)
|
||||||
{
|
{
|
||||||
if (!recommendedStarDifficulty.ContainsKey(currentRuleset))
|
if (!recommendedStarDifficulty.ContainsKey(ruleset.Value))
|
||||||
{
|
{
|
||||||
updateRecommended();
|
updateRecommended();
|
||||||
return null;
|
return null;
|
||||||
@ -67,7 +71,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
return beatmaps.OrderBy(b =>
|
return beatmaps.OrderBy(b =>
|
||||||
{
|
{
|
||||||
var difference = b.StarDifficulty - recommendedStarDifficulty[currentRuleset];
|
var difference = b.StarDifficulty - recommendedStarDifficulty[ruleset.Value];
|
||||||
return difference >= 0 ? difference * 2 : difference * -1; // prefer easier over harder
|
return difference >= 0 ? difference * 2 : difference * -1; // prefer easier over harder
|
||||||
}).FirstOrDefault();
|
}).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user