Example #1
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (TitleMenu != null && TitleMenu.Buttons.Any())
            {
                foreach (var button in TitleMenu.Buttons)
                {
                    var collRec = new Rectangle((int)button.PositionUpLeft.X - (int)button.Center.X,
                                                (int)button.PositionUpLeft.Y - (int)button.Center.Y,
                                                button.CollisionRectangle.Width, button.CollisionRectangle.Height);
                    if (collRec.Contains(InputManager.Instance.MousePosition()))//we have at least hover
                    {
                        //Transform
                        if (InputManager.Instance.MouseLeftBtnClicked())
                        {
                            switch (button.LinkTo.ToLower())
                            {
                            case "screen":
                            {
                                IsTransitioning = true;
                                NextScreen      = button.LinkName;
                                //ScreenManager.Instance.SwitchScreens(NextScreen);
                            }
                            break;

                            //case "menu":
                            //    //TODO
                            //    break;
                            default: break;
                            }
                        }
                    }

                    TitleMenu.Update(gameTime);
                }

                if (IsTransitioning)
                {
                    Transition(gameTime);
                }
            }
        }