using System;
using System.Collections.Generic;
namespace XGame.Framework.Asset
{
public class CSharpSceneInfosManifest : ISceneInfosManifest, IDisposable
{
///
///
///
private Dictionary _sceneInfoMap;
public CSharpSceneInfosManifest(SceneInfosSo manifest)
{
_sceneInfoMap = new Dictionary();
Init(manifest);
}
private void Init(SceneInfosSo manifest)
{
if (manifest == null || manifest.sceneInfos == null)
return;
foreach (var info in manifest.sceneInfos)
{
_sceneInfoMap.Add(info.sceneName, info.assetName);
}
}
public string GetSceneAssetName(string sceneName)
{
_sceneInfoMap.TryGetValue(sceneName, out var assetName);
return assetName;
}
void IDisposable.Dispose()
{
_sceneInfoMap.Clear();
}
}
}