diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 5cf8157812..189db829bf 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -10,6 +10,7 @@ using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Framework.Logging; @@ -49,6 +50,9 @@ namespace osu.Game.Overlays.Settings.Sections [Resolved] private RealmAccess realm { get; set; } + [Resolved] + private SettingsOverlay settings { get; set; } + private IDisposable realmSubscription; [BackgroundDependencyLoader(permitNulls: true)] @@ -91,6 +95,25 @@ namespace osu.Game.Overlays.Settings.Sections skins.SelectRandomSkin(); } }); + + skins.PresentSkinsImport += presentSkinsImport; + } + + private void presentSkinsImport(IEnumerable> importedSkins) + { + switch (importedSkins.Count()) + { + case 1: + skins.CurrentSkinInfo.Value = importedSkins.Last(); + break; + + case > 1: + if (settings?.State.Value == Visibility.Hidden) + settings?.ToggleVisibility(); + + settings?.SectionsContainer.ScrollTo(this); + break; + } } private void skinsChanged(IRealmCollection sender, ChangeSet changes, Exception error) diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 02be3abab7..2921a5bc17 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -44,6 +44,8 @@ namespace osu.Game.Skinning /// public Skin DefaultClassicSkin { get; } + public Action>> PresentSkinsImport { get; set; } + private readonly AudioManager audio; private readonly Scheduler scheduler; @@ -87,15 +89,7 @@ namespace osu.Game.Skinning skinImporter = new SkinImporter(storage, realm, this) { PostNotification = obj => PostNotification?.Invoke(obj), - PresentImport = skins => - { - switch (skins.Count()) - { - case 1: - CurrentSkinInfo.Value = skins.Last(); - break; - } - }, + PresentImport = skins => PresentSkinsImport?.Invoke(skins), }; var defaultSkins = new[]