示例#1
0
 public static void CheckTag(TagRecord _Record, BinaryReader _Reader)
 {
     if (_Reader.BaseStream.Position != _Record.expectedStreamPosition)
     {
         GAFUtils.Error(
             "GAFReader::CloseTag - " +
             "Tag " + _Record.type.ToString() + " " +
             "hasn't been correctly read, tag length is not respected. " +
             "Expected " + _Record.expectedStreamPosition + " " +
             "but actually " + _Reader.BaseStream.Position + " !");
     }
 }
示例#2
0
        public void load()
        {
            lock (m_Locker)
            {
#if UNITY_EDITOR
                if (m_AssetVersion < GAFSystem.AssetVersion &&
                    !EditorApplication.isPlayingOrWillChangePlaymode)
                {
                    upgrade();
                }
#endif // UNITY_EDITOR

                if (m_AssetVersion == GAFSystem.AssetVersion)
                {
                    if (!isLoaded &&
                        m_AssetData != null)
                    {
                        GAFReader reader = new GAFReader();
                        try
                        {
                            reader.Load(m_AssetData, ref m_SharedData);
                        }
                        catch (GAFException _Exception)
                        {
                            GAFUtils.Error(_Exception.Message);

                            m_SharedData = null;
                        }

                        if (isLoaded &&
                            !m_IsExternalDataCollected)
                        {
                            collectExternalData();

#if UNITY_EDITOR
                            if (!EditorApplication.isPlayingOrWillChangePlaymode)
                            {
                                EditorUtility.SetDirty(this);
                            }
#endif // UNITY_EDITOR
                        }
                    }
                }
                else
                {
                    GAFUtils.Log("Asset \"" + name + "\" was not upgraged!", string.Empty);
                }
            }
        }
示例#3
0
    public void load()
    {
        lock (m_Locker)
        {
#if UNITY_EDITOR
            m_GUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(this));

            m_Version = GAFSystem.Version;
#endif // UNITY_EDITOR

            if (!isLoaded)
            {
                if (m_AssetData != null)
                {
                    GAFReader reader = new GAFReader();
                    try
                    {
                        reader.Load(m_AssetData, ref m_SharedData);
                    }
                    catch (GAFException _Exception)
                    {
                        GAFUtils.Error(_Exception.Message);

                        m_SharedData = null;
                    }
                }
            }

            if (isLoaded)
            {
#if UNITY_EDITOR
                if (!m_IsObjectsCollected)
                {
                    initObjectsLists();
                }
#endif // UNITY_EDITOR
            }
        }
    }