mirror of https://github.com/ppy/osu
Move and rename some fields for better readability
This commit is contained in:
parent
dff865f335
commit
626b7615ad
|
@ -99,6 +99,9 @@ public class OsuGameBase : Framework.Game, ICanAcceptFiles
|
|||
[Cached(typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||
protected readonly Bindable<IReadOnlyList<Mod>> SelectedMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||
|
||||
[Cached]
|
||||
protected readonly DifficultyRecommender DifficultyRecommender = new DifficultyRecommender();
|
||||
|
||||
/// <summary>
|
||||
/// Mods available for the current <see cref="Ruleset"/>.
|
||||
/// </summary>
|
||||
|
@ -117,9 +120,6 @@ public class OsuGameBase : Framework.Game, ICanAcceptFiles
|
|||
|
||||
public bool IsDeployedBuild => AssemblyVersion.Major > 0;
|
||||
|
||||
[Cached]
|
||||
protected readonly DifficultyRecommender DifficultyRecommender = new DifficultyRecommender();
|
||||
|
||||
public virtual string Version
|
||||
{
|
||||
get
|
||||
|
|
|
@ -27,7 +27,10 @@ public class DifficultyRecommender : Component
|
|||
[Resolved]
|
||||
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>();
|
||||
|
||||
|
@ -73,12 +76,12 @@ public BeatmapInfo GetRecommendedBeatmap(IEnumerable<BeatmapInfo> beatmaps)
|
|||
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;
|
||||
|
||||
storedUserId = api.LocalUser.Value.Id;
|
||||
requestedUserId = api.LocalUser.Value.Id;
|
||||
|
||||
// only query API for built-in rulesets
|
||||
rulesets.AvailableRulesets.Where(ruleset => ruleset.ID <= ILegacyRuleset.MAX_LEGACY_RULESET_ID).ForEach(rulesetInfo =>
|
||||
|
@ -125,7 +128,7 @@ private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule((
|
|||
switch (state.NewValue)
|
||||
{
|
||||
case APIState.Online:
|
||||
calculateRecommendedDifficulties();
|
||||
fetchRecommendedValues();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue