Skip to content

Commit

Permalink
Merge pull request #49 from ILW8/display-replay-on-import
Browse files Browse the repository at this point in the history
immediately show replay after importing
  • Loading branch information
ILW8 authored May 9, 2024
2 parents f7e8fbf + 77f1f0d commit bf87c42
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
16 changes: 15 additions & 1 deletion osu.Game/Overlays/NotificationOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,21 @@ public void Post(Notification notification) => postScheduler.Add(() =>
notification.Closed += () => notificationClosed(notification);

if (notification is IHasCompletionTarget hasCompletionTarget)
hasCompletionTarget.CompletionTarget = Post;
{
if (hasCompletionTarget.CompletionTarget != null)
{
var originalCompletionTarget = hasCompletionTarget.CompletionTarget;
hasCompletionTarget.CompletionTarget = (notification1 =>
{
Scheduler.AddOnce(() => originalCompletionTarget?.Invoke(notification1));
Post(notification1);
});
}
else
{
hasCompletionTarget.CompletionTarget = Post;
}
}

playDebouncedSample(notification.PopInSampleName);

Expand Down
25 changes: 22 additions & 3 deletions osu.Game/Scoring/ScoreManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,20 @@ public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storag

scoreImporter = new ScoreImporter(rulesets, beatmaps, storage, realm, api)
{
PostNotification = obj => PostNotification?.Invoke(obj)
PostNotification = obj =>
{
if (obj is ProgressNotification progressNotification)
{
var originalCompletionTarget = progressNotification.CompletionTarget;
progressNotification.CompletionTarget = notification =>
{
progressNotification.CompletionClickAction?.Invoke();
originalCompletionTarget?.Invoke(notification);
};
}

PostNotification?.Invoke(obj);
}
};

scoreExporter = new LegacyScoreExporter(storage)
Expand Down Expand Up @@ -149,9 +162,15 @@ public void Delete(BeatmapInfo beatmap, bool silent = false)
});
}

public Task Import(params string[] paths) => scoreImporter.Import(paths);
public Task Import(params string[] paths)
{
return scoreImporter.Import(paths);
}

public Task Import(ImportTask[] imports, ImportParameters parameters = default) => scoreImporter.Import(imports, parameters);
public Task Import(ImportTask[] imports, ImportParameters parameters = default)
{
return scoreImporter.Import(imports, parameters);
}

public override bool IsAvailableLocally(ScoreInfo model)
=> Realm.Run(realm => realm.All<ScoreInfo>()
Expand Down

0 comments on commit bf87c42

Please sign in to comment.