mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 19:27:26 +08:00
Make DefaultBeatmap private get.
This commit is contained in:
parent
c8593a38c8
commit
35157ca6b8
@ -31,7 +31,7 @@ namespace osu.Game.Database
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A default representation of a WorkingBeatmap to use when no beatmap is available.
|
/// A default representation of a WorkingBeatmap to use when no beatmap is available.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WorkingBeatmap DefaultBeatmap { get; set; }
|
public WorkingBeatmap DefaultBeatmap { private get; set; }
|
||||||
|
|
||||||
public BeatmapDatabase(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) : base(storage, connection)
|
public BeatmapDatabase(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) : base(storage, connection)
|
||||||
{
|
{
|
||||||
@ -273,7 +273,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
|
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
|
||||||
{
|
{
|
||||||
if (beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
||||||
return DefaultBeatmap;
|
return DefaultBeatmap;
|
||||||
|
|
||||||
if (beatmapInfo.BeatmapSet == null || beatmapInfo.Ruleset == null)
|
if (beatmapInfo.BeatmapSet == null || beatmapInfo.Ruleset == null)
|
||||||
|
@ -137,7 +137,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
selectedGroup = null;
|
selectedGroup = null;
|
||||||
selectedPanel = null;
|
selectedPanel = null;
|
||||||
SelectionChanged?.Invoke(database.DefaultBeatmap.BeatmapInfo);
|
SelectionChanged?.Invoke(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,14 +218,29 @@ namespace osu.Game.Screens.Select
|
|||||||
/// selection has been changed as the result of interaction with the carousel.
|
/// selection has been changed as the result of interaction with the carousel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void carouselSelectionChanged(BeatmapInfo beatmap)
|
private void carouselSelectionChanged(BeatmapInfo beatmap)
|
||||||
|
{
|
||||||
|
Action performLoad = delegate
|
||||||
|
{
|
||||||
|
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
|
||||||
|
|
||||||
|
Beatmap.Value = database.GetWorkingBeatmap(beatmap, Beatmap);
|
||||||
|
|
||||||
|
ensurePlayingSelected(preview);
|
||||||
|
changeBackground(Beatmap.Value);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (beatmap == null)
|
||||||
|
{
|
||||||
|
if (!Beatmap.IsDefault)
|
||||||
|
performLoad();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
selectionChangedDebounce?.Cancel();
|
selectionChangedDebounce?.Cancel();
|
||||||
|
|
||||||
if (beatmap.Equals(beatmapNoDebounce))
|
if (beatmap.Equals(beatmapNoDebounce))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool preview = beatmap.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
|
|
||||||
|
|
||||||
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
|
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
|
||||||
sampleChangeDifficulty.Play();
|
sampleChangeDifficulty.Play();
|
||||||
else
|
else
|
||||||
@ -233,18 +248,12 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
beatmapNoDebounce = beatmap;
|
beatmapNoDebounce = beatmap;
|
||||||
|
|
||||||
Action performLoad = delegate
|
|
||||||
{
|
|
||||||
Beatmap.Value = database.GetWorkingBeatmap(beatmap, Beatmap);
|
|
||||||
ensurePlayingSelected(preview);
|
|
||||||
changeBackground(Beatmap.Value);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (beatmap == Beatmap.Value.BeatmapInfo)
|
if (beatmap == Beatmap.Value.BeatmapInfo)
|
||||||
performLoad();
|
performLoad();
|
||||||
else
|
else
|
||||||
selectionChangedDebounce = Scheduler.AddDelayed(performLoad, 100);
|
selectionChangedDebounce = Scheduler.AddDelayed(performLoad, 100);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void triggerRandom(UserInputManager input)
|
private void triggerRandom(UserInputManager input)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user