mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Move from OsuGameBase to OsuGame
Also moves to a more suitable namespace.
This commit is contained in:
parent
626b7615ad
commit
8cc2ed3fae
@ -9,13 +9,16 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
/// <summary>
|
||||
/// A class which will recommend the most suitable difficulty for the local user from a beatmap set.
|
||||
/// This requires the user to be logged in, as it sources from the user's online profile.
|
||||
/// </summary>
|
||||
public class DifficultyRecommender : Component
|
||||
{
|
||||
[Resolved]
|
@ -80,6 +80,9 @@ namespace osu.Game
|
||||
|
||||
private BeatmapSetOverlay beatmapSetOverlay;
|
||||
|
||||
[Cached]
|
||||
private readonly DifficultyRecommender difficultyRecommender = new DifficultyRecommender();
|
||||
|
||||
[Cached]
|
||||
private readonly ScreenshotManager screenshotManager = new ScreenshotManager();
|
||||
|
||||
@ -374,7 +377,7 @@ namespace osu.Game
|
||||
beatmaps = databasedSet.Beatmaps;
|
||||
|
||||
// Prefer recommended beatmap if recommendations are available, else fallback to a sane selection.
|
||||
var selection = DifficultyRecommender.GetRecommendedBeatmap(beatmaps)
|
||||
var selection = difficultyRecommender.GetRecommendedBeatmap(beatmaps)
|
||||
?? beatmaps.FirstOrDefault(b => b.Ruleset.Equals(Ruleset.Value))
|
||||
?? beatmaps.First();
|
||||
|
||||
@ -639,6 +642,8 @@ namespace osu.Game
|
||||
GetStableStorage = GetStorageForStableInstall
|
||||
}, Add, true);
|
||||
|
||||
loadComponentSingleFile(difficultyRecommender, Add);
|
||||
|
||||
loadComponentSingleFile(screenshotManager, Add);
|
||||
|
||||
// dependency on notification overlay, dependent by settings overlay
|
||||
|
@ -36,7 +36,6 @@ using osu.Game.Resources;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Input;
|
||||
using RuntimeInfo = osu.Framework.RuntimeInfo;
|
||||
@ -99,9 +98,6 @@ namespace osu.Game
|
||||
[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>
|
||||
@ -306,8 +302,6 @@ namespace osu.Game
|
||||
AddInternal(MusicController = new MusicController());
|
||||
dependencies.CacheAs(MusicController);
|
||||
|
||||
Add(DifficultyRecommender);
|
||||
|
||||
Ruleset.BindValueChanged(onRulesetChanged);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user