mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into expandable-controls
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -52,21 +53,24 @@ namespace osu.Game.Overlays.Dashboard
|
||||
base.LoadComplete();
|
||||
|
||||
playingUsers.BindTo(spectatorClient.PlayingUsers);
|
||||
playingUsers.BindCollectionChanged(onUsersChanged, true);
|
||||
playingUsers.BindCollectionChanged(onPlayingUsersChanged, true);
|
||||
}
|
||||
|
||||
private void onUsersChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() =>
|
||||
private void onPlayingUsersChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() =>
|
||||
{
|
||||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
foreach (int id in e.NewItems.OfType<int>().ToArray())
|
||||
Debug.Assert(e.NewItems != null);
|
||||
|
||||
foreach (int userId in e.NewItems)
|
||||
{
|
||||
users.GetUserAsync(id).ContinueWith(task =>
|
||||
users.GetUserAsync(userId).ContinueWith(task =>
|
||||
{
|
||||
var user = task.GetResultSafely();
|
||||
|
||||
if (user == null) return;
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
Schedule(() =>
|
||||
{
|
||||
@ -82,12 +86,10 @@ namespace osu.Game.Overlays.Dashboard
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
foreach (int u in e.OldItems.OfType<int>())
|
||||
userFlow.FirstOrDefault(card => card.User.Id == u)?.Expire();
|
||||
break;
|
||||
Debug.Assert(e.OldItems != null);
|
||||
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
userFlow.Clear();
|
||||
foreach (int userId in e.OldItems)
|
||||
userFlow.FirstOrDefault(card => card.User.Id == userId)?.Expire();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Music
|
||||
|
||||
filter.Search.OnCommit += (sender, newText) =>
|
||||
{
|
||||
list.FirstVisibleSet.PerformRead(set =>
|
||||
list.FirstVisibleSet?.PerformRead(set =>
|
||||
{
|
||||
BeatmapInfo toSelect = set.Beatmaps.FirstOrDefault();
|
||||
|
||||
|
@ -46,6 +46,9 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
case ScoreType.Recent:
|
||||
return user.ScoresRecentCount;
|
||||
|
||||
case ScoreType.Pinned:
|
||||
return user.ScoresPinnedCount;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new PaginatedScoreContainer(ScoreType.Pinned, User, UsersStrings.ShowExtraTopRanksPinnedTitle),
|
||||
new PaginatedScoreContainer(ScoreType.Best, User, UsersStrings.ShowExtraTopRanksBestTitle),
|
||||
new PaginatedScoreContainer(ScoreType.Firsts, User, UsersStrings.ShowExtraTopRanksFirstTitle)
|
||||
};
|
||||
|
@ -4,13 +4,16 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Screens;
|
||||
using osuTK;
|
||||
|
||||
@ -23,6 +26,15 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
[Resolved(canBeNull: true)]
|
||||
private OsuGame game { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private NotificationOverlay notifications { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private Storage storage { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private GameHost host { get; set; }
|
||||
|
||||
public override bool AllowBackButton => false;
|
||||
|
||||
public override bool AllowExternalScreenChange => false;
|
||||
@ -84,17 +96,33 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
|
||||
Beatmap.Value = Beatmap.Default;
|
||||
|
||||
var originalStorage = new NativeStorage(storage.GetFullPath(string.Empty), host);
|
||||
|
||||
migrationTask = Task.Run(PerformMigration)
|
||||
.ContinueWith(t =>
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
if (t.IsFaulted)
|
||||
Logger.Log($"Error during migration: {t.Exception?.Message}", level: LogLevel.Error);
|
||||
if (task.IsFaulted)
|
||||
{
|
||||
Logger.Error(task.Exception, $"Error during migration: {task.Exception?.Message}");
|
||||
}
|
||||
else if (!task.GetResultSafely())
|
||||
{
|
||||
notifications.Post(new SimpleNotification
|
||||
{
|
||||
Text = "Some files couldn't be cleaned up during migration. Clicking this notification will open the folder so you can manually clean things up.",
|
||||
Activated = () =>
|
||||
{
|
||||
originalStorage.PresentExternally();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Schedule(this.Exit);
|
||||
});
|
||||
}
|
||||
|
||||
protected virtual void PerformMigration() => game?.Migrate(destination.FullName);
|
||||
protected virtual bool PerformMigration() => game?.Migrate(destination.FullName) != false;
|
||||
|
||||
public override void OnEntering(IScreen last)
|
||||
{
|
||||
|
Reference in New Issue
Block a user