Exemplo n.º 1
0
        /// <summary>
        /// Updates the Current Screen or transition
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            if (current == null)
                return;

            // Transition to next screen
            if (transitionOut)
            {
                MediaPlayer.Stop();
                switch (current.TransitionOut)
                {
                    case TransitionType.Instant:
                        transitionOut = false;
                        transitionIn = true;
                        break;
                    case TransitionType.Fade:
                        transOutVariable += ProcessFade(1.0f, gameTime);
                        if (transOutVariable >= 1.0)
                        {
                            transOutVariable = 1.0f;
                            transitionOut = false;
                            transitionIn = true;
                        }
                        break;
                    default:
                        break;
                }

                if (current.ControlTransOut)
                    current.Update(gameTime);
            }
            // Transition from last screen
            else if (transitionIn)
            {
                switch (next.TransitionIn)
                {
                    case TransitionType.Instant:
                        transInVariable = 0.0f;
                        transOutVariable = 0.0f;
                        current = next;
                        break;
                    case TransitionType.Fade:
                        if (transInVariable <= 0.0)
                        {
                            current = next;
                        }
                        transInVariable += ProcessFade(1.0f, gameTime);
                        if (transInVariable >= 1.0)
                        {
                            transInVariable = 1.0f;
                            transitionIn = false;
                        }
                        break;
                    default:
                        transInVariable = 0.0f;
                        transOutVariable = 0.0f;
                        current = next;
                        break;
                }
                if (current.ControlTransIn)
                    current.Update(gameTime);
            }
            // Update current Screen
            else
            {
                current.Update(gameTime);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the Current Screen or transition
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            if (current == null)
            {
                return;
            }

            // Transition to next screen
            if (transitionOut)
            {
                MediaPlayer.Stop();
                switch (current.TransitionOut)
                {
                case TransitionType.Instant:
                    transitionOut = false;
                    transitionIn  = true;
                    break;

                case TransitionType.Fade:
                    transOutVariable += ProcessFade(1.0f, gameTime);
                    if (transOutVariable >= 1.0)
                    {
                        transOutVariable = 1.0f;
                        transitionOut    = false;
                        transitionIn     = true;
                    }
                    break;

                default:
                    break;
                }

                if (current.ControlTransOut)
                {
                    current.Update(gameTime);
                }
            }
            // Transition from last screen
            else if (transitionIn)
            {
                switch (next.TransitionIn)
                {
                case TransitionType.Instant:
                    transInVariable  = 0.0f;
                    transOutVariable = 0.0f;
                    current          = next;
                    break;

                case TransitionType.Fade:
                    if (transInVariable <= 0.0)
                    {
                        current = next;
                    }
                    transInVariable += ProcessFade(1.0f, gameTime);
                    if (transInVariable >= 1.0)
                    {
                        transInVariable = 1.0f;
                        transitionIn    = false;
                    }
                    break;

                default:
                    transInVariable  = 0.0f;
                    transOutVariable = 0.0f;
                    current          = next;
                    break;
                }
                if (current.ControlTransIn)
                {
                    current.Update(gameTime);
                }
            }
            // Update current Screen
            else
            {
                current.Update(gameTime);
            }
        }