mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Rename param
This commit is contained in:
parent
ecd25e567d
commit
ed28e8c8f5
@ -315,11 +315,14 @@ namespace osu.Game
|
|||||||
/// The user should have already requested this interactively.
|
/// The user should have already requested this interactively.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmap">The beatmap to select.</param>
|
/// <param name="beatmap">The beatmap to select.</param>
|
||||||
/// <param name="findPredicate">Predicate used to find a difficulty to select</param>
|
/// <param name="difficultyCriteria">
|
||||||
public void PresentBeatmap(BeatmapSetInfo beatmap, Predicate<BeatmapInfo> findPredicate = null)
|
/// Optional predicate used to try and find a difficulty to select.
|
||||||
|
/// If omitted, this will try to present the first beatmap from the current ruleset.
|
||||||
|
/// In case of failure the first difficulty of the set will be presented, ignoring the predicate.
|
||||||
|
/// </param>
|
||||||
|
public void PresentBeatmap(BeatmapSetInfo beatmap, Predicate<BeatmapInfo> difficultyCriteria = null)
|
||||||
{
|
{
|
||||||
// Use this predicate if non was provided. This will try to find some difficulty from current ruleset so we wouldn't have to change rulesets
|
difficultyCriteria ??= b => b.Ruleset.Equals(Ruleset.Value);
|
||||||
findPredicate ??= b => b.Ruleset.Equals(Ruleset.Value);
|
|
||||||
|
|
||||||
var databasedSet = beatmap.OnlineBeatmapSetID != null
|
var databasedSet = beatmap.OnlineBeatmapSetID != null
|
||||||
? BeatmapManager.QueryBeatmapSet(s => s.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID)
|
? BeatmapManager.QueryBeatmapSet(s => s.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID)
|
||||||
@ -338,13 +341,13 @@ namespace osu.Game
|
|||||||
menuScreen.LoadToSolo();
|
menuScreen.LoadToSolo();
|
||||||
|
|
||||||
// we might even already be at the song
|
// we might even already be at the song
|
||||||
if (Beatmap.Value.BeatmapSetInfo.Hash == databasedSet.Hash && findPredicate(Beatmap.Value.BeatmapInfo))
|
if (Beatmap.Value.BeatmapSetInfo.Hash == databasedSet.Hash && difficultyCriteria(Beatmap.Value.BeatmapInfo))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find first beatmap that matches our predicate.
|
// Find first beatmap that matches our predicate.
|
||||||
var first = databasedSet.Beatmaps.Find(findPredicate) ?? databasedSet.Beatmaps.First();
|
var first = databasedSet.Beatmaps.Find(difficultyCriteria) ?? databasedSet.Beatmaps.First();
|
||||||
|
|
||||||
Ruleset.Value = first.Ruleset;
|
Ruleset.Value = first.Ruleset;
|
||||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(first);
|
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(first);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user