예제 #1
0
 public void TransitionOn(MenuManager.MenuTransitionType transitionType, TransitionDir dir = TransitionDir.Left, TransitionCallbackDelegate callback = null, float speed = 600.0f)
 {
     //this.speed = 600.0f;
     this.transitionType = transitionType;
     this.callback = callback;
     TransitionOnInternal(dir);
 }
        /// <summary>
        /// Helper for updating the screen transition progress.
        /// </summary>
        /// <param name="gameTime">Current snapshot of timing values.</param>
        /// <param name="transitionDir">Direction of transition, either On or Off.</param>
        /// <returns>True when the transition is complete; false otherwise.</returns>
        private bool UpdateTransition(GameTime gameTime, TransitionDir transitionDir)
        {
            int direction = (int)transitionDir;

            Debug.Assert(direction == 1 || direction == -1);
            Debug.Assert(transitionProgress >= 0 && transitionProgress <= 1);
            Debug.Assert(screenState == ScreenState.TransitionOn || screenState == ScreenState.TransitionOff);

            TimeSpan transitionTime = (direction == 1 ? transitionOnTime : transitionOffTime);

            // Find the amount of transition to do during this frame.
            float transitionDelta;

            if (transitionTime == TimeSpan.Zero)
            {
                transitionDelta = 1;
            }
            else
            {
                transitionDelta = (float)(Time.ElapsedTimeInMilliseconds(gameTime) / transitionTime.TotalMilliseconds);
            }

            // Update the transition progess.
            transitionProgress += transitionDelta * direction;

            // Check to see if we're done transitioning.
            if ((direction == 1 && transitionProgress >= 1) || (direction == -1 && transitionProgress <= 0))
            {
                transitionProgress = MathHelper.Clamp(transitionProgress, 0, 1);
                return(true);
            }

            // Still transitioning.
            return(false);
        }
예제 #3
0
    public void TransitionOffInternal(TransitionDir dir)
    {
        Vector3 pos = panel.position;
        pos.x = OnX;

        currentDir = dir;

        state = MenuTransitionState.tOff;
    }
예제 #4
0
 public void TransitionOffInternal(TransitionDir dir)
 {
     if (transitionType == MenuManager.MenuTransitionType.Instant)
     {
         TransitionOffFinished();
     }
     else
     {
         // todo: handle other transitions
     }
 }
예제 #5
0
 public void TransitionOnInternal(TransitionDir dir)
 {
     gameObject.SetActive(true);
     if (transitionType == MenuManager.MenuTransitionType.Instant)
     {
         TransitionOnFinished();
     }
     else
     {
         // todo: handle other transitions  
     }
 }
예제 #6
0
    public void TransitionOnInternal(TransitionDir dir)
    {
        gameObject.SetActive(true);

        Vector3 pos = panel.position;
        pos.x = leftOffX;

        pos.x = dirOnXs[(int)dir];

        currentDir = dir;
        panel.position = pos;

        state = MenuTransitionState.tOn;
    }
        /// <summary>
        /// Helper for updating the screen transition progress.
        /// </summary>
        /// <param name="gameTime">Current snapshot of timing values.</param>
        /// <param name="transitionDir">Direction of transition, either On or Off.</param>
        /// <returns>True when the transition is complete; false otherwise.</returns>
        private bool UpdateTransition(GameTime gameTime, TransitionDir transitionDir)
        {
            int direction = (int)transitionDir;

            Debug.Assert(direction == 1 || direction == -1);
            Debug.Assert(transitionProgress >= 0 && transitionProgress <= 1);
            Debug.Assert(screenState == ScreenState.TransitionOn || screenState == ScreenState.TransitionOff);

            TimeSpan transitionTime = (direction == 1 ? transitionOnTime : transitionOffTime);

            // Find the amount of transition to do during this frame.
            float transitionDelta;
            if (transitionTime == TimeSpan.Zero)
                transitionDelta = 1;
            else
                transitionDelta = (float)(Time.ElapsedTimeInMilliseconds(gameTime) / transitionTime.TotalMilliseconds);

            // Update the transition progess.
            transitionProgress += transitionDelta * direction;

            // Check to see if we're done transitioning.
            if ((direction == 1 && transitionProgress >= 1) || (direction == -1 && transitionProgress <= 0))
            {
                transitionProgress = MathHelper.Clamp(transitionProgress, 0, 1);
                return true;
            }

            // Still transitioning.
            return false;
        }
예제 #8
0
 public void TransitionOff(TransitionDir dir, TransitionCallbackDelegate callback)
 {
     this.callback = callback;
     TransitionOffInternal(dir);
 }
예제 #9
0
 public void TransitionOff(TransitionDir dir)
 {
     TransitionOffInternal(dir);
 }
예제 #10
0
 public void TransitionOn(TransitionDir dir)
 {
     TransitionOnInternal(dir);
 }