mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Merge pull request #3381 from peppy/click-to-view-import
Add ability to click on imported complete notification to present last import
This commit is contained in:
commit
0537875665
@ -11,6 +11,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
@ -195,7 +196,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
downloadNotification.CompletionClickAction = () =>
|
||||
{
|
||||
PresentBeatmap?.Invoke(importedBeatmap);
|
||||
PresentCompletedImport(importedBeatmap.Yield());
|
||||
return true;
|
||||
};
|
||||
downloadNotification.State = ProgressNotificationState.Completed;
|
||||
@ -231,6 +232,12 @@ namespace osu.Game.Beatmaps
|
||||
BeatmapDownloadBegan?.Invoke(request);
|
||||
}
|
||||
|
||||
protected override void PresentCompletedImport(IEnumerable<BeatmapSetInfo> imported)
|
||||
{
|
||||
base.PresentCompletedImport(imported);
|
||||
PresentBeatmap?.Invoke(imported.LastOrDefault());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an existing download request if it exists.
|
||||
/// </summary>
|
||||
|
@ -166,10 +166,20 @@ namespace osu.Game.Database
|
||||
}
|
||||
}
|
||||
|
||||
notification.Text = errors > 0 ? $"Import complete with {errors} errors" : "Import successful!";
|
||||
notification.CompletionText = errors > 0 ? $"Import complete with {errors} errors" : "Import successful!";
|
||||
notification.CompletionClickAction += () =>
|
||||
{
|
||||
if (imported.Count > 0)
|
||||
PresentCompletedImport(imported);
|
||||
return true;
|
||||
};
|
||||
notification.State = ProgressNotificationState.Completed;
|
||||
}
|
||||
|
||||
protected virtual void PresentCompletedImport(IEnumerable<TModel> imported)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Import an item from an <see cref="ArchiveReader"/>.
|
||||
/// </summary>
|
||||
|
@ -169,7 +169,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
public Action<Notification> CompletionTarget { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An action to complete when the completion notification is clicked.
|
||||
/// An action to complete when the completion notification is clicked. Return true to close.
|
||||
/// </summary>
|
||||
public Func<bool> CompletionClickAction;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user