Example #1
0
        private void AddToPipe(object obj)
        {
            if (PipelineProcessor != null)
            {
                // Put the pipeline on the notification stack for stop.
                _context.PushPipelineProcessor(PipelineProcessor);
                PipelineProcessor.Step(obj);
                _context.PopPipelineProcessor(false);
            }
            else if (_resultCollection != null)
            {
                _resultCollection.Add(obj != null ? PSObject.AsPSObject(obj) : null);
            }
            else if (_resultList != null)
            {
                _resultList.Add(obj);
            }
            else if (_externalWriter != null)
            {
                _externalWriter.Write(obj);
            }
            else if (ObjectQueue != null)
            {
                ObjectQueue.Enqueue(obj);

                // This is the "streamlet" recursive call
                if (_downstreamCmdlet != null && ObjectQueue.Count > OutBufferCount)
                {
                    _downstreamCmdlet.DoExecute();
                }
            }
        }
        protected virtual void DequeueCrossOrder(SpriteRenderer SR)
        {
            int MoveDir = 0;

            switch (MoveDirection)
            {
            case EDirection.LEFT:
                if (SR.transform.position.x <= LeftBorderX)
                {
                    MoveDir = -1;
                }
                break;

            case EDirection.RIGHT:
                if (SR.transform.position.x >= RightBorderX)
                {
                    MoveDir = 1;
                }
                break;
            }
            float SpriteWidth = SR.sprite.bounds.size.x;

            SpriteWidth *= SR.transform.localScale.x;
            Vector3 PosDelta = new Vector3(1, 0, 0) * SpriteWidth * (ObjectQueue.Count) * (-MoveDir);

            SR.transform.position += PosDelta;
            ObjectQueue.Dequeue();
            ObjectQueue.Enqueue(SR);
        }
Example #3
0
 public void CanQueueOneObject()
 {
     queue.Enqueue(new TestObject()
     {
         ID              = 1,
         Name            = "Object 1",
         IgnoredProperty = "Not available!"
     });
 }
Example #4
0
        /// <summary>
        /// 将对象放入池中,并且重置其数据;
        /// </summary>
        public void Release(T item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (IsFull)
            {
                Destroy(item);
            }
            else
            {
                ResetWhenEnterPool(item);
                ObjectQueue.Enqueue(item);
            }
        }