Esempio n. 1
0
 public void PressItem()
 {
     if (_activeSubSystem != null)
     {
         _activeSubSystem.PressItem();
         //The button was a back button to the parent, meaning no active subsystem
         if (this == _activeSubSystem._activeSubSystem)
         {
             //The button was not trying to set a new subsystem, so remove the references
             _activeSubSystem._activeSubSystem = null;
             _activeSubSystem = null;
         }
     }
     else
     {
         string pressedItem = _menuItems[_selectedItemIndex];
         if (_subSystems.ContainsKey(pressedItem))
         {
             _activeSubSystem = _subSystems[pressedItem];
         }
         else
         {
             _pressedItem = pressedItem;
         }
     }
 }
Esempio n. 2
0
 public void AddBackButton(MenuSystem parent)
 {
     if (parent != null)
     {
         string backText = "Back: " + parent._title;
         _menuItems.Add(backText);
         _subSystems[backText] = parent;
     }
 }
Esempio n. 3
0
 public void AddBackButton(MenuSystem parent)
 {
     if (parent != null)
     {
         string backText = "Back: " + parent._title;
         _menuItems.Add(backText);
         _subSystems[backText] = parent;
     }
 }
Esempio n. 4
0
        public void PressItem()
        {
            if (_activeSubSystem != null)
            {
                _activeSubSystem.PressItem();
                //The button was a back button to the parent, meaning no active subsystem
                if (this == _activeSubSystem._activeSubSystem)
                {
                    //The button was not trying to set a new subsystem, so remove the references
                    _activeSubSystem._activeSubSystem = null;
                    _activeSubSystem = null;

                }
            }
            else
            {
                string pressedItem = _menuItems[_selectedItemIndex];
                if (_subSystems.ContainsKey(pressedItem))
                {
                    _activeSubSystem = _subSystems[pressedItem];
                }
                else
                {
                    _pressedItem = pressedItem;
                }
            }
        }
Esempio n. 5
0
 public void AddSubSystem(string itemText, MenuSystem subSystem)
 {
     _menuItems.Add(itemText);
     _subSystems[itemText] = subSystem;
     subSystem.AddBackButton(this);
 }
Esempio n. 6
0
        public override void LoadContent()
        {
            base.LoadContent();
            screenManager.ClearColor = Color.Black;
            _title = new Sprite("Title", (int)GameSettings.ScreenWidth / 2 - 512, 64 + 32, new Rectangle(0, 0, 1024, 128), 1);
            Add(_title);
            SpriteFont font = _contentManager.Load<SpriteFont>("HealthFont");
            _mainMenu = new MenuSystem(font, "", new Vector2(GameSettings.ScreenWidth / 2 - ((font.MeasureString("Play Local Multiplayer").X / 2)), _title.position.Y + 256), true);
            _mainMenu.MenuItemColor = Color.White;
            _mainMenu.AddItem("Play Local Multiplayer");
            _mainMenu.AddItem("Quit Game");
            _mainMenu.ToggleTitle();
            _mainMenu.ItemOffSetY *= 2;
            _mainMenu.Center(new Rectangle(0, 0, (int)GameSettings.ScreenWidth, (int)GameSettings.ScreenHeight), true, false);

            screenManager.Game.IsMouseVisible = false;
        }
Esempio n. 7
0
 public void AddSubSystem(string itemText, MenuSystem subSystem)
 {
     _menuItems.Add(itemText);
     _subSystems[itemText] = subSystem;
     subSystem.AddBackButton(this);
 }