mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
add ResourceManager
This commit is contained in:
parent
4e97b4b898
commit
6fdb0c7b0e
@ -103,6 +103,7 @@
|
||||
<Compile Include="Classes\PPtr.cs" />
|
||||
<Compile Include="Classes\RectTransform.cs" />
|
||||
<Compile Include="Classes\Renderer.cs" />
|
||||
<Compile Include="Classes\ResourceManager.cs" />
|
||||
<Compile Include="Classes\RuntimeAnimatorController.cs" />
|
||||
<Compile Include="Classes\Shader.cs" />
|
||||
<Compile Include="Classes\SkinnedMeshRenderer.cs" />
|
||||
|
@ -333,6 +333,9 @@ namespace AssetStudio
|
||||
case ClassIDType.VideoClip:
|
||||
obj = new VideoClip(objectReader);
|
||||
break;
|
||||
case ClassIDType.ResourceManager:
|
||||
obj = new ResourceManager(objectReader);
|
||||
break;
|
||||
default:
|
||||
obj = new Object(objectReader);
|
||||
break;
|
||||
|
19
AssetStudio/Classes/ResourceManager.cs
Normal file
19
AssetStudio/Classes/ResourceManager.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class ResourceManager : Object
|
||||
{
|
||||
public KeyValuePair<string, PPtr<Object>>[] m_Container;
|
||||
|
||||
public ResourceManager(ObjectReader reader) : base(reader)
|
||||
{
|
||||
var m_ContainerSize = reader.ReadInt32();
|
||||
m_Container = new KeyValuePair<string, PPtr<Object>>[m_ContainerSize];
|
||||
for (int i = 0; i < m_ContainerSize; i++)
|
||||
{
|
||||
m_Container[i] = new KeyValuePair<string, PPtr<Object>>(reader.ReadAlignedString(), new PPtr<Object>(reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -103,12 +103,11 @@ namespace AssetStudioGUI
|
||||
string productName = null;
|
||||
var objectCount = assetsManager.assetsFileList.Sum(x => x.Objects.Count);
|
||||
var objectAssetItemDic = new Dictionary<Object, AssetItem>(objectCount);
|
||||
var containers = new List<(PPtr<Object>, string)>();
|
||||
int i = 0;
|
||||
Progress.Reset();
|
||||
foreach (var assetsFile in assetsManager.assetsFileList)
|
||||
{
|
||||
var tempExportableAssets = new List<AssetItem>();
|
||||
Dictionary<long, string> containers = null;
|
||||
foreach (var asset in assetsFile.Objects)
|
||||
{
|
||||
var assetItem = new AssetItem(asset);
|
||||
@ -173,7 +172,6 @@ namespace AssetStudioGUI
|
||||
productName = m_PlayerSettings.productName;
|
||||
break;
|
||||
case AssetBundle m_AssetBundle:
|
||||
containers = new Dictionary<long, string>();
|
||||
foreach (var m_Container in m_AssetBundle.m_Container)
|
||||
{
|
||||
var preloadIndex = m_Container.Value.preloadIndex;
|
||||
@ -181,15 +179,17 @@ namespace AssetStudioGUI
|
||||
var preloadEnd = preloadIndex + preloadSize;
|
||||
for (int k = preloadIndex; k < preloadEnd; k++)
|
||||
{
|
||||
var m_PreloadTable = m_AssetBundle.m_PreloadTable[k];
|
||||
if (m_PreloadTable.m_FileID == 0)
|
||||
{
|
||||
containers[m_AssetBundle.m_PreloadTable[k].m_PathID] = m_Container.Key;
|
||||
}
|
||||
containers.Add((m_AssetBundle.m_PreloadTable[k], m_Container.Key));
|
||||
}
|
||||
}
|
||||
assetItem.Text = m_AssetBundle.m_Name;
|
||||
break;
|
||||
case ResourceManager m_ResourceManager:
|
||||
foreach (var m_Container in m_ResourceManager.m_Container)
|
||||
{
|
||||
containers.Add((m_Container.Value, m_Container.Key));
|
||||
}
|
||||
break;
|
||||
case NamedObject m_NamedObject:
|
||||
assetItem.Text = m_NamedObject.m_Name;
|
||||
break;
|
||||
@ -200,28 +200,24 @@ namespace AssetStudioGUI
|
||||
}
|
||||
if (Properties.Settings.Default.displayAll || exportable)
|
||||
{
|
||||
tempExportableAssets.Add(assetItem);
|
||||
exportableAssets.Add(assetItem);
|
||||
}
|
||||
Progress.Report(++i, objectCount);
|
||||
}
|
||||
foreach (var item in tempExportableAssets)
|
||||
{
|
||||
if (containers != null)
|
||||
{
|
||||
if (containers.TryGetValue(item.Asset.m_PathID, out var container))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(container))
|
||||
{
|
||||
item.Container = container;
|
||||
}
|
||||
}
|
||||
}
|
||||
item.SetSubItems();
|
||||
}
|
||||
exportableAssets.AddRange(tempExportableAssets);
|
||||
tempExportableAssets.Clear();
|
||||
containers?.Clear();
|
||||
}
|
||||
foreach ((var pptr, var container) in containers)
|
||||
{
|
||||
if (pptr.TryGet(out var obj))
|
||||
{
|
||||
objectAssetItemDic[obj].Container = container;
|
||||
}
|
||||
}
|
||||
foreach (var tmp in exportableAssets)
|
||||
{
|
||||
tmp.SetSubItems();
|
||||
}
|
||||
containers.Clear();
|
||||
|
||||
visibleAssets = exportableAssets;
|
||||
|
||||
StatusStripUpdate("Building tree structure...");
|
||||
|
Loading…
Reference in New Issue
Block a user