예제 #1
0
        public virtual void WriteObject(SerializeData staticSerializeData, object value)
        {
            if (!staticSerializeData.UseObjectInfo || !base.UseObjectInfos)
            {
                staticSerializeData.Write(this, value);
                return;
            }
            if (value == null)
            {
                WriteObjectInfo(0, isReference: true, null);
                return;
            }
            if (m_idByObject.TryGetValue(value, out int value2))
            {
                WriteObjectInfo(value2, isReference: true, null);
                return;
            }
            value2 = m_nextObjectId++;
            m_idByObject.Add(value, value2);
            Type type = value.GetType();

            if (type == staticSerializeData.Type)
            {
                WriteObjectInfo(value2, isReference: false, null);
                staticSerializeData.Write(this, value);
            }
            else
            {
                SerializeData serializeData = Archive.GetSerializeData(type, allowEmptySerializer: false);
                WriteObjectInfo(value2, isReference: false, type);
                serializeData.Write(this, value);
            }
        }