Exemplo n.º 1
0
        public virtual void Update(GameTime gameTime)
        {
            if (phase == Phase.FadingOut)
            {
                var fadeTime = Math.Min(DateTime.Now.TotalMillisecs() - StartFadingOutTime, FadeOutTime);

                if (fadeTime == FadeOutTime)
                {
                    phase = Phase.FadingIn;
                    ActiveScreen.UnloadContent();
                    ActiveScreen   = FadingInScreen;
                    FadingInScreen = null;
                    ActiveScreen.LoadContent();
                }
            }

            if (phase == Phase.FadingIn)
            {
                var fadeTime = Math.Min(DateTime.Now.TotalMillisecs() - StartFadingInTime, FadeInTime);
                if (fadeTime == FadeInTime)
                {
                    ActiveScreen.InputIsLocked = false;
                    phase = Phase.Idle;
                }
            }

            ActiveScreen.Update(gameTime);
        }
Exemplo n.º 2
0
 public void SetActiveScreen(string name)
 {
     ActiveScreen      = Screens[name];
     ActiveScreen.Game = AmGameBase.Instance.game;
     ActiveScreen.Initialize();
     ActiveScreen.LoadContent();
 }
Exemplo n.º 3
0
        public void FadeToScreen(string name, int fadeOutTime = 500, int fadeInTime = 500)
        {
            FadingInScreen      = Screens[name];
            FadingInScreen.Game = AmGameBase.Instance.game;
            FadingInScreen.Initialize();

            ActiveScreen.InputIsLocked = true;
            StartFadingOutTime         = DateTime.Now.TotalMillisecs();
            StartFadingInTime          = DateTime.Now.TotalMillisecs() + fadeOutTime;
            FadeOutTime = fadeOutTime;
            FadeInTime  = fadeInTime;
            phase       = Phase.FadingOut;
        }