mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Merge remote-tracking branch 'upstream/master' into fix-file-references
This commit is contained in:
commit
b4acdd5f90
@ -17,6 +17,7 @@ using osu.Game.Beatmaps.Formats;
|
|||||||
using osu.Game.Beatmaps.IO;
|
using osu.Game.Beatmaps.IO;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.IPC;
|
using osu.Game.IPC;
|
||||||
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using SQLite.Net;
|
using SQLite.Net;
|
||||||
|
|
||||||
@ -53,6 +54,11 @@ namespace osu.Game.Beatmaps
|
|||||||
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
||||||
private BeatmapIPCChannel ipc;
|
private BeatmapIPCChannel ipc;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set an endpoint for notifications to be posted to.
|
||||||
|
/// </summary>
|
||||||
|
public Action<Notification> PostNotification { private get; set; }
|
||||||
|
|
||||||
public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null)
|
public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null)
|
||||||
{
|
{
|
||||||
beatmaps = new BeatmapStore(connection);
|
beatmaps = new BeatmapStore(connection);
|
||||||
@ -68,29 +74,48 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Import multiple <see cref="BeatmapSetInfo"/> from filesystem <paramref name="paths"/>.
|
/// Import one or more <see cref="BeatmapSetInfo"/> from filesystem <paramref name="paths"/>.
|
||||||
|
/// This will post a notification tracking import progress.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="paths">Multiple locations on disk.</param>
|
/// <param name="paths">One or more beatmap locations on disk.</param>
|
||||||
public void Import(params string[] paths)
|
public void Import(params string[] paths)
|
||||||
{
|
{
|
||||||
|
var notification = new ProgressNotification
|
||||||
|
{
|
||||||
|
Text = "Beatmap import is initialising...",
|
||||||
|
Progress = 0,
|
||||||
|
State = ProgressNotificationState.Active,
|
||||||
|
};
|
||||||
|
|
||||||
|
PostNotification?.Invoke(notification);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
foreach (string path in paths)
|
foreach (string path in paths)
|
||||||
{
|
{
|
||||||
|
if (notification.State == ProgressNotificationState.Cancelled)
|
||||||
|
// user requested abort
|
||||||
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
notification.Text = $"Importing ({i} of {paths.Length})\n{Path.GetFileName(path)}";
|
||||||
using (ArchiveReader reader = getReaderFrom(path))
|
using (ArchiveReader reader = getReaderFrom(path))
|
||||||
Import(reader);
|
Import(reader);
|
||||||
|
|
||||||
|
notification.Progress = (float)++i / paths.Length;
|
||||||
|
|
||||||
// We may or may not want to delete the file depending on where it is stored.
|
// We may or may not want to delete the file depending on where it is stored.
|
||||||
// e.g. reconstructing/repairing database with beatmaps from default storage.
|
// e.g. reconstructing/repairing database with beatmaps from default storage.
|
||||||
// Also, not always a single file, i.e. for LegacyFilesystemReader
|
// Also, not always a single file, i.e. for LegacyFilesystemReader
|
||||||
// TODO: Add a check to prevent files from storage to be deleted.
|
// TODO: Add a check to prevent files from storage to be deleted.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Delete(path);
|
if (File.Exists(path))
|
||||||
|
File.Delete(path);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.Error(e, $@"Could not delete file at {path}");
|
Logger.Error(e, $@"Could not delete original file after import ({Path.GetFileName(path)})");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -99,17 +124,25 @@ namespace osu.Game.Beatmaps
|
|||||||
Logger.Error(e, @"Could not import beatmap set");
|
Logger.Error(e, @"Could not import beatmap set");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notification.State = ProgressNotificationState.Completed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly object importLock = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Import a beatmap from an <see cref="ArchiveReader"/>.
|
/// Import a beatmap from an <see cref="ArchiveReader"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="archiveReader">The beatmap to be imported.</param>
|
/// <param name="archiveReader">The beatmap to be imported.</param>
|
||||||
public BeatmapSetInfo Import(ArchiveReader archiveReader)
|
public BeatmapSetInfo Import(ArchiveReader archiveReader)
|
||||||
{
|
{
|
||||||
BeatmapSetInfo set = importToStorage(archiveReader);
|
// let's only allow one concurrent import at a time for now.
|
||||||
Import(set);
|
lock (importLock)
|
||||||
return set;
|
{
|
||||||
|
BeatmapSetInfo set = importToStorage(archiveReader);
|
||||||
|
Import(set);
|
||||||
|
return set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -121,7 +154,8 @@ namespace osu.Game.Beatmaps
|
|||||||
// If we have an ID then we already exist in the database.
|
// If we have an ID then we already exist in the database.
|
||||||
if (beatmapSetInfo.ID != 0) return;
|
if (beatmapSetInfo.ID != 0) return;
|
||||||
|
|
||||||
beatmaps.Add(beatmapSetInfo);
|
lock (beatmaps)
|
||||||
|
beatmaps.Add(beatmapSetInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -131,7 +165,8 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <param name="beatmapSet">The beatmap to delete.</param>
|
/// <param name="beatmapSet">The beatmap to delete.</param>
|
||||||
public void Delete(BeatmapSetInfo beatmapSet)
|
public void Delete(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
if (!beatmaps.Delete(beatmapSet)) return;
|
lock (beatmaps)
|
||||||
|
if (!beatmaps.Delete(beatmapSet)) return;
|
||||||
|
|
||||||
if (!beatmapSet.Protected)
|
if (!beatmapSet.Protected)
|
||||||
files.Dereference(beatmapSet.Files.Select(f => f.FileInfo));
|
files.Dereference(beatmapSet.Files.Select(f => f.FileInfo));
|
||||||
@ -144,7 +179,8 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <param name="beatmapSet">The beatmap to restore.</param>
|
/// <param name="beatmapSet">The beatmap to restore.</param>
|
||||||
public void Undelete(BeatmapSetInfo beatmapSet)
|
public void Undelete(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
if (!beatmaps.Undelete(beatmapSet)) return;
|
lock (beatmaps)
|
||||||
|
if (!beatmaps.Undelete(beatmapSet)) return;
|
||||||
|
|
||||||
if (!beatmapSet.Protected)
|
if (!beatmapSet.Protected)
|
||||||
files.Reference(beatmapSet.Files.Select(f => f.FileInfo));
|
files.Reference(beatmapSet.Files.Select(f => f.FileInfo));
|
||||||
@ -161,7 +197,8 @@ namespace osu.Game.Beatmaps
|
|||||||
if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
||||||
return DefaultBeatmap;
|
return DefaultBeatmap;
|
||||||
|
|
||||||
beatmaps.Populate(beatmapInfo);
|
lock (beatmaps)
|
||||||
|
beatmaps.Populate(beatmapInfo);
|
||||||
|
|
||||||
if (beatmapInfo.BeatmapSet == null)
|
if (beatmapInfo.BeatmapSet == 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.");
|
||||||
@ -181,7 +218,8 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
beatmaps.Reset();
|
lock (beatmaps)
|
||||||
|
beatmaps.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -191,12 +229,15 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>The first result for the provided query, or null if no results were found.</returns>
|
/// <returns>The first result for the provided query, or null if no results were found.</returns>
|
||||||
public BeatmapSetInfo QueryBeatmapSet(Func<BeatmapSetInfo, bool> query)
|
public BeatmapSetInfo QueryBeatmapSet(Func<BeatmapSetInfo, bool> query)
|
||||||
{
|
{
|
||||||
BeatmapSetInfo set = beatmaps.Query<BeatmapSetInfo>().FirstOrDefault(query);
|
lock (beatmaps)
|
||||||
|
{
|
||||||
|
BeatmapSetInfo set = beatmaps.Query<BeatmapSetInfo>().FirstOrDefault(query);
|
||||||
|
|
||||||
if (set != null)
|
if (set != null)
|
||||||
beatmaps.Populate(set);
|
beatmaps.Populate(set);
|
||||||
|
|
||||||
return set;
|
return set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -204,7 +245,10 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query">The query.</param>
|
/// <param name="query">The query.</param>
|
||||||
/// <returns>Results from the provided query.</returns>
|
/// <returns>Results from the provided query.</returns>
|
||||||
public List<BeatmapSetInfo> QueryBeatmapSets(Expression<Func<BeatmapSetInfo, bool>> query) => beatmaps.QueryAndPopulate(query);
|
public List<BeatmapSetInfo> QueryBeatmapSets(Expression<Func<BeatmapSetInfo, bool>> query)
|
||||||
|
{
|
||||||
|
lock (beatmaps) return beatmaps.QueryAndPopulate(query);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform a lookup query on available <see cref="BeatmapInfo"/>s.
|
/// Perform a lookup query on available <see cref="BeatmapInfo"/>s.
|
||||||
@ -213,12 +257,15 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>The first result for the provided query, or null if no results were found.</returns>
|
/// <returns>The first result for the provided query, or null if no results were found.</returns>
|
||||||
public BeatmapInfo QueryBeatmap(Func<BeatmapInfo, bool> query)
|
public BeatmapInfo QueryBeatmap(Func<BeatmapInfo, bool> query)
|
||||||
{
|
{
|
||||||
BeatmapInfo set = beatmaps.Query<BeatmapInfo>().FirstOrDefault(query);
|
lock (beatmaps)
|
||||||
|
{
|
||||||
|
BeatmapInfo set = beatmaps.Query<BeatmapInfo>().FirstOrDefault(query);
|
||||||
|
|
||||||
if (set != null)
|
if (set != null)
|
||||||
beatmaps.Populate(set);
|
beatmaps.Populate(set);
|
||||||
|
|
||||||
return set;
|
return set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -226,7 +273,10 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query">The query.</param>
|
/// <param name="query">The query.</param>
|
||||||
/// <returns>Results from the provided query.</returns>
|
/// <returns>Results from the provided query.</returns>
|
||||||
public List<BeatmapInfo> QueryBeatmaps(Expression<Func<BeatmapInfo, bool>> query) => beatmaps.QueryAndPopulate(query);
|
public List<BeatmapInfo> QueryBeatmaps(Expression<Func<BeatmapInfo, bool>> query)
|
||||||
|
{
|
||||||
|
lock (beatmaps) return beatmaps.QueryAndPopulate(query);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an <see cref="ArchiveReader"/> from a valid storage path.
|
/// Creates an <see cref="ArchiveReader"/> from a valid storage path.
|
||||||
@ -258,7 +308,10 @@ namespace osu.Game.Beatmaps
|
|||||||
var hash = hashable.ComputeSHA2Hash();
|
var hash = hashable.ComputeSHA2Hash();
|
||||||
|
|
||||||
// check if this beatmap has already been imported and exit early if so.
|
// check if this beatmap has already been imported and exit early if so.
|
||||||
var beatmapSet = beatmaps.QueryAndPopulate<BeatmapSetInfo>().FirstOrDefault(b => b.Hash == hash);
|
BeatmapSetInfo beatmapSet;
|
||||||
|
lock (beatmaps)
|
||||||
|
beatmapSet = beatmaps.QueryAndPopulate<BeatmapSetInfo>(b => b.Hash == hash).FirstOrDefault();
|
||||||
|
|
||||||
if (beatmapSet != null)
|
if (beatmapSet != null)
|
||||||
{
|
{
|
||||||
Undelete(beatmapSet);
|
Undelete(beatmapSet);
|
||||||
@ -329,10 +382,13 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
||||||
public List<BeatmapSetInfo> GetAllUsableBeatmapSets(bool populate = true)
|
public List<BeatmapSetInfo> GetAllUsableBeatmapSets(bool populate = true)
|
||||||
{
|
{
|
||||||
if (populate)
|
lock (beatmaps)
|
||||||
return beatmaps.QueryAndPopulate<BeatmapSetInfo>(b => !b.DeletePending).ToList();
|
{
|
||||||
else
|
if (populate)
|
||||||
return beatmaps.Query<BeatmapSetInfo>(b => !b.DeletePending).ToList();
|
return beatmaps.QueryAndPopulate<BeatmapSetInfo>(b => !b.DeletePending).ToList();
|
||||||
|
else
|
||||||
|
return beatmaps.Query<BeatmapSetInfo>(b => !b.DeletePending).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class BeatmapManagerWorkingBeatmap : WorkingBeatmap
|
protected class BeatmapManagerWorkingBeatmap : WorkingBeatmap
|
||||||
@ -394,5 +450,50 @@ namespace osu.Game.Beatmaps
|
|||||||
catch { return new TrackVirtual(); }
|
catch { return new TrackVirtual(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ImportFromStable()
|
||||||
|
{
|
||||||
|
string stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!", "Songs");
|
||||||
|
if (!Directory.Exists(stableInstallPath))
|
||||||
|
stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu", "Songs");
|
||||||
|
|
||||||
|
if (!Directory.Exists(stableInstallPath))
|
||||||
|
{
|
||||||
|
Logger.Log("Couldn't find an osu!stable installation!", LoggingTarget.Information, LogLevel.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Import(Directory.GetDirectories(stableInstallPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteAll()
|
||||||
|
{
|
||||||
|
var maps = GetAllUsableBeatmapSets().ToArray();
|
||||||
|
|
||||||
|
if (maps.Length == 0) return;
|
||||||
|
|
||||||
|
var notification = new ProgressNotification
|
||||||
|
{
|
||||||
|
Progress = 0,
|
||||||
|
State = ProgressNotificationState.Active,
|
||||||
|
};
|
||||||
|
|
||||||
|
PostNotification?.Invoke(notification);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
foreach (var b in maps)
|
||||||
|
{
|
||||||
|
if (notification.State == ProgressNotificationState.Cancelled)
|
||||||
|
// user requested abort
|
||||||
|
return;
|
||||||
|
|
||||||
|
notification.Text = $"Deleting ({i} of {maps.Length})";
|
||||||
|
notification.Progress = (float)++i / maps.Length;
|
||||||
|
Delete(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
notification.State = ProgressNotificationState.Completed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,9 +99,9 @@ namespace osu.Game.Database
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Query and populate results.
|
/// Query and populate results.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filter">An optional filter to refine results.</param>
|
/// <param name="filter">An filter to refine results.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<T> QueryAndPopulate<T>(Expression<Func<T, bool>> filter = null)
|
public List<T> QueryAndPopulate<T>(Expression<Func<T, bool>> filter)
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
checkType(typeof(T));
|
checkType(typeof(T));
|
||||||
|
@ -149,6 +149,9 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// hook up notifications to components.
|
||||||
|
BeatmapManager.PostNotification = n => notificationOverlay?.Post(n);
|
||||||
|
|
||||||
AddRange(new Drawable[] {
|
AddRange(new Drawable[] {
|
||||||
new VolumeControlReceptor
|
new VolumeControlReceptor
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
|
|
||||||
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
|
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
PlaylistItem itemToRemove = items.Children.FirstOrDefault(item => item.BeatmapSetInfo == beatmapSet);
|
PlaylistItem itemToRemove = items.Children.FirstOrDefault(item => item.BeatmapSetInfo.ID == beatmapSet.ID);
|
||||||
if (itemToRemove != null) items.Remove(itemToRemove);
|
if (itemToRemove != null) items.Remove(itemToRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,11 +77,11 @@ namespace osu.Game.Overlays.Music
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
beatmaps.BeatmapSetAdded += s => Schedule(() => list.AddBeatmapSet(s));
|
||||||
|
beatmaps.BeatmapSetRemoved += s => Schedule(() => list.RemoveBeatmapSet(s));
|
||||||
|
|
||||||
list.BeatmapSets = BeatmapSets = beatmaps.GetAllUsableBeatmapSets();
|
list.BeatmapSets = BeatmapSets = beatmaps.GetAllUsableBeatmapSets();
|
||||||
|
|
||||||
// todo: these should probably be above the query.
|
|
||||||
beatmaps.BeatmapSetAdded += s => list.AddBeatmapSet(s);
|
|
||||||
beatmaps.BeatmapSetRemoved += s => list.RemoveBeatmapSet(s);
|
|
||||||
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
beatmapBacking.BindTo(game.Beatmap);
|
||||||
|
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||||
|
{
|
||||||
|
public class GeneralSettings : SettingsSubsection
|
||||||
|
{
|
||||||
|
private OsuButton importButton;
|
||||||
|
private OsuButton deleteButton;
|
||||||
|
|
||||||
|
protected override string Header => "General";
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(BeatmapManager beatmaps)
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
importButton = new OsuButton
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Text = "Import beatmaps from stable",
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
importButton.Enabled.Value = false;
|
||||||
|
Task.Run(() => beatmaps.ImportFromStable()).ContinueWith(t => Schedule(() => importButton.Enabled.Value = true));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteButton = new OsuButton
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Text = "Delete ALL beatmaps",
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
deleteButton.Enabled.Value = false;
|
||||||
|
Task.Run(() => beatmaps.DeleteAll()).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections
|
namespace osu.Game.Overlays.Settings.Sections
|
||||||
@ -17,6 +18,7 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
FlowContent.Spacing = new Vector2(0, 5);
|
FlowContent.Spacing = new Vector2(0, 5);
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
new GeneralSettings()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,14 @@ namespace osu.Game.Screens.Select
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveBeatmap(BeatmapSetInfo beatmapSet)
|
||||||
|
{
|
||||||
|
Schedule(delegate
|
||||||
|
{
|
||||||
|
removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void SelectBeatmap(BeatmapInfo beatmap, bool animated = true)
|
public void SelectBeatmap(BeatmapInfo beatmap, bool animated = true)
|
||||||
{
|
{
|
||||||
if (beatmap == null)
|
if (beatmap == null)
|
||||||
@ -128,8 +136,6 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveBeatmap(BeatmapSetInfo info) => removeGroup(groups.Find(b => b.BeatmapSet.ID == info.ID));
|
|
||||||
|
|
||||||
public Action<BeatmapInfo> SelectionChanged;
|
public Action<BeatmapInfo> SelectionChanged;
|
||||||
|
|
||||||
public Action StartRequested;
|
public Action StartRequested;
|
||||||
|
@ -280,7 +280,7 @@ namespace osu.Game.Screens.Select
|
|||||||
carousel.Filter(criteria, debounce);
|
carousel.Filter(criteria, debounce);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onBeatmapSetAdded(BeatmapSetInfo s) => carousel.AddBeatmap(s);
|
private void onBeatmapSetAdded(BeatmapSetInfo s) => Schedule(() => addBeatmapSet(s));
|
||||||
|
|
||||||
private void onBeatmapSetRemoved(BeatmapSetInfo s) => Schedule(() => removeBeatmapSet(s));
|
private void onBeatmapSetRemoved(BeatmapSetInfo s) => Schedule(() => removeBeatmapSet(s));
|
||||||
|
|
||||||
@ -375,6 +375,11 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||||
|
{
|
||||||
|
carousel.AddBeatmap(beatmapSet);
|
||||||
|
}
|
||||||
|
|
||||||
private void removeBeatmapSet(BeatmapSetInfo beatmapSet)
|
private void removeBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
carousel.RemoveBeatmap(beatmapSet);
|
carousel.RemoveBeatmap(beatmapSet);
|
||||||
|
@ -104,6 +104,7 @@
|
|||||||
<Compile Include="Overlays\Music\PlaylistList.cs" />
|
<Compile Include="Overlays\Music\PlaylistList.cs" />
|
||||||
<Compile Include="Overlays\OnScreenDisplay.cs" />
|
<Compile Include="Overlays\OnScreenDisplay.cs" />
|
||||||
<Compile Include="Graphics\Containers\SectionsContainer.cs" />
|
<Compile Include="Graphics\Containers\SectionsContainer.cs" />
|
||||||
|
<Compile Include="Overlays\Settings\Sections\Maintenance\GeneralSettings.cs" />
|
||||||
<Compile Include="Overlays\Settings\SettingsHeader.cs" />
|
<Compile Include="Overlays\Settings\SettingsHeader.cs" />
|
||||||
<Compile Include="Overlays\Settings\Sections\Audio\MainMenuSettings.cs" />
|
<Compile Include="Overlays\Settings\Sections\Audio\MainMenuSettings.cs" />
|
||||||
<Compile Include="Overlays\Toolbar\ToolbarChatButton.cs" />
|
<Compile Include="Overlays\Toolbar\ToolbarChatButton.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user