using System;
using System.Collections.Generic;
namespace XGame.Framework.Asset
{
public class CSharpAssetReferencesManifest : IAssetReferencesManifest, IDisposable
{
///
/// key:assetPath
/// value:references
///
private Dictionary _referencesMap;
public CSharpAssetReferencesManifest(AssetReferenceInfosSo manifest)
{
_referencesMap = new Dictionary();
Init(manifest);
}
private void Init(AssetReferenceInfosSo manifest)
{
if (manifest == null || manifest.references == null)
return;
foreach(var reference in manifest.references)
{
_referencesMap.Add(reference.assetName, reference.references);
}
}
public string[] GetReferencesByAssetName(string assetName)
{
_referencesMap.TryGetValue(assetName, out var result);
return result;
}
void IDisposable.Dispose()
{
_referencesMap.Clear();
}
}
}