mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-21 07:50:20 +00:00
update asset system
编辑器模拟模式增加虚拟资源包
This commit is contained in:
@@ -69,7 +69,6 @@ namespace YooAsset
|
||||
|
||||
// 更新资源提供者
|
||||
// 注意:循环更新的时候,可能会扩展列表
|
||||
// 注意:不能限制场景对象的加载
|
||||
_isUnloadSafe = false;
|
||||
for (int i = 0; i < _providerList.Count; i++)
|
||||
{
|
||||
@@ -124,36 +123,21 @@ namespace YooAsset
|
||||
}
|
||||
private void UnloadUnusedAssetsInternal()
|
||||
{
|
||||
if (_simulationOnEditor)
|
||||
for (int i = _loaderList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
for (int i = _providerList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var provider = _providerList[i];
|
||||
if (provider.CanDestroy())
|
||||
{
|
||||
provider.Destroy();
|
||||
_providerList.RemoveAt(i);
|
||||
_providerDic.Remove(provider.ProviderGUID);
|
||||
}
|
||||
}
|
||||
BundleLoaderBase loader = _loaderList[i];
|
||||
loader.TryDestroyAllProviders();
|
||||
}
|
||||
else
|
||||
|
||||
for (int i = _loaderList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
for (int i = _loaderList.Count - 1; i >= 0; i--)
|
||||
BundleLoaderBase loader = _loaderList[i];
|
||||
if (loader.CanDestroy())
|
||||
{
|
||||
BundleLoaderBase loader = _loaderList[i];
|
||||
loader.TryDestroyAllProviders();
|
||||
}
|
||||
for (int i = _loaderList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
BundleLoaderBase loader = _loaderList[i];
|
||||
if (loader.CanDestroy())
|
||||
{
|
||||
string bundleName = loader.MainBundleInfo.Bundle.BundleName;
|
||||
loader.Destroy(false);
|
||||
_loaderList.RemoveAt(i);
|
||||
_loaderDic.Remove(bundleName);
|
||||
}
|
||||
string bundleName = loader.MainBundleInfo.Bundle.BundleName;
|
||||
loader.Destroy(false);
|
||||
_loaderList.RemoveAt(i);
|
||||
_loaderDic.Remove(bundleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -392,17 +376,24 @@ namespace YooAsset
|
||||
return loader;
|
||||
|
||||
// 新增下载需求
|
||||
if (_simulationOnEditor)
|
||||
{
|
||||
loader = new VirtualBundleFileLoader(this, bundleInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if UNITY_WEBGL
|
||||
if (bundleInfo.Bundle.IsRawFile)
|
||||
loader = new RawBundleWebLoader(this, bundleInfo);
|
||||
else
|
||||
loader = new AssetBundleWebLoader(this, bundleInfo);
|
||||
#else
|
||||
if (bundleInfo.Bundle.IsRawFile)
|
||||
loader = new RawBundleFileLoader(this, bundleInfo);
|
||||
else
|
||||
loader = new AssetBundleFileLoader(this, bundleInfo);
|
||||
if (bundleInfo.Bundle.IsRawFile)
|
||||
loader = new RawBundleFileLoader(this, bundleInfo);
|
||||
else
|
||||
loader = new AssetBundleFileLoader(this, bundleInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
_loaderList.Add(loader);
|
||||
_loaderDic.Add(bundleName, loader);
|
||||
@@ -437,13 +428,8 @@ namespace YooAsset
|
||||
providerInfo.RefCount = provider.RefCount;
|
||||
providerInfo.Status = provider.Status.ToString();
|
||||
providerInfo.DependBundleInfos = new List<DebugBundleInfo>();
|
||||
provider.GetBundleDebugInfos(providerInfo.DependBundleInfos);
|
||||
result.Add(providerInfo);
|
||||
|
||||
if (provider is BundledProvider)
|
||||
{
|
||||
BundledProvider temp = provider as BundledProvider;
|
||||
temp.GetBundleDebugInfos(providerInfo.DependBundleInfos);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user