Esempio n. 1
0
        public void Write(SerializedWriter writer)
        {
            if (HasScriptTypeIndex(writer.Generation))
            {
                writer.Write((int)TypeID);
            }
            else
            {
                writer.Write(OriginalTypeID);
            }
            if (HasIsStrippedType(writer.Generation))
            {
                writer.Write(IsStrippedType);
            }
            if (HasScriptTypeIndex(writer.Generation))
            {
                writer.Write(ScriptTypeIndex);
            }

            if (HasHash(writer.Generation))
            {
                if (TypeID == ClassIDType.MonoBehaviour)
                {
                    ScriptID.Write(writer);
                }
                OldTypeHash.Write(writer);
            }

            if (OldType != null)
            {
                OldType.Write(writer);
                if (HasTypeDependencies(writer.Generation))
                {
                    writer.WriteArray(TypeDependencies);
                }
            }
        }
Esempio n. 2
0
        public void Read(SerializedReader reader)
        {
            if (HasScriptTypeIndex(reader.Generation))
            {
                TypeID = (ClassIDType)reader.ReadInt32();
            }
            else
            {
                OriginalTypeID = reader.ReadInt32();
            }
            if (HasIsStrippedType(reader.Generation))
            {
                IsStrippedType = reader.ReadBoolean();
            }
            if (HasScriptTypeIndex(reader.Generation))
            {
                ScriptTypeIndex = reader.ReadInt16();
            }

            if (HasHash(reader.Generation))
            {
                if (TypeID == ClassIDType.MonoBehaviour)
                {
                    ScriptID.Read(reader);
                }
                OldTypeHash.Read(reader);
            }

            if (OldType != null)
            {
                OldType.Read(reader);
                if (HasTypeDependencies(reader.Generation))
                {
                    TypeDependencies = reader.ReadInt32Array();
                }
            }
        }