mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 15:12:57 +08:00
Merge remote-tracking branch 'origin/master' into mania-notes
This commit is contained in:
commit
94585672b6
@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Beatmaps
|
|||||||
public class TestWorkingBeatmap : WorkingBeatmap
|
public class TestWorkingBeatmap : WorkingBeatmap
|
||||||
{
|
{
|
||||||
public TestWorkingBeatmap(Beatmap beatmap)
|
public TestWorkingBeatmap(Beatmap beatmap)
|
||||||
: base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet)
|
: base(beatmap.BeatmapInfo)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
}
|
}
|
||||||
|
@ -135,15 +135,14 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
waitAction = () =>
|
waitAction = () =>
|
||||||
{
|
{
|
||||||
while ((resultBeatmaps = host.Dependencies.Get<BeatmapDatabase>()
|
while ((resultBeatmaps = host.Dependencies.Get<BeatmapDatabase>()
|
||||||
.Query<BeatmapInfo>().Where(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
|
.GetAllWithChildren<BeatmapInfo>(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
|
||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
|
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
|
||||||
@"Beatmaps did not import to the database in allocated time");
|
@"Beatmaps did not import to the database in allocated time");
|
||||||
|
|
||||||
//fetch children and check we can load from the post-storage path...
|
var set = host.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First(), true);
|
||||||
var set = host.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First());
|
|
||||||
|
|
||||||
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(),
|
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(),
|
||||||
$@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count}).");
|
$@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count}).");
|
||||||
|
@ -51,14 +51,12 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
title = new OsuSpriteText
|
title = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-BoldItalic",
|
Font = @"Exo2.0-BoldItalic",
|
||||||
Text = beatmap.BeatmapSetInfo.Metadata.Title,
|
|
||||||
TextSize = 22,
|
TextSize = 22,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
artist = new OsuSpriteText
|
artist = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-SemiBoldItalic",
|
Font = @"Exo2.0-SemiBoldItalic",
|
||||||
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
|
|
||||||
TextSize = 17,
|
TextSize = 17,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
@ -81,8 +79,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LocalisationEngine localisation)
|
private void load(LocalisationEngine localisation)
|
||||||
{
|
{
|
||||||
title.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.TitleUnicode, beatmap.BeatmapSetInfo.Metadata.Title);
|
title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
|
||||||
artist.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.ArtistUnicode, beatmap.BeatmapSetInfo.Metadata.Artist);
|
artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PanelBackground : BufferedContainer
|
private class PanelBackground : BufferedContainer
|
||||||
|
@ -18,14 +18,17 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public readonly BeatmapSetInfo BeatmapSetInfo;
|
public readonly BeatmapSetInfo BeatmapSetInfo;
|
||||||
|
|
||||||
|
public readonly BeatmapMetadata Metadata;
|
||||||
|
|
||||||
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
||||||
|
|
||||||
public readonly bool WithStoryboard;
|
public readonly bool WithStoryboard;
|
||||||
|
|
||||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, bool withStoryboard = false)
|
protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool withStoryboard = false)
|
||||||
{
|
{
|
||||||
BeatmapInfo = beatmapInfo;
|
BeatmapInfo = beatmapInfo;
|
||||||
BeatmapSetInfo = beatmapSetInfo;
|
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
||||||
|
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
|
||||||
WithStoryboard = withStoryboard;
|
WithStoryboard = withStoryboard;
|
||||||
|
|
||||||
Mods.ValueChanged += mods => applyRateAdjustments();
|
Mods.ValueChanged += mods => applyRateAdjustments();
|
||||||
|
@ -36,14 +36,12 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
private void deletePending()
|
private void deletePending()
|
||||||
{
|
{
|
||||||
foreach (var b in Query<BeatmapSetInfo>().Where(b => b.DeletePending))
|
foreach (var b in GetAllWithChildren<BeatmapSetInfo>(b => b.DeletePending))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Storage.Delete(b.Path);
|
Storage.Delete(b.Path);
|
||||||
|
|
||||||
GetChildren(b, true);
|
|
||||||
|
|
||||||
foreach (var i in b.Beatmaps)
|
foreach (var i in b.Beatmaps)
|
||||||
{
|
{
|
||||||
if (i.Metadata != null) Connection.Delete(i.Metadata);
|
if (i.Metadata != null) Connection.Delete(i.Metadata);
|
||||||
@ -269,20 +267,13 @@ 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)
|
||||||
{
|
{
|
||||||
var beatmapSetInfo = Query<BeatmapSetInfo>().FirstOrDefault(s => s.ID == beatmapInfo.BeatmapSetInfoID);
|
if (beatmapInfo.BeatmapSet == null)
|
||||||
|
|
||||||
if (beatmapSetInfo == null)
|
|
||||||
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
|
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
|
||||||
|
|
||||||
//we need metadata
|
|
||||||
GetChildren(beatmapSetInfo);
|
|
||||||
//we also need a ruleset
|
|
||||||
GetChildren(beatmapInfo);
|
|
||||||
|
|
||||||
if (beatmapInfo.Metadata == null)
|
if (beatmapInfo.Metadata == null)
|
||||||
beatmapInfo.Metadata = beatmapSetInfo.Metadata;
|
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
|
||||||
|
|
||||||
WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo, beatmapSetInfo, withStoryboard);
|
WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo, withStoryboard);
|
||||||
|
|
||||||
previous?.TransferTo(working);
|
previous?.TransferTo(working);
|
||||||
|
|
||||||
|
@ -48,9 +48,9 @@ namespace osu.Game.Database
|
|||||||
return Connection.Table<T>();
|
return Connection.Table<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetWithChildren<T>(object id) where T : class
|
public T GetWithChildren<T>(object id, bool recursive = false) where T : class
|
||||||
{
|
{
|
||||||
return Connection.GetWithChildren<T>(id);
|
return Connection.GetWithChildren<T>(id, recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
|
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
|
||||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
private readonly BeatmapDatabase database;
|
private readonly BeatmapDatabase database;
|
||||||
|
|
||||||
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, bool withStoryboard = false)
|
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool withStoryboard = false)
|
||||||
: base(beatmapInfo, beatmapSetInfo, withStoryboard)
|
: base(beatmapInfo, withStoryboard)
|
||||||
{
|
{
|
||||||
this.database = database;
|
this.database = database;
|
||||||
}
|
}
|
||||||
@ -51,13 +51,13 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
protected override Texture GetBackground()
|
protected override Texture GetBackground()
|
||||||
{
|
{
|
||||||
if (BeatmapInfo?.Metadata?.BackgroundFile == null)
|
if (Metadata?.BackgroundFile == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var reader = getReader())
|
using (var reader = getReader())
|
||||||
return new TextureStore(new RawTextureLoaderStore(reader), false).Get(BeatmapInfo.Metadata.BackgroundFile);
|
return new TextureStore(new RawTextureLoaderStore(reader), false).Get(Metadata.BackgroundFile);
|
||||||
}
|
}
|
||||||
catch { return null; }
|
catch { return null; }
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var trackData = getReader()?.GetStream(BeatmapInfo.Metadata.AudioFile);
|
var trackData = getReader()?.GetStream(Metadata.AudioFile);
|
||||||
return trackData == null ? null : new TrackBass(trackData);
|
return trackData == null ? null : new TrackBass(trackData);
|
||||||
}
|
}
|
||||||
catch { return null; }
|
catch { return null; }
|
||||||
|
@ -315,7 +315,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
BeatmapMetadata metadata = beatmap.Metadata;
|
||||||
title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
|
title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
|
||||||
artist.Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);
|
artist.Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -16,14 +19,8 @@ using osu.Game.Screens.Charts;
|
|||||||
using osu.Game.Screens.Direct;
|
using osu.Game.Screens.Direct;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Multiplayer;
|
using osu.Game.Screens.Multiplayer;
|
||||||
using OpenTK;
|
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Screens.Tournament;
|
using osu.Game.Screens.Tournament;
|
||||||
using osu.Framework.Input;
|
|
||||||
using OpenTK.Input;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
@ -65,7 +62,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private Bindable<bool> menuMusic;
|
private Bindable<bool> menuMusic;
|
||||||
private TrackManager trackManager;
|
private TrackManager trackManager;
|
||||||
private WorkingBeatmap song;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps)
|
private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps)
|
||||||
@ -76,11 +72,15 @@ namespace osu.Game.Screens.Menu
|
|||||||
if (!menuMusic)
|
if (!menuMusic)
|
||||||
{
|
{
|
||||||
trackManager = game.Audio.Track;
|
trackManager = game.Audio.Track;
|
||||||
List<BeatmapSetInfo> choosableBeatmapSets = beatmaps.Query<BeatmapSetInfo>().ToList();
|
|
||||||
if (choosableBeatmapSets.Count > 0)
|
var query = beatmaps.Query<BeatmapSetInfo>().Where(b => !b.DeletePending);
|
||||||
|
int count = query.Count();
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
song = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren<BeatmapSetInfo>(choosableBeatmapSets[RNG.Next(0, choosableBeatmapSets.Count - 1)].ID).Beatmaps[0]);
|
var beatmap = query.ElementAt(RNG.Next(0, count - 1));
|
||||||
Beatmap = song;
|
beatmaps.GetChildren(beatmap, true);
|
||||||
|
Beatmap = beatmaps.GetWorkingBeatmap(beatmap.Beatmaps[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,15 +106,15 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
buttons.FadeInFromZero(500);
|
buttons.FadeInFromZero(500);
|
||||||
if (last is Intro && song != null)
|
if (last is Intro && Beatmap != null)
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
trackManager.SetExclusive(song.Track);
|
trackManager.SetExclusive(Beatmap.Track);
|
||||||
song.Track.Seek(song.Beatmap.Metadata.PreviewTime);
|
Beatmap.Track.Seek(Beatmap.Metadata.PreviewTime);
|
||||||
if (song.Beatmap.Metadata.PreviewTime == -1)
|
if (Beatmap.Metadata.PreviewTime == -1)
|
||||||
song.Track.Seek(song.Track.Length * 0.4f);
|
Beatmap.Track.Seek(Beatmap.Track.Length * 0.4f);
|
||||||
song.Track.Start();
|
Beatmap.Track.Start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,13 +220,11 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet)
|
private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
database.GetChildren(beatmapSet);
|
foreach(var b in beatmapSet.Beatmaps)
|
||||||
beatmapSet.Beatmaps.ForEach(b =>
|
|
||||||
{
|
{
|
||||||
database.GetChildren(b);
|
|
||||||
if (b.Metadata == null)
|
if (b.Metadata == null)
|
||||||
b.Metadata = beatmapSet.Metadata;
|
b.Metadata = beatmapSet.Metadata;
|
||||||
});
|
}
|
||||||
|
|
||||||
return new BeatmapGroup(beatmapSet, database)
|
return new BeatmapGroup(beatmapSet, database)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
Icon = FontAwesome.fa_trash_o;
|
Icon = FontAwesome.fa_trash_o;
|
||||||
HeaderText = @"Confirm deletion of";
|
HeaderText = @"Confirm deletion of";
|
||||||
BodyText = $@"{beatmap.Beatmap?.Metadata?.Artist} - {beatmap.Beatmap?.Metadata?.Title}";
|
BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}";
|
||||||
Buttons = new PopupDialogButton[]
|
Buttons = new PopupDialogButton[]
|
||||||
{
|
{
|
||||||
new PopupDialogOkButton
|
new PopupDialogOkButton
|
||||||
|
@ -183,7 +183,7 @@ namespace osu.Game.Screens.Select
|
|||||||
initialAddSetsTask = new CancellationTokenSource();
|
initialAddSetsTask = new CancellationTokenSource();
|
||||||
|
|
||||||
carousel.BeatmapsChanged = beatmapsLoaded;
|
carousel.BeatmapsChanged = beatmapsLoaded;
|
||||||
carousel.Beatmaps = database.Query<BeatmapSetInfo>().Where(b => !b.DeletePending);
|
carousel.Beatmaps = database.GetAllWithChildren<BeatmapSetInfo>(b => !b.DeletePending);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapsLoaded()
|
private void beatmapsLoaded()
|
||||||
@ -343,7 +343,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
trackManager.SetExclusive(track);
|
trackManager.SetExclusive(track);
|
||||||
if (preview)
|
if (preview)
|
||||||
track.Seek(Beatmap.Beatmap.Metadata.PreviewTime);
|
track.Seek(Beatmap.Metadata.PreviewTime);
|
||||||
track.Start();
|
track.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user