public LocalizedAssetRefTreeViewItem(AssetTableCollection table, string key, int id, int depth) :
     base(id, depth)
 {
     Table       = table;
     Key         = key;
     displayName = Key;
 }
 void ShowTableEditor(AssetTableCollection tableCollection)
 {
     if (m_ActiveTableEditor != null)
     {
         m_EditTableContainer.Remove(m_ActiveTableEditor);
     }
     m_ActiveTableEditor = tableCollection.TableEditor.CreateInspectorGUI();
     m_EditTableContainer.Add(m_ActiveTableEditor);
     m_ActiveTableEditor.StretchToParentSize();
 }
Пример #3
0
        protected virtual List <AssetTableCollection> GetAssetTablesInternal <TLocalizedTable>() where TLocalizedTable : LocalizedTable
        {
            var foundTables = new List <AssetTableCollection>();

            // Find all Table assets and their associated editors
            var tableAssets = AssetDatabase.FindAssets("t:" + typeof(TLocalizedTable).Name);

            // Collate by type and table name
            var typeLookup = new Dictionary <Type, Dictionary <string, AssetTableCollection> >();

            foreach (var taGuid in tableAssets)
            {
                string path           = AssetDatabase.GUIDToAssetPath(taGuid);
                var    localizedTable = AssetDatabase.LoadAssetAtPath <TLocalizedTable>(path);
                Debug.Assert(localizedTable != null);

                Dictionary <string, AssetTableCollection> nameLookup;
                AssetTableCollection tableCollection;
                if (typeLookup.TryGetValue(localizedTable.GetType(), out nameLookup))
                {
                    if (!nameLookup.TryGetValue(localizedTable.TableName, out tableCollection))
                    {
                        tableCollection = new AssetTableCollection()
                        {
                            TableType = localizedTable.GetType()
                        };
                        foundTables.Add(tableCollection);
                        nameLookup[localizedTable.TableName] = tableCollection;
                    }
                }
                else
                {
                    tableCollection = new AssetTableCollection()
                    {
                        TableType = localizedTable.GetType()
                    };
                    foundTables.Add(tableCollection);

                    nameLookup = new Dictionary <string, AssetTableCollection>();
                    nameLookup[localizedTable.TableName] = tableCollection;
                    typeLookup[localizedTable.GetType()] = nameLookup;
                }

                // Add to table
                tableCollection.Tables.Add(localizedTable);
            }
            return(foundTables);
        }
Пример #4
0
 internal virtual void RaiseAssetTableEntryRemoved(AssetTableCollection collection, AssetTable table, AssetTableEntry entry, string assetGuid) => AssetTableEntryRemoved?.Invoke(collection, table, entry, assetGuid);
Пример #5
0
 internal virtual void RaiseAssetTableEntryAdded(AssetTableCollection collection, AssetTable table, AssetTableEntry entry) => AssetTableEntryAdded?.Invoke(collection, table, entry);