using System;
namespace UnityEngine.Localization.Metadata
{
///
/// Flags that can be used to indicate where the Metadata can be added in the Editor.
///
[Flags]
public enum MetadataType
{
///
/// Metadata can be added to a .
///
Locale = 1,
///
/// Metadata can be added to a .
///
SharedTableData = 2,
///
/// Metadata can be added to a .
///
StringTable = 4,
///
/// Metadata can be added to a .
///
AssetTable = 8,
///
/// Metadata can be added to a entry.
///
StringTableEntry = 16,
///
/// Metadata can be added to a entry.
///
AssetTableEntry = 32,
///
/// Metadata can be added to the Shared entry.
/// This will be accessible by all locales for the chosen Entry.
///
SharedStringTableEntry = 64,
///
/// Metadata can be added to the Shared entry.
/// This will be accessible by all locales for the chosen Entry.
///
SharedAssetTableEntry = 128,
///
/// Metadata can be added to the .
///
LocalizationSettings = 256,
///
/// Metadata can be added to any table type.
///
AllTables = StringTable | AssetTable,
///
/// Metadata can be added to any table entry.
///
AllTableEntries = StringTableEntry | AssetTableEntry,
///
/// Metadata can be added to any shared table entry.
/// This will be accessible by all locales for the chosen Entry.
///
AllSharedTableEntries = SharedStringTableEntry | SharedAssetTableEntry,
///
/// Metadata can be added to anything.
///
All = AllTables | AllTableEntries | Locale | SharedTableData
}
[AttributeUsage(AttributeTargets.Field)]
class MetadataTypeAttribute : PropertyAttribute
{
///
///
///
public MetadataType Type { get; set; }
///
///
///
///
public MetadataTypeAttribute(MetadataType type)
{
Type = type;
}
}
///
/// Provides a hint to the editor on where this metadata can be used.
/// This is only used in the Editor and not considered when adding Metadata through script.
///
///
/// This example shows how a Translation Status Metadata could be created.
/// This will only appear in the Metadata menu for String Table Entries.
/// 
///
///
[AttributeUsage(AttributeTargets.Class)]
public class MetadataAttribute : Attribute
{
///
/// Name to use in the add Metadata menu. If empty then the class name will be used.
///
public string MenuItem { get; set; }
///
/// Should it be possible to have more than 1 instance?
///
public bool AllowMultiple { get; set; } = true;
///
/// Describes where the Metadata can be added. This is used when generating the add Metadata menu.
///
public MetadataType AllowedTypes { get; set; } = MetadataType.All;
}
}