mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09: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.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
@ -49,6 +50,9 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RealmAccess realm { get; set; }
|
private RealmAccess realm { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private SettingsOverlay settings { get; set; }
|
||||||
|
|
||||||
private IDisposable realmSubscription;
|
private IDisposable realmSubscription;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
@ -91,6 +95,25 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
skins.SelectRandomSkin();
|
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)
|
private void skinsChanged(IRealmCollection<SkinInfo> sender, ChangeSet changes, Exception error)
|
||||||
|
@ -44,6 +44,8 @@ namespace osu.Game.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Skin DefaultClassicSkin { get; }
|
public Skin DefaultClassicSkin { get; }
|
||||||
|
|
||||||
|
public Action<IEnumerable<Live<SkinInfo>>> PresentSkinsImport { get; set; }
|
||||||
|
|
||||||
private readonly AudioManager audio;
|
private readonly AudioManager audio;
|
||||||
|
|
||||||
private readonly Scheduler scheduler;
|
private readonly Scheduler scheduler;
|
||||||
@ -87,15 +89,7 @@ namespace osu.Game.Skinning
|
|||||||
skinImporter = new SkinImporter(storage, realm, this)
|
skinImporter = new SkinImporter(storage, realm, this)
|
||||||
{
|
{
|
||||||
PostNotification = obj => PostNotification?.Invoke(obj),
|
PostNotification = obj => PostNotification?.Invoke(obj),
|
||||||
PresentImport = skins =>
|
PresentImport = skins => PresentSkinsImport?.Invoke(skins),
|
||||||
{
|
|
||||||
switch (skins.Count())
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
CurrentSkinInfo.Value = skins.Last();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var defaultSkins = new[]
|
var defaultSkins = new[]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user