Ejemplo n.º 1
0
        public bool Push(ref CCDesc.Hit evnt)
        {
            if (this.issuingEvent)
            {
                Debug.LogError("Push during event call back");
                return(false);
            }
            CCDesc.HitFilter onHit = this.OnHit;
            if (onHit != null)
            {
                bool flag = false;
                try
                {
                    try
                    {
                        this.issuingEvent = true;
                        flag = !onHit(this, ref evnt);
                    }
                    catch (Exception exception)
                    {
                        Debug.LogException(exception);
                    }
                }
                finally
                {
                    this.issuingEvent = false;
                }
                if (flag)
                {
                    return(false);
                }
            }
            CCDesc.HitManager hitManager = this;
            int num  = hitManager.filledCount;
            int num1 = num;

            hitManager.filledCount = num + 1;
            int num2 = num1;

            if (this.filledCount > this.bufferSize)
            {
                do
                {
                    CCDesc.HitManager hitManager1 = this;
                    hitManager1.bufferSize = hitManager1.bufferSize + 8;
                }while (this.filledCount > this.bufferSize);
                if (this.filledCount <= 1)
                {
                    this.buffer = new CCDesc.Hit[this.bufferSize];
                }
                else
                {
                    CCDesc.Hit[] hitArray = this.buffer;
                    this.buffer = new CCDesc.Hit[this.bufferSize];
                    Array.Copy(hitArray, this.buffer, this.filledCount - 1);
                }
            }
            this.buffer[num2] = evnt;
            return(true);
        }
Ejemplo n.º 2
0
        public bool Push(ref CCDesc.Hit evnt)
        {
            if (this.issuingEvent)
            {
                Debug.LogError("Push during event call back");
                return(false);
            }
            CCDesc.HitFilter onHit = this.OnHit;
            if (onHit != null)
            {
                bool flag = false;
                try
                {
                    this.issuingEvent = true;
                    flag = !onHit(this, ref evnt);
                }
                catch (Exception exception)
                {
                    Debug.LogException(exception);
                }
                finally
                {
                    this.issuingEvent = false;
                }
                if (flag)
                {
                    return(false);
                }
            }
            int index = this.filledCount++;

            if (this.filledCount > this.bufferSize)
            {
                do
                {
                    this.bufferSize += 8;
                }while (this.filledCount > this.bufferSize);
                if (this.filledCount > 1)
                {
                    CCDesc.Hit[] buffer = this.buffer;
                    this.buffer = new CCDesc.Hit[this.bufferSize];
                    Array.Copy(buffer, this.buffer, (int)(this.filledCount - 1));
                }
                else
                {
                    this.buffer = new CCDesc.Hit[this.bufferSize];
                }
            }
            this.buffer[index] = evnt;
            return(true);
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     this.buffer = null;
     this.OnHit  = null;
 }