Merge branch 'master' into import-early-checksum-abort

This commit is contained in:
Dan Balasescu
2021-06-28 19:29:08 +09:00
committed by GitHub
71 changed files with 1534 additions and 248 deletions

View File

@ -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;
}
}
}

View File

@ -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)