public void Process(int _curTime)
        {
            this.preExcuteTime = this.curTime;
            this.curTime       = _curTime;
            int num = 0;

            if (!this.LocateEvent(_curTime, out num) || num < 0)
            {
                return;
            }
            int length = this.Length;

            if (_curTime >= length)
            {
                num = this.trackEvents.get_Count() - 1;
            }
            int num2 = num - 1;

            if (num2 < 0)
            {
                num2 = 0;
            }
            int num3 = num + 1;

            if (num3 >= this.trackEvents.get_Count())
            {
                num3 = num;
            }
            if (this.isDurationEvent)
            {
                for (int i = num2; i < this.trackEvents.get_Count(); i++)
                {
                    DurationEvent durationEvent = this.trackEvents.get_Item(i) as DurationEvent;
                    if (this.CheckSkip(_curTime, durationEvent.Start) && durationEvent.CheckConditions(this.action))
                    {
                        if (this.activeEvents.get_Count() == 0)
                        {
                            durationEvent.Enter(this.action, this);
                        }
                        else
                        {
                            DurationEvent durationEvent2 = this.activeEvents.get_Item(0);
                            int           blendTime      = durationEvent2.End - durationEvent.Start;
                            durationEvent.EnterBlend(this.action, this, durationEvent2, blendTime);
                        }
                        this.activeEvents.Add(durationEvent);
                    }
                    if (this.CheckSkip(_curTime, durationEvent.End) && this.activeEvents.Contains(durationEvent))
                    {
                        if (this.activeEvents.get_Count() > 1)
                        {
                            DurationEvent durationEvent3 = this.activeEvents.get_Item(1);
                            int           blendTime2     = durationEvent.End - durationEvent3.Start;
                            durationEvent.LeaveBlend(this.action, this, durationEvent3, blendTime2);
                        }
                        else
                        {
                            durationEvent.Leave(this.action, this);
                        }
                        this.activeEvents.Remove(durationEvent);
                    }
                }
            }
            else
            {
                for (int j = num2; j < this.trackEvents.get_Count(); j++)
                {
                    TickEvent tickEvent = this.trackEvents.get_Item(j) as TickEvent;
                    if (this.CheckSkip(_curTime, tickEvent.time) && tickEvent.CheckConditions(this.action))
                    {
                        tickEvent.Process(this.action, this);
                    }
                }
                if (num != num3)
                {
                    TickEvent tickEvent2  = this.trackEvents.get_Item(num) as TickEvent;
                    TickEvent tickEvent3  = this.trackEvents.get_Item(num3) as TickEvent;
                    float     blendWeight = (float)(_curTime - tickEvent2.time) / (float)(tickEvent3.time - tickEvent2.time);
                    tickEvent3.ProcessBlend(this.action, this, tickEvent2, blendWeight);
                }
                else
                {
                    TickEvent tickEvent4 = this.trackEvents.get_Item(num) as TickEvent;
                    int       localTime  = _curTime - tickEvent4.time;
                    tickEvent4.PostProcess(this.action, this, localTime);
                }
            }
            if (this.activeEvents.get_Count() == 1)
            {
                DurationEvent durationEvent4 = this.activeEvents.get_Item(0);
                int           localTime2;
                if (_curTime >= durationEvent4.Start)
                {
                    localTime2 = _curTime - durationEvent4.Start;
                }
                else
                {
                    localTime2 = _curTime + length - durationEvent4.Start;
                }
                durationEvent4.Process(this.action, this, localTime2);
            }
            else if (this.activeEvents.get_Count() == 2)
            {
                DurationEvent durationEvent5 = this.activeEvents.get_Item(0);
                DurationEvent durationEvent6 = this.activeEvents.get_Item(1);
                if (durationEvent5.Start < durationEvent6.Start && durationEvent5.End < length)
                {
                    int   localTime3    = _curTime - durationEvent6.Start;
                    int   prevLocalTime = _curTime - durationEvent5.Start;
                    float blendWeight2  = (float)(_curTime - durationEvent6.Start) / (float)(durationEvent5.End - durationEvent6.Start);
                    durationEvent6.ProcessBlend(this.action, this, localTime3, durationEvent5, prevLocalTime, blendWeight2);
                }
                else if (durationEvent5.Start < durationEvent6.Start && durationEvent5.End >= length)
                {
                    if (_curTime >= durationEvent6.Start)
                    {
                        int   localTime4     = _curTime - durationEvent6.Start;
                        int   prevLocalTime2 = _curTime - durationEvent5.Start;
                        float blendWeight3   = (float)(_curTime - durationEvent6.Start) / (float)(durationEvent5.End - durationEvent6.Start);
                        durationEvent6.ProcessBlend(this.action, this, localTime4, durationEvent5, prevLocalTime2, blendWeight3);
                    }
                    else
                    {
                        int   localTime5     = _curTime + length - durationEvent6.Start;
                        int   prevLocalTime3 = _curTime + length - durationEvent5.Start;
                        float blendWeight4   = (float)(_curTime + length - durationEvent6.Start) / (float)(durationEvent5.End - durationEvent6.Start);
                        durationEvent6.ProcessBlend(this.action, this, localTime5, durationEvent5, prevLocalTime3, blendWeight4);
                    }
                }
                else
                {
                    int   localTime6     = _curTime - durationEvent6.Start;
                    int   prevLocalTime4 = _curTime + length - durationEvent5.Start;
                    float blendWeight5   = (float)(_curTime - durationEvent6.Start) / (float)(durationEvent5.End - length - durationEvent6.Start);
                    durationEvent6.ProcessBlend(this.action, this, localTime6, durationEvent5, prevLocalTime4, blendWeight5);
                }
            }
        }
Beispiel #2
0
        public void Process(int _curTime)
        {
            this.preExcuteTime = this.curTime;
            this.curTime       = _curTime;
            int num = 0;

            if (this.LocateEvent(_curTime, out num) && (num >= 0))
            {
                int length = this.Length;
                if ((_curTime >= length) && !this.Loop)
                {
                    num = this.trackEvents.Count - 1;
                }
                if (this.Loop)
                {
                    int num3 = ((num - 1) + this.trackEvents.Count) % this.trackEvents.Count;
                    int num4 = ((num + 1) + this.trackEvents.Count) % this.trackEvents.Count;
                    if (this.isDurationEvent)
                    {
                        int num5 = num3;
                        for (int i = 0; i < this.trackEvents.Count; i++)
                        {
                            DurationEvent item = this.trackEvents[num5] as DurationEvent;
                            if (this.CheckSkip(_curTime, item.Start) && item.CheckConditions(this.action))
                            {
                                if (this.activeEvents.Count == 0)
                                {
                                    item.Enter(this.action, this);
                                }
                                else
                                {
                                    DurationEvent event3 = this.activeEvents[0];
                                    if ((event3.Start < item.Start) && (event3.End < length))
                                    {
                                        int num7 = event3.End - item.Start;
                                        item.EnterBlend(this.action, this, event3, num7);
                                    }
                                    else if ((event3.Start < item.Start) && (event3.End >= length))
                                    {
                                        int num8 = event3.End - item.Start;
                                        item.EnterBlend(this.action, this, event3, num8);
                                    }
                                    else
                                    {
                                        int num9 = (event3.End - length) - item.Start;
                                        item.EnterBlend(this.action, this, event3, num9);
                                    }
                                }
                                this.activeEvents.Add(item);
                            }
                            if (this.CheckSkip(_curTime, item.End) && this.activeEvents.Contains(item))
                            {
                                item.Leave(this.action, this);
                                this.activeEvents.Remove(item);
                            }
                            num5 = (num5 + 1) % this.trackEvents.Count;
                        }
                    }
                    else
                    {
                        int num10 = num3;
                        for (int j = 0; j < this.trackEvents.Count; j++)
                        {
                            TickEvent event4 = this.trackEvents[num10] as TickEvent;
                            if (this.CheckSkip(_curTime, event4.time) && event4.CheckConditions(this.action))
                            {
                                event4.Process(this.action, this);
                            }
                            num10 = (num10 + 1) % this.trackEvents.Count;
                        }
                        if (num != num4)
                        {
                            TickEvent event5 = this.trackEvents[num] as TickEvent;
                            TickEvent event6 = this.trackEvents[num4] as TickEvent;
                            if (event6.time > event5.time)
                            {
                                float num12 = ((float)(_curTime - event5.time)) / ((float)(event6.time - event5.time));
                                event6.ProcessBlend(this.action, this, event5, num12);
                            }
                            else if (event6.time < event5.time)
                            {
                                if (_curTime >= event5.time)
                                {
                                    float num13 = ((float)(_curTime - event5.time)) / ((float)((event6.time + length) - event5.time));
                                    event6.ProcessBlend(this.action, this, event5, num13);
                                }
                                else
                                {
                                    float num14 = ((float)((_curTime + length) - event5.time)) / ((float)((event6.time + length) - event5.time));
                                    event6.ProcessBlend(this.action, this, event5, num14);
                                }
                            }
                        }
                        else
                        {
                            TickEvent event7 = this.trackEvents[num] as TickEvent;
                            if (_curTime > event7.time)
                            {
                                int num15 = _curTime - event7.time;
                                event7.PostProcess(this.action, this, num15);
                            }
                            else if (_curTime < event7.time)
                            {
                                if (_curTime >= event7.time)
                                {
                                    int num16 = _curTime - event7.time;
                                    event7.PostProcess(this.action, this, num16);
                                }
                                else
                                {
                                    int num17 = (_curTime + length) - event7.time;
                                    event7.PostProcess(this.action, this, num17);
                                }
                            }
                        }
                    }
                }
                else
                {
                    int num18 = num - 1;
                    if (num18 < 0)
                    {
                        num18 = 0;
                    }
                    int num19 = num + 1;
                    if (num19 >= this.trackEvents.Count)
                    {
                        num19 = num;
                    }
                    if (this.isDurationEvent)
                    {
                        for (int k = num18; k < this.trackEvents.Count; k++)
                        {
                            DurationEvent event8 = this.trackEvents[k] as DurationEvent;
                            if (this.CheckSkip(_curTime, event8.Start) && event8.CheckConditions(this.action))
                            {
                                if (this.activeEvents.Count == 0)
                                {
                                    event8.Enter(this.action, this);
                                }
                                else
                                {
                                    DurationEvent event9 = this.activeEvents[0];
                                    int           num21  = event9.End - event8.Start;
                                    event8.EnterBlend(this.action, this, event9, num21);
                                }
                                this.activeEvents.Add(event8);
                            }
                            if (this.CheckSkip(_curTime, event8.End) && this.activeEvents.Contains(event8))
                            {
                                if (this.activeEvents.Count > 1)
                                {
                                    DurationEvent event10 = this.activeEvents[1];
                                    int           num22   = event8.End - event10.Start;
                                    event8.LeaveBlend(this.action, this, event10, num22);
                                }
                                else
                                {
                                    event8.Leave(this.action, this);
                                }
                                this.activeEvents.Remove(event8);
                            }
                        }
                    }
                    else
                    {
                        for (int m = num18; m < this.trackEvents.Count; m++)
                        {
                            TickEvent event11 = this.trackEvents[m] as TickEvent;
                            if (this.CheckSkip(_curTime, event11.time) && event11.CheckConditions(this.action))
                            {
                                event11.Process(this.action, this);
                            }
                        }
                        if (num != num19)
                        {
                            TickEvent event12 = this.trackEvents[num] as TickEvent;
                            TickEvent event13 = this.trackEvents[num19] as TickEvent;
                            float     num24   = ((float)(_curTime - event12.time)) / ((float)(event13.time - event12.time));
                            event13.ProcessBlend(this.action, this, event12, num24);
                        }
                        else
                        {
                            TickEvent event14 = this.trackEvents[num] as TickEvent;
                            int       num25   = _curTime - event14.time;
                            event14.PostProcess(this.action, this, num25);
                        }
                    }
                }
                if (this.activeEvents.Count == 1)
                {
                    DurationEvent event15 = this.activeEvents[0];
                    int           num26   = 0;
                    if (_curTime >= event15.Start)
                    {
                        num26 = _curTime - event15.Start;
                    }
                    else
                    {
                        num26 = (_curTime + length) - event15.Start;
                    }
                    event15.Process(this.action, this, num26);
                }
                else if (this.activeEvents.Count == 2)
                {
                    DurationEvent event16 = this.activeEvents[0];
                    DurationEvent event17 = this.activeEvents[1];
                    if ((event16.Start < event17.Start) && (event16.End < length))
                    {
                        int   num27 = _curTime - event17.Start;
                        int   num28 = _curTime - event16.Start;
                        float num29 = ((float)(_curTime - event17.Start)) / ((float)(event16.End - event17.Start));
                        event17.ProcessBlend(this.action, this, num27, event16, num28, num29);
                    }
                    else if ((event16.Start < event17.Start) && (event16.End >= length))
                    {
                        if (_curTime >= event17.Start)
                        {
                            int   num30 = _curTime - event17.Start;
                            int   num31 = _curTime - event16.Start;
                            float num32 = ((float)(_curTime - event17.Start)) / ((float)(event16.End - event17.Start));
                            event17.ProcessBlend(this.action, this, num30, event16, num31, num32);
                        }
                        else
                        {
                            int   num33 = (_curTime + length) - event17.Start;
                            int   num34 = (_curTime + length) - event16.Start;
                            float num35 = ((float)((_curTime + length) - event17.Start)) / ((float)(event16.End - event17.Start));
                            event17.ProcessBlend(this.action, this, num33, event16, num34, num35);
                        }
                    }
                    else
                    {
                        int   num36 = _curTime - event17.Start;
                        int   num37 = (_curTime + length) - event16.Start;
                        float num38 = ((float)(_curTime - event17.Start)) / ((float)((event16.End - length) - event17.Start));
                        event17.ProcessBlend(this.action, this, num36, event16, num37, num38);
                    }
                }
            }
        }