Beispiel #1
0
        public void TransitionTo <T>() where T : BaseScreen
        {
            var scr = GetOrCreateScreen <T>();

            nextScreen = scr;
            if (!nextScreen.IsReady)
            {
                nextScreen.LoadContent();
            }
            // Switch to loading screen if it exists
            if (loadingScreen != null)
            {
                if (curScreen != null)
                {
                    curScreen.OnNavigatedFrom();
                }
                curScreen = loadingScreen;
                curScreen.OnNavigatedTo();
            }
        }
Beispiel #2
0
        public override void Update(GameTime gameTime)
        {
            // See if we need to change screens
            if (nextScreen != null && nextScreen.IsReady)
            {
                if (curScreen != null)
                {
                    curScreen.OnNavigatedFrom();
                }
                curScreen  = nextScreen;
                nextScreen = null;
                curScreen.OnNavigatedTo();
            }

            if (curScreen != null)
            {
                curScreen.Update(gameTime.ElapsedGameTime.TotalSeconds);
            }

            base.Update(gameTime);
        }