mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 05:32:54 +08:00
Add navigation to skin settings on multiple import
This commit is contained in:
parent
35bc0a29d8
commit
a22a36bfe0
@ -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<Live<SkinInfo>> 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<SkinInfo> sender, ChangeSet changes, Exception error)
|
||||
|
@ -44,6 +44,8 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
public Skin DefaultClassicSkin { get; }
|
||||
|
||||
public Action<IEnumerable<Live<SkinInfo>>> 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[]
|
||||
|
Loading…
Reference in New Issue
Block a user