Ejemplo n.º 1
0
 public override void Update(UiFocusContainer container)
 {
     if (_inputSystem.Up(InputDetectionType.PressedOnce, DirectionalInputTypes.All))
     {
         InvokeMoveToPreviousElement();
     }
     if (_inputSystem.Down(InputDetectionType.PressedOnce, DirectionalInputTypes.All))
     {
         InvokeMoveToNextElement();
     }
     if (_inputSystem.Accept(AcceptInputTypes.Buttons))
     {
         InvokeAction(container.CurrentElement);
     }
 }
        public void Update(UiFocusContainer container)
        {
            if (_game.Keyboard.IsKeyDownOnce(Keys.W))
            {
                MoveToPreviousElement?.Invoke();
            }
            else if (_game.Keyboard.IsKeyDownOnce(Keys.S))
            {
                MoveToNextElement?.Invoke();
            }

            if (_game.Keyboard.IsKeyDownOnce(Keys.Space) || _game.Keyboard.IsKeyDownOnce(Keys.Enter))
            {
                OnAction?.Invoke(container.CurrentElement);
            }
        }
Ejemplo n.º 3
0
 public void Update(UiFocusContainer container)
 {
     foreach (var uiElement in container.UiElements)
     {
         if (uiElement.GetBounds().Contains(_game.Mouse.X, _game.Mouse.Y))
         {
             if (container.CurrentElement == uiElement)
             {
                 if (_game.Mouse.IsLeftButtonDownOnce())
                 {
                     OnAction?.Invoke(uiElement);
                 }
             }
             else
             {
                 MoveToElement?.Invoke(uiElement);
             }
             break;
         }
     }
 }