Ejemplo n.º 1
0
        public void CreateButton(string textureName, string text, int buttonIndex, GameState changesToStateProvider, int changesToMenu)
        {
            var graphics = GameServices.GetService<GraphicsDevice>();
            var contentManager = GameServices.GetService<ContentManager>();

            var texture = contentManager.Load<Texture2D>(GeneralSettings.ButtonsPath + textureName);
            var button = new MenuButton {
                                                   Texture = texture,
                                                   Text = text,
                                                   ChangesToState = changesToStateProvider,
                                                   Id = buttonIndex,
                                                   Position = new Vector2(graphics.Viewport.Width / 2f - texture.Width / 2f, graphics.Viewport.Height / 2f),
                                                   Color = Color.White,
                                                   ChangesToMenu = changesToMenu
                                               };

            MenuButtons.Add(button);

            MenuButtons = MenuButtons.OrderBy(b => b.Id).ToList();
            SetButtonPositions();
        }
Ejemplo n.º 2
0
        public void CreateButton(string textureName, string text, int buttonIndex, GameState changesToStateProvider, int changesToMenu)
        {
            var graphics       = GameServices.GetService <GraphicsDevice>();
            var contentManager = GameServices.GetService <ContentManager>();

            var texture = contentManager.Load <Texture2D>(GeneralSettings.ButtonsPath + textureName);
            var button  = new MenuButton {
                Texture        = texture,
                Text           = text,
                ChangesToState = changesToStateProvider,
                Id             = buttonIndex,
                Position       = new Vector2(graphics.Viewport.Width / 2f - texture.Width / 2f, graphics.Viewport.Height / 2f),
                Color          = Color.White,
                ChangesToMenu  = changesToMenu
            };


            MenuButtons.Add(button);

            MenuButtons = MenuButtons.OrderBy(b => b.Id).ToList();
            SetButtonPositions();
        }
Ejemplo n.º 3
0
        public void SelectFirstButton()
        {
            if (SelectedButton == null)
                SelectedButton = MenuButtons[0];

            SelectedButton.Highlight(false);
            MenuButtons[0].Highlight(true);
            SelectedButton = MenuButtons[0];
        }
Ejemplo n.º 4
0
 public void SelectButton(MenuButton button)
 {
     SelectedButton.Highlight(false);
     SelectedButton = button;
     SelectedButton.Highlight(true);
 }
Ejemplo n.º 5
0
 public void PressButton(MenuButton button)
 {
 }
Ejemplo n.º 6
0
 public void PressButton(MenuButton button)
 {
 }
Ejemplo n.º 7
0
 public void SelectButton(MenuButton button)
 {
     SelectedButton.Highlight(false);
     SelectedButton = button;
     SelectedButton.Highlight(true);
 }