1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 22:06:08 +08:00

Move and rename some fields for better readability

This commit is contained in:
Dean Herbert 2020-12-22 14:23:33 +09:00
parent dff865f335
commit 626b7615ad
2 changed files with 11 additions and 8 deletions

View File

@ -99,6 +99,9 @@ namespace osu.Game
[Cached(typeof(IBindable<IReadOnlyList<Mod>>))] [Cached(typeof(IBindable<IReadOnlyList<Mod>>))]
protected readonly Bindable<IReadOnlyList<Mod>> SelectedMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>()); protected readonly Bindable<IReadOnlyList<Mod>> SelectedMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
[Cached]
protected readonly DifficultyRecommender DifficultyRecommender = new DifficultyRecommender();
/// <summary> /// <summary>
/// Mods available for the current <see cref="Ruleset"/>. /// Mods available for the current <see cref="Ruleset"/>.
/// </summary> /// </summary>
@ -117,9 +120,6 @@ namespace osu.Game
public bool IsDeployedBuild => AssemblyVersion.Major > 0; public bool IsDeployedBuild => AssemblyVersion.Major > 0;
[Cached]
protected readonly DifficultyRecommender DifficultyRecommender = new DifficultyRecommender();
public virtual string Version public virtual string Version
{ {
get get

View File

@ -27,7 +27,10 @@ namespace osu.Game.Screens.Select
[Resolved] [Resolved]
private Bindable<RulesetInfo> ruleset { get; set; } private Bindable<RulesetInfo> ruleset { get; set; }
private int storedUserId; /// <summary>
/// The user for which the last requests were run.
/// </summary>
private int? requestedUserId;
private readonly Dictionary<RulesetInfo, double> recommendedStarDifficulty = new Dictionary<RulesetInfo, double>(); private readonly Dictionary<RulesetInfo, double> recommendedStarDifficulty = new Dictionary<RulesetInfo, double>();
@ -73,12 +76,12 @@ namespace osu.Game.Screens.Select
return beatmap; return beatmap;
} }
private void calculateRecommendedDifficulties() private void fetchRecommendedValues()
{ {
if (recommendedStarDifficulty.Any() && api.LocalUser.Value.Id == storedUserId) if (recommendedStarDifficulty.Count > 0 && api.LocalUser.Value.Id == requestedUserId)
return; return;
storedUserId = api.LocalUser.Value.Id; requestedUserId = api.LocalUser.Value.Id;
// only query API for built-in rulesets // only query API for built-in rulesets
rulesets.AvailableRulesets.Where(ruleset => ruleset.ID <= ILegacyRuleset.MAX_LEGACY_RULESET_ID).ForEach(rulesetInfo => rulesets.AvailableRulesets.Where(ruleset => ruleset.ID <= ILegacyRuleset.MAX_LEGACY_RULESET_ID).ForEach(rulesetInfo =>
@ -125,7 +128,7 @@ namespace osu.Game.Screens.Select
switch (state.NewValue) switch (state.NewValue)
{ {
case APIState.Online: case APIState.Online:
calculateRecommendedDifficulties(); fetchRecommendedValues();
break; break;
} }
}); });