diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index df3d8b99f4..900c07b3c5 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -49,6 +49,7 @@ using osu.Game.Overlays; using osu.Game.Overlays.BeatmapListing; using osu.Game.Overlays.Music; using osu.Game.Overlays.Notifications; +using osu.Game.Overlays.Settings.Sections; using osu.Game.Overlays.SkinEditor; using osu.Game.Overlays.Toolbar; using osu.Game.Overlays.Volume; @@ -60,6 +61,7 @@ using osu.Game.Screens.Menu; using osu.Game.Screens.Play; using osu.Game.Screens.Ranking; using osu.Game.Screens.Select; +using osu.Game.Skinning; using osu.Game.Updater; using osu.Game.Users; using osu.Game.Utils; @@ -501,6 +503,23 @@ namespace osu.Game /// The build version of the update stream public void ShowChangelogBuild(string updateStream, string version) => waitForReady(() => changelogOverlay, _ => changelogOverlay.ShowBuild(updateStream, version)); + /// + /// Present ether a skin select if one skin was imported or navigate to the skin selection menu if multiple skins were imported immediately. + /// + /// List of imported skins + public void PresentSkins(IEnumerable> importedSkins) + { + int importedSkinsCount = importedSkins.Count(); + + if (importedSkinsCount == 1) + SkinManager.CurrentSkinInfo.Value = importedSkins.Single(); + else if (importedSkinsCount > 1) + { + Settings.Show(); + Settings.SectionsContainer.ScrollTo(Settings.SectionsContainer.Single(container => container is SkinSection)); + } + } + /// /// Present a beatmap at song select immediately. /// The user should have already requested this interactively. @@ -777,6 +796,7 @@ namespace osu.Game // todo: all archive managers should be able to be looped here. SkinManager.PostNotification = n => Notifications.Post(n); + SkinManager.PresentImport = PresentSkins; BeatmapManager.PostNotification = n => Notifications.Post(n); BeatmapManager.PresentImport = items => PresentBeatmap(items.First().Value); diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index cb1083c519..5cf8157812 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -10,7 +10,6 @@ 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; @@ -92,27 +91,6 @@ namespace osu.Game.Overlays.Settings.Sections skins.SelectRandomSkin(); } }); - - skins.PresentSkinsImport += presentSkinsImport; - } - - private void presentSkinsImport(IEnumerable> importedSkins) - { - SettingsOverlay settings = this.FindClosestParent(); - - 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 8b7c886b3b..fca7dc0f5e 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -44,11 +44,6 @@ namespace osu.Game.Skinning /// public Skin DefaultClassicSkin { get; } - /// - /// Presents imported skin(s) to a user - /// - public Action>> PresentSkinsImport { get; set; } - private readonly AudioManager audio; private readonly Scheduler scheduler; @@ -92,7 +87,6 @@ namespace osu.Game.Skinning skinImporter = new SkinImporter(storage, realm, this) { PostNotification = obj => PostNotification?.Invoke(obj), - PresentImport = skins => PresentSkinsImport?.Invoke(skins), }; var defaultSkins = new[]