using System;
using UnityEngine.Localization;
using UnityEngine.Localization.Tables;
namespace UnityEditor.Localization
{
///
/// Common events sent out during interaction with the localization system through the Editor.
///
public class LocalizationEditorEvents
{
///
/// Event that is sent when a new is added to the project.
///
public event Action LocaleAdded;
internal virtual void RaiseLocaleAdded(Locale locale) => LocaleAdded?.Invoke(locale);
///
/// Event that is sent when a is removed from the project.
///
public event Action LocaleRemoved;
internal virtual void RaiseLocaleRemoved(Locale locale) => LocaleRemoved?.Invoke(locale);
///
/// Event that is sent when the sort order is changed.
///
public event EventHandler LocaleSortOrderChanged;
internal virtual void RaiseLocaleSortOrderChanged(object sender, Locale locale) => LocaleSortOrderChanged?.Invoke(sender, locale);
///
/// Event that is sent when a table entry is modified.
///
public event Action TableEntryModified;
internal virtual void RaiseTableEntryModified(SharedTableData.SharedTableEntry tableEntry) => TableEntryModified?.Invoke(tableEntry);
///
/// Event that is sent when a new entry is added to a table.
///
public event Action TableEntryAdded;
internal virtual void RaiseTableEntryAdded(LocalizationTableCollection collection, SharedTableData.SharedTableEntry entry) => TableEntryAdded?.Invoke(collection, entry);
///
/// Event that is sent when an entry is removed from a a table.
///
public event Action TableEntryRemoved;
internal virtual void RaiseTableEntryRemoved(LocalizationTableCollection collection, SharedTableData.SharedTableEntry entry) => TableEntryRemoved?.Invoke(collection, entry);
///
/// Event that is sent when new asset table entry is added.
///
public event Action AssetTableEntryAdded;
internal virtual void RaiseAssetTableEntryAdded(AssetTableCollection collection, AssetTable table, AssetTableEntry entry) => AssetTableEntryAdded?.Invoke(collection, table, entry);
///
/// Event that is sent when an asset table entry is removed from a table.
///
public event Action AssetTableEntryRemoved;
internal virtual void RaiseAssetTableEntryRemoved(AssetTableCollection collection, AssetTable table, AssetTableEntry entry, string assetGuid) => AssetTableEntryRemoved?.Invoke(collection, table, entry, assetGuid);
///
/// Event that is sent when a table collection is modified.
///
public event EventHandler CollectionModified;
///
/// Sends an event to that indicates a table collection has been modified.
///
///
///
///
/// This shows how to export and import a as JSON.
///
///
public virtual void RaiseCollectionModified(object sender, LocalizationTableCollection collection) => CollectionModified?.Invoke(sender, collection);
///
/// Event that is sent when a new table collection is added to the project.
///
public event Action CollectionAdded;
internal virtual void RaiseCollectionAdded(LocalizationTableCollection collection) => CollectionAdded?.Invoke(collection);
///
/// Event that is sent when a table collection is removed from the project.
///
public event Action CollectionRemoved;
internal virtual void RaiseCollectionRemoved(LocalizationTableCollection collection) => CollectionRemoved?.Invoke(collection);
///
/// Event that is sent when a table is added to a collection in the project.
///
public event Action TableAddedToCollection;
internal virtual void RaiseTableAddedToCollection(LocalizationTableCollection collection, LocalizationTable table) => TableAddedToCollection?.Invoke(collection, table);
///
/// Event that is sent when a table is removed from a collection in the project.
///
public event Action TableRemovedFromCollection;
internal virtual void RaiseTableRemovedFromCollection(LocalizationTableCollection collection, LocalizationTable table) => TableRemovedFromCollection?.Invoke(collection, table);
///
/// Event that is sent when a collection extension is added to a table collection in the project.
///
public event Action ExtensionAddedToCollection;
internal virtual void RaiseExtensionAddedToCollection(LocalizationTableCollection collection, CollectionExtension collectionExtension) => ExtensionAddedToCollection?.Invoke(collection, collectionExtension);
///
/// Event that is sent when a collection extension is removed from a table collection in the project.
///
public event Action ExtensionRemovedFromCollection;
internal virtual void RaiseExtensionRemovedFromCollection(LocalizationTableCollection collection, CollectionExtension collectionExtension) => ExtensionRemovedFromCollection?.Invoke(collection, collectionExtension);
}
}