Esempio n. 1
0
        private void runMenuItemMethod()
        {
            GameMenuItem activeMenuItem = m_Menu[m_ActiveMenuItemIndex] as GameMenuItem;

            if (activeMenuItem != null)
            {
                Menu[m_ActiveMenuItemIndex].RunMethod(Keys.Enter);
            }
        }
Esempio n. 2
0
        private void activateCurrentMenuItem()
        {
            GameMenuItem activeMenuItem = m_Menu[m_ActiveMenuItemIndex] as GameMenuItem;

            if (activeMenuItem != null)
            {
                activeMenuItem.IsActive = true;

                for (int i = 0; i < m_Menu.Count; i++)
                {
                    if (i != m_ActiveMenuItemIndex)
                    {
                        activeMenuItem          = m_Menu[i] as GameMenuItem;
                        activeMenuItem.IsActive = false;
                    }
                }
            }
        }
Esempio n. 3
0
        protected void AddMenuItems(params MenuItem[] i_MenuItems)
        {
            foreach (MenuItem menuItem in i_MenuItems)
            {
                GameMenuItem menuItemGame = menuItem as GameMenuItem;
                if (menuItemGame != null)
                {
                    float y = TitleText.Position.Y + TitleText.Height + (TitleText.Height / 1.5f);
                    if (m_Menu.MenuItems != null)
                    {
                        GameMenuItem lastItem = m_Menu[m_Menu.Count - 1] as GameMenuItem;
                        if (lastItem != null)
                        {
                            y = lastItem.Text.Position.Y + lastItem.Text.Height + (lastItem.Text.Height / 1.5f);
                        }
                    }

                    menuItemGame.Position = new Vector2(0, y);
                    this.Menu.AddMenuItem(menuItemGame);
                }
            }
        }
Esempio n. 4
0
        private void handleMouse()
        {
            bool isMouseHover = isMouseHoverMenuItem();

            if (isMouseHover && InputManager.MouseState.LeftButton == ButtonState.Pressed && m_LastBTNState == ButtonState.Released)
            {
                runMenuItemMethod();
            }
            else if (m_ActiveMenuItemIndex > -1)
            {
                GameMenuItem item = Menu[m_ActiveMenuItemIndex] as GameMenuItem;
                if (isMouseHover && !item.IsActive)
                {
                    activateCurrentMenuItem();
                }
                else if (isMouseHover)
                {
                    RangeMenuItem rangeItem = m_Menu[m_ActiveMenuItemIndex] as RangeMenuItem;
                    if (rangeItem != null)
                    {
                        if (InputManager.MouseState.ScrollWheelValue > m_LastMouseWheelValue)
                        {
                            rangeItem.IncreaseJump();
                        }
                        else if (InputManager.MouseState.ScrollWheelValue < m_LastMouseWheelValue)
                        {
                            rangeItem.DecreaseJump();
                        }

                        m_LastMouseWheelValue = InputManager.MouseState.ScrollWheelValue;
                    }
                }
            }

            m_LastBTNState = InputManager.MouseState.LeftButton;
        }