public void WriteTo(object obj, Dictionary <long, UnityObject> objects)
        {
            if (obj == null)
            {
                return;
            }
            Initialize(obj.GetType());

            TypeName = obj.GetType().AssemblyQualifiedName;

            if (m_Arguments != null)
            {
                object arguments = Activator.CreateInstance(m_argumentsFieldInfo.FieldType);
                m_Arguments.WriteTo(arguments, objects);
                m_argumentsFieldInfo.SetValue(obj, arguments);
            }

            m_callStatFieldInfo.SetValue(obj, m_CallState);
            m_methodNameFieldInfo.SetValue(obj, m_MethodName);
            m_modeFieldInfo.SetValue(obj, m_Mode);
            m_targetFieldInfo.SetValue(obj, objects.Get(m_Target));
        }
Ejemplo n.º 2
0
        protected override object WriteToImpl(object obj)
        {
            obj = base.WriteToImpl(obj);
            if (obj == null)
            {
                return(obj);
            }

            Initialize(obj.GetType());
            TypeName = obj.GetType().AssemblyQualifiedName;

            if (m_Arguments != null)
            {
                object arguments = Activator.CreateInstance(m_argumentsFieldInfo.FieldType);
                m_Arguments.WriteTo(arguments);
                m_argumentsFieldInfo.SetValue(obj, arguments);
            }

            m_callStatFieldInfo.SetValue(obj, m_CallState);
            m_methodNameFieldInfo.SetValue(obj, m_MethodName);
            m_modeFieldInfo.SetValue(obj, m_Mode);
            m_targetFieldInfo.SetValue(obj, FromID(m_Target, m_targetFieldInfo.GetValue(obj) as UnityObject));
            return(obj);
        }