mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into import-early-checksum-abort
This commit is contained in:
@ -42,27 +42,30 @@ namespace osu.Game.Skinning
|
||||
};
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private ISkinSource skinSource { get; set; }
|
||||
private ISkinSource parentSource;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
UpdateSkins();
|
||||
skinSource.SourceChanged += OnSourceChanged;
|
||||
parentSource = parent.Get<ISkinSource>();
|
||||
parentSource.SourceChanged += OnSourceChanged;
|
||||
|
||||
// ensure sources are populated and ready for use before childrens' asynchronous load flow.
|
||||
UpdateSkinSources();
|
||||
|
||||
return base.CreateChildDependencies(parent);
|
||||
}
|
||||
|
||||
protected override void OnSourceChanged()
|
||||
{
|
||||
UpdateSkins();
|
||||
UpdateSkinSources();
|
||||
base.OnSourceChanged();
|
||||
}
|
||||
|
||||
protected virtual void UpdateSkins()
|
||||
protected virtual void UpdateSkinSources()
|
||||
{
|
||||
SkinSources.Clear();
|
||||
|
||||
foreach (var skin in skinSource.AllSources)
|
||||
foreach (var skin in parentSource.AllSources)
|
||||
{
|
||||
switch (skin)
|
||||
{
|
||||
@ -93,8 +96,8 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (skinSource != null)
|
||||
skinSource.SourceChanged -= OnSourceChanged;
|
||||
if (parentSource != null)
|
||||
parentSource.SourceChanged -= OnSourceChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,16 +144,16 @@ namespace osu.Game.Skinning
|
||||
return base.ComputeHash(item, reader);
|
||||
}
|
||||
|
||||
protected override async Task Populate(SkinInfo model, ArchiveReader archive, CancellationToken cancellationToken = default)
|
||||
protected override Task Populate(SkinInfo model, ArchiveReader archive, CancellationToken cancellationToken = default)
|
||||
{
|
||||
await base.Populate(model, archive, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var instance = GetSkin(model);
|
||||
|
||||
model.InstantiationInfo ??= instance.GetType().GetInvariantInstantiationInfo();
|
||||
|
||||
if (model.Name?.Contains(".osk", StringComparison.OrdinalIgnoreCase) == true)
|
||||
populateMetadata(model, instance);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void populateMetadata(SkinInfo item, Skin instance)
|
||||
|
Reference in New Issue
Block a user