修改项目根地址, 并将部分依赖于ToolFile的功能迁移至依赖Interaction以实现网络文件的获取
This commit is contained in:
@@ -871,6 +871,7 @@ namespace Demo
|
||||
file = file | "Windows";
|
||||
#endif
|
||||
file = file | ab;
|
||||
var downloader = new Interaction(file.GetFullPath());
|
||||
if (AssetBundlesItemEntry == null)
|
||||
{
|
||||
var hierarchy = HierarchyWindow.instance;
|
||||
@@ -880,7 +881,7 @@ namespace Demo
|
||||
var abLoadingItem = AssetBundlesItemEntry.ref_value.GetComponent<HierarchyItem>().CreateSubPropertyItem(1)[0];
|
||||
var loadingHierarchyItem = abLoadingItem.ref_value.GetComponent<HierarchyItem>();
|
||||
loadingHierarchyItem.title = $"{ab}<Loading>";
|
||||
var ir = file.LoadAsAssetBundle(p =>
|
||||
var ir = downloader.LoadAsAssetBundle(p =>
|
||||
{
|
||||
loadingHierarchyItem.title = $"{ab}<Loading{(int)(p * 100)}%>";
|
||||
}, x =>
|
||||
@@ -908,39 +909,6 @@ namespace Demo
|
||||
AssetBundleLoading.Remove(ab);
|
||||
}
|
||||
|
||||
public static AssetBundle LoadAssetBundle(this IAssetBundleLoader self, string ab)
|
||||
{
|
||||
if (AssetBundleCounter.TryGetValue(ab, out var result))
|
||||
{
|
||||
result.referenceCounter++;
|
||||
return result.assetBundle;
|
||||
}
|
||||
var file = new ToolFile(PlatformIndicator.StreamingAssetsPath) | "AssetBundle/";
|
||||
#if PLATFORM_WINDOWS
|
||||
file = file | "Windows";
|
||||
#endif
|
||||
file = file | ab;
|
||||
if (AssetBundlesItemEntry == null)
|
||||
{
|
||||
var hierarchy = HierarchyWindow.instance;
|
||||
AssetBundlesItemEntry = hierarchy.CreateRootItemEntryWithBinders(nameof(AssetBundlesLoadHelper))[0];
|
||||
AssetBundlesItemEntry.ref_value.GetComponent<HierarchyItem>().title = nameof(AssetBundlesLoadHelper);
|
||||
}
|
||||
var abLoadingItem = AssetBundlesItemEntry.ref_value.GetComponent<HierarchyItem>().CreateSubPropertyItem(1)[0];
|
||||
abLoadingItem.ref_value.GetComponent<HierarchyItem>().title = $"{ab}<Loading>";
|
||||
var assetBundle = file.LoadAsAssetBundle();
|
||||
var item = abLoadingItem.ref_value.GetComponent<HierarchyItem>();
|
||||
item.title = $"{ab}";
|
||||
var assets = assetBundle.GetAllAssetNames();
|
||||
var subAssetsItems = item.CreateSubPropertyItem(assets.Length);
|
||||
for (int i = 0, e = assets.Length; i < e; i++)
|
||||
{
|
||||
subAssetsItems[i].ref_value.GetComponent<HierarchyItem>().title = Path.GetFileName(assets[i]);
|
||||
}
|
||||
AssetBundleCounter[ab] = new(assetBundle, 1, abLoadingItem);
|
||||
return assetBundle;
|
||||
}
|
||||
|
||||
public static IEnumerator UnloadAssetBundle(this IAssetBundleLoader self, string ab)
|
||||
{
|
||||
// Editor中暂时忽略卸载功能
|
||||
|
||||
Reference in New Issue
Block a user