protected virtual void CacheDependencies(LocalizedTableCollection collection)
        {
            foreach (var table in collection.Tables)
            {
                var guid = LocalizationEditorSettings.Instance.GetAssetGuid(table.GetInstanceId());
                m_GuidToCollection[guid] = collection;
            }

            m_GuidToCollection[TableReference.StringFromGuid(collection.SharedData.TableCollectionNameGuid)] = collection;
        }
 void OnTableRemovedFromCollection(LocalizedTableCollection collection, LocalizedTable table)
 {
     if (m_GuidToCollection != null)
     {
         if (!AssetDatabase.TryGetGUIDAndLocalFileIdentifier(table, out var guid, out long _))
         {
             Debug.LogError("Failed to extract table guid: " + table?.name, table);
             return;
         }
         m_GuidToCollection.Remove(guid);
     }
 }
 void OnCollectionRemoved(LocalizedTableCollection collection)
 {
     if (collection is StringTableCollection stringTableCollection)
     {
         if (m_StringTableCollections != null && m_StringTableCollections.Contains(stringTableCollection))
         {
             m_StringTableCollections.Remove(stringTableCollection);
             m_GuidToCollection = null; // Clear cache
         }
     }
     else if (collection is AssetTableCollection assetTableCollection)
     {
         if (m_AssetTableCollections != null && m_AssetTableCollections.Contains(assetTableCollection))
         {
             m_AssetTableCollections.Remove(assetTableCollection);
             m_GuidToCollection = null; // Clear cache
         }
     }
     else
     {
         throw new System.Exception("Unhandled collection type: " + collection.GetType());
     }
 }
        protected virtual void AddToCache(LocalizedTableCollection collection)
        {
            var validState = collection.IsValid;

            if (!validState.valid)
            {
                Debug.LogWarning($"Collection {collection.name} is invalid and will be ignored because {validState.error}.");
                return;
            }

            if (collection is StringTableCollection stringTableCollection)
            {
                if (m_StringTableCollections != null && !m_StringTableCollections.Contains(stringTableCollection))
                {
                    m_StringTableCollections.Add(stringTableCollection);
                    if (m_GuidToCollection != null)
                    {
                        CacheDependencies(stringTableCollection);
                    }
                }
            }
            else if (collection is AssetTableCollection assetTableCollection)
            {
                if (m_AssetTableCollections != null && !m_AssetTableCollections.Contains(assetTableCollection))
                {
                    m_AssetTableCollections.Add(assetTableCollection);
                    if (m_GuidToCollection != null)
                    {
                        CacheDependencies(assetTableCollection);
                    }
                }
            }
            else
            {
                throw new System.Exception("Unhandled collection type: " + collection.GetType());
            }
        }
示例#5
0
 internal void Init(LocalizedTableCollection target)
 {
     m_Collection = target;
 }
示例#6
0
 internal virtual void RaiseTableRemovedFromCollection(LocalizedTableCollection collection, LocalizedTable table) => TableRemovedFromCollection?.Invoke(collection, table);
示例#7
0
 internal virtual void RaiseTableAddedToCollection(LocalizedTableCollection collection, LocalizedTable table) => TableAddedToCollection?.Invoke(collection, table);
示例#8
0
 internal virtual void RaiseCollectionRemoved(LocalizedTableCollection collection) => CollectionRemoved?.Invoke(collection);
示例#9
0
 internal virtual void RaiseCollectionModified(object sender, LocalizedTableCollection collection) => CollectionModified?.Invoke(sender, collection);
示例#10
0
 internal virtual void RaiseTableEntryRemoved(LocalizedTableCollection collection, SharedTableData.SharedTableEntry entry) => TableEntryRemoved?.Invoke(collection, entry);