Ejemplo n.º 1
0
        public int Exec(float tick    = 0,
                        Matrix matrix = null, ColorTransform colorTransform = null)
        {
            bool  execed          = false;
            float currentProgress = m_progress;

            if (m_execDisabled && tweens == null)
            {
                if (!m_executedForExecDisabled)
                {
                    ++m_execCount;
                    m_rootMovie.Exec();
                    m_rootMovie.PostExec(true);
                    m_executedForExecDisabled = true;
                    execed = true;
                }
            }
            else
            {
                bool progressing = true;
                m_thisTick = tick;
                if (tick == 0)
                {
                    m_progress = m_tick;
                }
                else if (tick < 0)
                {
                    m_progress  = m_tick;
                    progressing = false;
                }
                else
                {
                    if (m_time == 0)
                    {
                        m_time     += (double)m_tick;
                        m_progress += m_tick;
                    }
                    else
                    {
                        m_time     += (double)tick;
                        m_progress += tick;
                    }
                }

                if (m_execHandlers != null)
                {
                    m_execHandlers.ForEach(h => h(this));
                }

                int execLimit = m_execLimit;
                while (m_progress >= m_tick - m_roundOffTick)
                {
                    if (--execLimit < 0)
                    {
                        m_progress = 0;
                        break;
                    }
                    m_progress -= m_tick;
                    ++m_execCount;
                    m_rootMovie.Exec();
                    m_rootMovie.PostExec(progressing);
                    execed = true;
                }

                if (m_progress < m_roundOffTick)
                {
                    m_progress = 0;
                }

                m_buttonHead = null;
                if (interactive && m_rootMovie.hasButton)
                {
                    m_rootMovie.LinkButton();
                }
            }

            if (execed || isLWFAttached ||
                isPropertyDirty || matrix != null || colorTransform != null)
            {
                Update(matrix, colorTransform);
            }

            if (!m_execDisabled)
            {
                if (tick < 0)
                {
                    m_progress = currentProgress;
                }
            }

            return(m_renderingCount);
        }