Esempio n. 1
0
        private static AssetReference GetReference(string relativePath, CreateReference creator)
        {
            AssetReferenceDatabase db = GetDatabase();

            if (db.m_dictionary.ContainsKey(relativePath))
            {
                return(db.m_dictionary[relativePath]);
            }
            else
            {
                try {
                    AssetReference r = creator();
                    db.m_assets.Add(r);
                    db.m_dictionary.Add(relativePath, r);
                    AssetReferenceDatabase.SetDBDirty();
                    return(r);
                } catch (AssetReferenceException) {
                    // if give asset is invalid, return null
                    return(null);
                }
            }
        }
Esempio n. 2
0
        private static AssetReference GetReference(string relativePath, CreateReference creator)
        {
            AssetReferenceDatabase db = GetDatabase();

            if (db.m_dictionary.ContainsKey(relativePath))
            {
                return(db.m_dictionary[relativePath]);
            }
            else
            {
                try {
                    AssetReference r = creator();
                    db.m_assets.Add(r);
                    db.m_dictionary.Add(relativePath, r);
                    AssetReferenceDatabase.SetDBDirty();
                    return(r);
                } catch (AssetReferenceException e) {
                    LogUtility.Logger.LogWarning(LogUtility.kTag,
                                                 $"AssetReference could not be created: Asset:{e.importFrom} Message:{e.Message}");
                    // if give asset is invalid, return null
                    return(null);
                }
            }
        }
Esempio n. 3
0
 private static IEnumerable <MapObject> SelectSelfAndChildren(CreateReference reference)
 => SelectSelfAndChildren(reference.MapObject);