public override void Update(GameTime gameTime)
        {
            bool doUpdate = true;

            switch (this.State)
            {
            case eScreenState.Activating:
            case eScreenState.Deactivating:
            case eScreenState.Closing:
                UpdateTransition(gameTime);
                break;

            case eScreenState.Active:
                break;

            case eScreenState.Inactive:
            case eScreenState.Closed:
                doUpdate = false;
                break;

            default:
                break;
            }

            if (doUpdate)
            {
                base.Update(gameTime);

                if (PreviousScreen != null && !this.IsModal)
                {
                    PreviousScreen.Update(gameTime);
                }
            }
        }
Beispiel #2
0
        public override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            bool fading = UseFadeTransition &&
                          TransitionPosition > 0 &&
                          TransitionPosition < 1;

            if (PreviousScreen != null &&
                IsOverlayed)
            {
                PreviousScreen.Draw(gameTime);

                if (!fading && (BlackTintAlpha > 0 || UseGradientBackground))
                {
                    FadeBackBufferToBlack((byte)(m_BlackTintAlpha * byte.MaxValue));
                }
            }

            base.Draw(gameTime);

            if (fading)
            {
                FadeBackBufferToBlack(TransitionAlpha);
            }
        }
Beispiel #3
0
        public override void Update(GameTime gameTime)
        {
            if (PreviousScreen != null && !this.IsModal)
            {
                PreviousScreen.Update(gameTime);
            }

            base.Update(gameTime);
        }
Beispiel #4
0
        public override void Draw(GameTime gameTime)
        {
            if (PreviousScreen != null && IsOverlayed)
            {
                PreviousScreen.Draw(gameTime);

                drawFadedDarkCoverIfNeeded();
            }

            base.Draw(gameTime);
        }
Beispiel #5
0
        public override void Update(GameTime gameTime)
        {
            bool doUpdate = true;

            switch (this.State)
            {
            case eScreenState.Activating:
            case eScreenState.Deactivating:
            case eScreenState.Closing:
                UpdateTransition(gameTime);
                break;

            case eScreenState.Active:
                break;

            case eScreenState.Inactive:
            case eScreenState.Closed:
                doUpdate = false;
                break;

            default:
                break;
            }

            if (doUpdate)
            {
                base.Update(gameTime);

                ISoundSettings gameSettings = (this.Game.Services.GetService(typeof(IGameSettings)) as ISoundSettings);
                if (gameSettings != null)
                {
                    if (InputManager.KeyPressed(Keys.M))
                    {
                        gameSettings.SetIsMuted(!gameSettings.IsMuted());
                    }
                }

                if (PreviousScreen != null && !this.IsModal)
                {
                    PreviousScreen.Update(gameTime);
                }

                foreach (KeyValuePair <Keys, NamedAction> keyAndAction in m_ActivationKeys)
                {
                    if (InputManager.KeyPressed(keyAndAction.Key))
                    {
                        keyAndAction.Value.Action.Invoke();
                    }
                }
            }
        }
Beispiel #6
0
        public override bool Load()
        {
            var collection = new Dictionary <string, Action>();

            collection.Add("Back", () =>
            {
                DisableThenAddNew(PreviousScreen.Activate() ?? new MainMenu());
            });

            Components.AddRange(SortButtons(collection));

            TransparentBackground = TextureManager.CreateTexture2DBySingleColor(new Color((byte)0, (byte)0, (byte)0, (byte)(0.5 * 255)), 1, 1);

            return(true && base.Load());
        }
Beispiel #7
0
        public override void Draw(GameTime gameTime)
        {
            if (PreviousScreen != null && IsOverlayed)
            {
                PreviousScreen.Draw(gameTime);

                drawFadedDarkCoverIfNeeded();
            }

            if (m_Background != null)
            {
                m_SpriteBatch.Begin();
                m_Background.Draw(gameTime);
                m_SpriteBatch.End();
            }

            base.Draw(gameTime);
        }
Beispiel #8
0
 public void MovePreviousScreen()
 {
     PreviousScreen.ProcessCommands("");
 }
Beispiel #9
0
 private void ReturnToPreviousScreen(object sender, EventArgs e)
 {
     PreviousScreen?.Invoke(sender, e);
 }
Beispiel #10
0
 public void Transition()
 {
     PreviousScreen.SetActive(false);
     ActiveScreen.SetActive(true);
 }