Merge branch 'master' into previewtime-seeking

This commit is contained in:
Dean Herbert 2017-07-21 15:06:18 +09:00 committed by GitHub
commit 6bdf6bb675
8 changed files with 33 additions and 28 deletions

View File

@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Beatmaps
public class TestWorkingBeatmap : WorkingBeatmap
{
public TestWorkingBeatmap(Beatmap beatmap)
: base(beatmap.BeatmapInfo, true)
: base(beatmap.BeatmapInfo)
{
this.beatmap = beatmap;
}

View File

@ -22,17 +22,11 @@ namespace osu.Game.Beatmaps
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
/// <summary>
/// Denotes whether extras like storyboards have been loaded for this <see cref="WorkingBeatmap"/>.
/// </summary>
public bool FullyLoaded { get; protected set; }
protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool fullyLoaded = false)
protected WorkingBeatmap(BeatmapInfo beatmapInfo)
{
BeatmapInfo = beatmapInfo;
BeatmapSetInfo = beatmapInfo.BeatmapSet;
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
FullyLoaded = fullyLoaded;
Mods.ValueChanged += mods => applyRateAdjustments();
}

View File

@ -291,7 +291,7 @@ namespace osu.Game.Database
if (beatmapInfo.Metadata == null)
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo, withStoryboard);
WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo);
previous?.TransferTo(working);

View File

@ -14,8 +14,8 @@ namespace osu.Game.Database
{
private readonly BeatmapDatabase database;
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool fullyLoaded = false)
: base(beatmapInfo, fullyLoaded)
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo)
: base(beatmapInfo)
{
this.database = database;
}
@ -37,7 +37,7 @@ namespace osu.Game.Database
beatmap = decoder.Decode(stream);
}
if (beatmap == null || !FullyLoaded || BeatmapSetInfo.StoryboardFile == null)
if (beatmap == null || BeatmapSetInfo.StoryboardFile == null)
return beatmap;
using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))

View File

@ -70,7 +70,7 @@ namespace osu.Game.Screens.Play
private bool loadedSuccessfully => HitRenderer?.Objects.Any() == true;
[BackgroundDependencyLoader(permitNulls: true)]
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu)
private void load(AudioManager audio, OsuConfigManager config, OsuGame osu)
{
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
@ -81,10 +81,6 @@ namespace osu.Game.Screens.Play
try
{
if (!Beatmap.Value.FullyLoaded)
// we need to ensure extras like storyboards are loaded.
Beatmap.Value = beatmaps.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo, withStoryboard: true);
if (Beatmap.Value.Beatmap == null)
throw new InvalidOperationException("Beatmap was not loaded");

View File

@ -25,6 +25,8 @@ namespace osu.Game.Screens.Select
{
public BeatmapInfo SelectedBeatmap => selectedPanel?.Beatmap;
public override bool HandleInput => AllowSelection;
public Action BeatmapsChanged;
public IEnumerable<BeatmapSetInfo> Beatmaps
@ -133,7 +135,7 @@ namespace osu.Game.Screens.Select
public void SelectNext(int direction = 1, bool skipDifficulties = true)
{
if (groups.Count == 0)
if (groups.All(g => g.State == BeatmapGroupState.Hidden))
{
selectedGroup = null;
selectedPanel = null;
@ -228,6 +230,8 @@ namespace osu.Game.Screens.Select
private ScheduledDelegate filterTask;
public bool AllowSelection = true;
public void Filter(FilterCriteria newCriteria = null, bool debounce = true)
{
if (newCriteria != null)

View File

@ -105,6 +105,7 @@ namespace osu.Game.Screens.Select
if (player != null) return;
Beatmap.Value.Track.Looping = false;
Beatmap.Disabled = true;
LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player));
}

View File

@ -109,7 +109,7 @@ namespace osu.Game.Screens.Select
Origin = Anchor.CentreRight,
SelectionChanged = carouselSelectionChanged,
BeatmapsChanged = carouselBeatmapsLoaded,
StartRequested = carouselRaisedStart
StartRequested = carouselRaisedStart,
});
Add(FilterControl = new FilterControl
{
@ -183,6 +183,9 @@ namespace osu.Game.Screens.Select
carousel.Beatmaps = database.GetAllWithChildren<BeatmapSetInfo>(b => !b.DeletePending);
Beatmap.ValueChanged += beatmap_ValueChanged;
Beatmap.DisabledChanged += disabled => carousel.AllowSelection = !disabled;
carousel.AllowSelection = !Beatmap.Disabled;
}
private void carouselBeatmapsLoaded()
@ -219,14 +222,26 @@ namespace osu.Game.Screens.Select
{
Action performLoad = delegate
{
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
// We may be arriving here due to another component changing the bindable Beatmap.
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true)
{
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
Beatmap.Value = database.GetWorkingBeatmap(beatmap, Beatmap);
Beatmap.Value = database.GetWorkingBeatmap(beatmap, Beatmap);
ensurePlayingSelected(preview);
}
ensurePlayingSelected(preview);
changeBackground(Beatmap.Value);
};
selectionChangedDebounce?.Cancel();
if (beatmap?.Equals(beatmapNoDebounce) == true)
return;
beatmapNoDebounce = beatmap;
if (beatmap == null)
{
if (!Beatmap.IsDefault)
@ -234,18 +249,13 @@ namespace osu.Game.Screens.Select
}
else
{
selectionChangedDebounce?.Cancel();
if (beatmap.Equals(beatmapNoDebounce))
return;
ruleset.Value = beatmap.Ruleset;
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
sampleChangeDifficulty.Play();
else
sampleChangeBeatmap.Play();
beatmapNoDebounce = beatmap;
if (beatmap == Beatmap.Value.BeatmapInfo)
performLoad();
else