using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.ResourceManagement.Util;
using UnityEngine.Serialization;
namespace UnityEditor.AddressableAssets.Settings
{
// TODO: OBSELETE: This is replaced with AddressableAssetGroupTemplate, this is needed to update existing setups to new Preset method
///
/// Contains a set of schemas used by the GUI to create predefined asset groups.
///
[Serializable]
public class AddressableAssetGroupSchemaTemplate
{
[FormerlySerializedAs("m_displayName")]
[SerializeField]
string m_DisplayName;
[FormerlySerializedAs("m_description")]
[SerializeField]
string m_Description;
[FormerlySerializedAs("m_schemaTypes")]
[SerializeField]
List m_SchemaTypes;
///
/// The display name of the template.
///
public string DisplayName
{
get { return m_DisplayName; }
}
///
/// the description of the template.
///
public string Description
{
get { return m_Description; }
}
///
/// The types of schemas in this template.
///
/// The array of schema types.
public Type[] GetTypes()
{
var types = new Type[m_SchemaTypes.Count];
for (int i = 0; i < types.Length; i++)
types[i] = m_SchemaTypes[i].Value;
return types;
}
///
/// Creates a template with the specified name, description and schema types.
///
/// The name of the template.
/// The template description.
/// The schema types for the template.
/// The newly created schema template.
public static AddressableAssetGroupSchemaTemplate Create(string name, string descr, params Type[] types)
{
var st = new AddressableAssetGroupSchemaTemplate { m_DisplayName = name, m_Description = descr };
st.m_SchemaTypes = new List(types.Length);
for (int i = 0; i < types.Length; i++)
st.m_SchemaTypes.Add(new SerializedType { Value = types[i] });
return st;
}
}
}