mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 16:43:52 +09:00
Move from OsuGameBase to OsuGame
Also moves to a more suitable namespace.
This commit is contained in:
@ -9,13 +9,16 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
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.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Rulesets;
|
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
|
public class DifficultyRecommender : Component
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
@ -80,6 +80,9 @@ namespace osu.Game
|
|||||||
|
|
||||||
private BeatmapSetOverlay beatmapSetOverlay;
|
private BeatmapSetOverlay beatmapSetOverlay;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private readonly DifficultyRecommender difficultyRecommender = new DifficultyRecommender();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private readonly ScreenshotManager screenshotManager = new ScreenshotManager();
|
private readonly ScreenshotManager screenshotManager = new ScreenshotManager();
|
||||||
|
|
||||||
@ -374,7 +377,7 @@ namespace osu.Game
|
|||||||
beatmaps = databasedSet.Beatmaps;
|
beatmaps = databasedSet.Beatmaps;
|
||||||
|
|
||||||
// Prefer recommended beatmap if recommendations are available, else fallback to a sane selection.
|
// 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.FirstOrDefault(b => b.Ruleset.Equals(Ruleset.Value))
|
||||||
?? beatmaps.First();
|
?? beatmaps.First();
|
||||||
|
|
||||||
@ -639,6 +642,8 @@ namespace osu.Game
|
|||||||
GetStableStorage = GetStorageForStableInstall
|
GetStableStorage = GetStorageForStableInstall
|
||||||
}, Add, true);
|
}, Add, true);
|
||||||
|
|
||||||
|
loadComponentSingleFile(difficultyRecommender, Add);
|
||||||
|
|
||||||
loadComponentSingleFile(screenshotManager, Add);
|
loadComponentSingleFile(screenshotManager, Add);
|
||||||
|
|
||||||
// dependency on notification overlay, dependent by settings overlay
|
// dependency on notification overlay, dependent by settings overlay
|
||||||
|
@ -36,7 +36,6 @@ using osu.Game.Resources;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Select;
|
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
using RuntimeInfo = osu.Framework.RuntimeInfo;
|
using RuntimeInfo = osu.Framework.RuntimeInfo;
|
||||||
@ -99,9 +98,6 @@ 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>
|
||||||
@ -306,8 +302,6 @@ namespace osu.Game
|
|||||||
AddInternal(MusicController = new MusicController());
|
AddInternal(MusicController = new MusicController());
|
||||||
dependencies.CacheAs(MusicController);
|
dependencies.CacheAs(MusicController);
|
||||||
|
|
||||||
Add(DifficultyRecommender);
|
|
||||||
|
|
||||||
Ruleset.BindValueChanged(onRulesetChanged);
|
Ruleset.BindValueChanged(onRulesetChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user