Example #1
0
        protected override void ReadFromImpl(object obj)
        {
            base.ReadFromImpl(obj);
            if (obj == null)
            {
                return;
            }

            object persistentCalls = m_persistentCallGroupInfo.GetValue(obj);

            if (persistentCalls == null)
            {
                return;
            }

            object calls = m_callsInfo.GetValue(persistentCalls);

            if (calls == null)
            {
                return;
            }

            IList list = (IList)calls;

            m_calls = new PersistentPersistentCall[list.Count];
            for (int i = 0; i < list.Count; ++i)
            {
                object call = list[i];
                PersistentPersistentCall persistentCall = new PersistentPersistentCall();
                persistentCall.ReadFrom(call);
                m_calls[i] = persistentCall;
            }
        }
Example #2
0
        protected override void GetDepsFromImpl(object obj, GetDepsFromContext context)
        {
            base.GetDepsFromImpl(obj, context);
            if (obj == null)
            {
                return;
            }

            object persistentCalls = m_persistentCallGroupInfo.GetValue(obj);

            if (persistentCalls == null)
            {
                return;
            }

            object calls = m_callsInfo.GetValue(persistentCalls);

            if (calls == null)
            {
                return;
            }

            IList list = (IList)calls;

            for (int i = 0; i < list.Count; ++i)
            {
                object call = list[i];
                PersistentPersistentCall persistentCall = new PersistentPersistentCall();
                persistentCall.GetDepsFrom(call, context);
            }
        }
        public void WriteTo(UnityEventBase obj, Dictionary <long, UnityObject> objects, IIDMap idMap)
        {
            if (obj == null)
            {
                return;
            }

            if (m_calls == null)
            {
                return;
            }

            object persistentCalls = Activator.CreateInstance(m_persistentCallGroupInfo.FieldType);
            object calls           = Activator.CreateInstance(m_callsInfo.FieldType);

            IList list = (IList)calls;

            for (int i = 0; i < m_calls.Length; ++i)
            {
                PersistentPersistentCall persistentCall = m_calls[i];
                if (persistentCall != null)
                {
                    object call = Activator.CreateInstance(m_callType);
                    persistentCall.WriteTo(call, objects);
                    list.Add(call);
                }
                else
                {
                    list.Add(null);
                }
            }
            m_callsInfo.SetValue(persistentCalls, calls);
            m_persistentCallGroupInfo.SetValue(obj, persistentCalls);
        }
        public void GetDependencies(UnityEventBase obj, Dictionary <long, UnityObject> dependencies, IIDMap idMap)
        {
            if (obj == null)
            {
                return;
            }

            object persistentCalls = m_persistentCallGroupInfo.GetValue(obj);

            if (persistentCalls == null)
            {
                return;
            }

            object calls = m_callsInfo.GetValue(persistentCalls);

            if (calls == null)
            {
                return;
            }

            IList list = (IList)calls;

            for (int i = 0; i < list.Count; ++i)
            {
                object call = list[i];
                PersistentPersistentCall persistentCall = new PersistentPersistentCall();
                persistentCall.GetDependencies(call, dependencies, idMap);
            }
        }
        public void ReadFrom(UnityEventBase obj, IIDMap idMap)
        {
            if (obj == null)
            {
                return;
            }

            object persistentCalls = m_persistentCallGroupInfo.GetValue(obj);

            if (persistentCalls == null)
            {
                return;
            }

            object calls = m_callsInfo.GetValue(persistentCalls);

            if (calls == null)
            {
                return;
            }

            IList list = (IList)calls;

            m_calls = new PersistentPersistentCall[list.Count];
            for (int i = 0; i < list.Count; ++i)
            {
                object call = list[i];
                PersistentPersistentCall persistentCall = new PersistentPersistentCall();
                persistentCall.ReadFrom(call, idMap);
                m_calls[i] = persistentCall;
            }
        }
        public void FindDependencies <T>(Dictionary <long, T> dependencies, Dictionary <long, T> objects, bool allowNulls)
        {
            if (m_calls == null)
            {
                return;
            }

            for (int i = 0; i < m_calls.Length; ++i)
            {
                PersistentPersistentCall persistentCall = m_calls[i];
                if (persistentCall != null)
                {
                    persistentCall.FindDependencies(dependencies, objects, allowNulls);
                }
            }
        }
Example #7
0
        protected override void GetDepsImpl(GetDepsContext context)
        {
            base.GetDepsImpl(context);
            if (m_calls == null)
            {
                return;
            }

            for (int i = 0; i < m_calls.Length; ++i)
            {
                PersistentPersistentCall persistentCall = m_calls[i];
                if (persistentCall != null)
                {
                    persistentCall.GetDeps(context);
                }
            }
        }
Example #8
0
        protected override object WriteToImpl(object obj)
        {
            obj = base.WriteToImpl(obj);
            if (obj == null)
            {
                return(null);
            }

            if (m_calls == null)
            {
                return(obj);
            }

            object persistentCalls = Activator.CreateInstance(m_persistentCallGroupInfo.FieldType);
            object calls           = Activator.CreateInstance(m_callsInfo.FieldType);

            IList list = (IList)calls;

            for (int i = 0; i < m_calls.Length; ++i)
            {
                PersistentPersistentCall persistentCall = m_calls[i];
                if (persistentCall != null)
                {
                    object call = Activator.CreateInstance(m_callType);
                    persistentCall.WriteTo(call);
                    list.Add(call);
                }
                else
                {
                    list.Add(null);
                }
            }
            m_callsInfo.SetValue(persistentCalls, calls);
            m_persistentCallGroupInfo.SetValue(obj, persistentCalls);
            return(obj);
        }