Ejemplo n.º 1
0
        public void PoolLists()
        {
            if (enumerableRoot != null)
            {
                enumerableRoot.PoolLists();
                enumerableRoot = null;
            }

            if (variables != null)
            {
                for (int i = 0; i < variables.Count; i++)
                {
                    variables[i].PoolLists();
                }

                pool.Push(variables);

                variables.Clear();
                variables = null;
            }
        }
Ejemplo n.º 2
0
        public virtual void Refresh()
        {
            if (m_isExpanded)
            {
                Type prevType = Obj != null?Obj.GetType() : null;

                Obj = Getter.Get(parent != null ? parent.Obj : null);

                if (Obj == null || Obj.Equals(null))
                {
                    PoolLists();
                }
                else
                {
                    if (Obj.GetType() != prevType)
                    {
                        PoolLists();
                    }

                    // Cache ToString() values of primitives since they won't change until next Refresh
                    primitiveValue = Obj.GetType().IsPrimitiveUnityType() ? Obj.ToString() : null;

                    if (Obj is IEnumerable && !(Obj is Transform))
                    {
                        if (enumerableRoot == null)
                        {
                            enumerableRoot = new DebugModeEnumerableEntry(this)
                            {
                                Getter = new VariableGetterHolder("(IEnumerable) Elements", null)
                            }
                        }
                        ;

                        enumerableRoot.Refresh();
                    }
                    else if (enumerableRoot != null)
                    {
                        enumerableRoot.PoolLists();
                        enumerableRoot = null;
                    }

                    if (variables == null)
                    {
                        VariableGetterHolder[] childGetters = Utilities.GetFilteredVariablesForType(Obj.GetType());
                        variables = PopList(childGetters.Length);
                        for (int i = 0; i < childGetters.Length; i++)
                        {
                            variables.Add(new DebugModeEntry(this)
                            {
                                Getter = childGetters[i]
                            });
                        }
                    }

                    for (int i = 0; i < variables.Count; i++)
                    {
                        variables[i].Refresh();
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public EnumerableValueGetter(DebugModeEnumerableEntry entry, int index)
 {
     this.entry = entry;
     this.index = index;
 }