예제 #1
0
        public void Recycle(Object obj)
        {
            Type           type = obj.GetType();
            ComponentQueue queue;

            if (!this.dictionary.TryGetValue(type, out queue))
            {
                queue = new ComponentQueue(type.Name);

#if UNITY_EDITOR
                if (queue.ViewGO != null)
                {
                    queue.ViewGO.transform.SetParent(this.ViewGO.transform);
                    queue.ViewGO.name = $"{type.Name}s";
                }
#endif
                this.dictionary.Add(type, queue);
            }

#if UNITY_EDITOR
            if (obj.ViewGO != null)
            {
                obj.ViewGO.transform.SetParent(queue.ViewGO.transform);
            }
#endif
            queue.Enqueue(obj);
        }
예제 #2
0
        public void Recycle(Component obj)
        {
            obj.Parent = this;
            Type           type = obj.GetType();
            ComponentQueue queue;

            if (!this.dictionary.TryGetValue(type, out queue))
            {
                queue        = new ComponentQueue(type.Name);
                queue.Parent = this;
                this.dictionary.Add(type, queue);
            }
            queue.Enqueue(obj);
        }
예제 #3
0
        public void Recycle(Component obj)
        {
            obj.Parent = this;
            Type           type = obj.GetType();
            ComponentQueue queue;

            if (!this.dictionary.TryGetValue(type, out queue))
            {
                queue        = new ComponentQueue(type.Name);
                queue.Parent = this;
#if !SERVER
                queue.GameObject.name = type.Name;
#endif
                this.dictionary.Add(type, queue);
            }
            queue.Enqueue(obj);
        }