using System.Collections.Generic;
using UnityEditor.Build.Pipeline.Interfaces;
using UnityEngine.AddressableAssets.ResourceLocators;
namespace UnityEditor.AddressableAssets.Build.DataBuilders
{
///
/// Object used in the build layout
///
public interface IBuildLayoutParameters : IContextObject
{
///
/// A mapping of internal AssetBundle names to the file name
///
Dictionary BundleNameRemap { get; set; }
///
/// Calculated hash of the build layout object
///
string BuildResultHash { get; }
///
/// The hash of the associated catalog
///
string CatalogHash { get; }
}
///
/// Concreate implementation for objects used in the build layout
///
public class BuildLayoutParameters : IBuildLayoutParameters
{
private Dictionary m_BundleNameRemap;
private ContentCatalogData m_contentCatalogData;
///
/// Create a build layout parameter
///
/// The map of internal bundle name to file name
public BuildLayoutParameters(Dictionary bundleNameRemap)
{
m_BundleNameRemap = bundleNameRemap;
}
///
/// Create a build layout parameter
///
/// The map of internal bundle name to file name
/// Content Catalog used in the build
public BuildLayoutParameters(Dictionary bundleNameRemap, ContentCatalogData contentCatalogData)
{
m_BundleNameRemap = bundleNameRemap;
m_contentCatalogData = contentCatalogData;
}
///
/// A map of the internal AssetBundle name to the file name
///
public Dictionary BundleNameRemap
{
get => m_BundleNameRemap;
set => m_BundleNameRemap = value;
}
///
/// Calculated hash of the build layout object
///
public string BuildResultHash
{
get => m_contentCatalogData?.BuildResultHash;
}
///
/// The hash of the associated catalog
///
public string CatalogHash
{
get => m_contentCatalogData?.LocalHash;
}
}
}