Пример #1
0
        public static ICommand GetCommandForInput(MenuInputs input, object sender)
        {
            switch (input)
            {
            case MenuInputs.Settings:
            {
                return(ShowSettingsWindowEvent.GetShowSettingsWindowCommand(sender));
            }

            case MenuInputs.Spotify:
            {
                return(ShowSpotifyWindowEvent.GetShowSpotifyWindowCommand(sender));
            }

            case MenuInputs.Exit:
            {
                return(CloseRequestedEvent.GetCloseRequestedCommand(sender));
            }

            default:
            {
                throw new InvalidOperationException($"Can't get Command for Input {input} from Sender {sender}");
            }
            }
        }
Пример #2
0
        public virtual void InputTrigger(MenuInputs input)
        {
            if (Active)
            {
                if (Item is Items.Selectable selectable)
                {
                    if (usingMouse)
                    {
                        selectable.OnSwitchInputMethod?.Invoke(this, EventArgs.Empty);
                        usingMouse = false;

                        if (!selectable.Highlighted)
                        {
                            if (selectable is UIContainer container)
                            {
                                container.HighlightInternal();
                            }
                            selectable.Highlight();
                            return;
                        }
                    }

                    selectable.InputTrigger(input);
                }
            }
            else
            {
                childMenu.InputTrigger(input);
            }
        }
    void Update()
    {
        bool up = false;

        if (Input.GetAxisRaw("Vertical1") < 0 || Input.GetAxisRaw("Vertical2") < 0 || Input.GetAxisRaw("Vertical3") < 0 || Input.GetAxisRaw("Vertical4") < 0)
        {
            if (!upIsBeingPressed)
            {
                up = true;
                upIsBeingPressed = true;
            }
        }
        else
        {
            upIsBeingPressed = false;
        }

        bool down = false;

        if (Input.GetAxisRaw("Vertical1") > 0 || Input.GetAxisRaw("Vertical2") > 0 || Input.GetAxisRaw("Vertical3") > 0 || Input.GetAxisRaw("Vertical4") > 0)
        {
            if (!downIsBeingPressed)
            {
                down = true;
                downIsBeingPressed = true;
            }
        }
        else
        {
            downIsBeingPressed = false;
        }



        bool select   = Input.GetButtonDown("Select1") || Input.GetButtonDown("Select2") || Input.GetButtonDown("Select3") || Input.GetButtonDown("Select4");
        bool validate = Input.GetButtonDown("Start1") || Input.GetButtonDown("Start2") || Input.GetButtonDown("Start3") || Input.GetButtonDown("Start4");
        bool deselect = Input.GetButtonDown("Deselect1") || Input.GetButtonDown("Deselect2") || Input.GetButtonDown("Deselect3") || Input.GetButtonDown("Deselect4");

        Current = new MenuInputs()
        {
            Deselect = deselect,
            Up       = up,
            Down     = down,
            Select   = select,
            Validate = validate,
        };
    }
 void OnDisable()
 {
     Current = new MenuInputs()
     {
         Up          = false,
         Down        = false,
         Left        = false,
         Right       = false,
         Deselect    = false,
         Validate    = false,
         SpellOne    = false,
         SpellTwo    = false,
         SpellThree  = false,
         SpellFour   = false,
         RotateInput = Vector2.zero
     };
 }
    void LateUpdate()
    {
        bool up = false;

        if (Input.GetAxisRaw("Vertical1") < 0 || (Input.GetAxisRaw("Vertical") < 0))
        {
            if (!upIsBeingPressed)
            {
                up = true;
                upIsBeingPressed = true;
            }
        }
        else
        {
            upIsBeingPressed = false;
        }

        bool down = false;

        if (Input.GetAxisRaw("Vertical1") > 0 || (Input.GetAxisRaw("Vertical") > 0))
        {
            if (!downIsBeingPressed)
            {
                down = true;
                downIsBeingPressed = true;
            }
        }
        else
        {
            downIsBeingPressed = false;
        }


        bool left = false;

        if (Input.GetAxisRaw("Horizontal1") < 0 || (Input.GetAxisRaw("Horizontal") < 0))
        {
            if (!leftIsBeingPressed)
            {
                left = true;
                leftIsBeingPressed = true;
            }
        }
        else
        {
            leftIsBeingPressed = false;
        }

        bool right = false;

        if (Input.GetAxisRaw("Horizontal1") > 0 || (Input.GetAxisRaw("Horizontal") > 0))
        {
            if (!rightIsBeingPressed)
            {
                right = true;
                rightIsBeingPressed = true;
            }
        }
        else
        {
            rightIsBeingPressed = false;
        }


        bool select   = Input.GetButtonDown("Select1");
        bool deselect = Input.GetButtonDown("Deselect1");
        bool validate = Input.GetButtonDown("Start1");

        Current = new MenuInputs()
        {
            Up       = up,
            Down     = down,
            Left     = left,
            Right    = right,
            Select   = select,
            Deselect = deselect,
            Validate = validate
        };
    }
Пример #6
0
    // Update is called once per frame
    void Update()
    {
        navigationInput = false;
        bool up = false;

        if (Input.GetAxisRaw(verticalMove) < 0)
        {
            if (!upIsBeingPressed)
            {
                up = true;
                upIsBeingPressed = true;
            }
        }
        else
        {
            upIsBeingPressed = false;
        }

        bool down = false;

        if (Input.GetAxisRaw(verticalMove) > 0)
        {
            if (!downIsBeingPressed)
            {
                down = true;
                downIsBeingPressed = true;
            }
        }
        else
        {
            downIsBeingPressed = false;
        }


        bool left = false;

        if (Input.GetAxisRaw(horizontalMove) < 0)
        {
            if (!leftIsBeingPressed)
            {
                left = true;
                leftIsBeingPressed = true;
            }
        }
        else
        {
            leftIsBeingPressed = false;
        }

        bool right = false;

        if (Input.GetAxisRaw(horizontalMove) > 0)
        {
            if (!rightIsBeingPressed)
            {
                right = true;
                rightIsBeingPressed = true;
            }
        }
        else
        {
            rightIsBeingPressed = false;
        }



        bool selectPressed   = Input.GetButtonDown(select);
        bool deselectPressed = Input.GetButtonDown(deselect);
        bool validatePressed = Input.GetButtonDown(start);


        bool spellOnePressed = false;

        if (Input.GetAxisRaw(spellOne) > 0)
        {
            if (!spellOneIsInUse)
            {
                spellOnePressed = true;
                spellOneIsInUse = true;
            }
        }
        else
        {
            spellOneIsInUse = false;
        }


        bool spellTwoPressed = false;

        if (Input.GetAxisRaw(spellTwo) < 0)
        {
            if (!spellTwoIsInUse)
            {
                spellTwoPressed = true;
                spellTwoIsInUse = true;
            }
        }
        else
        {
            spellTwoIsInUse = false;
        }



        bool spellThreePressed = Input.GetButtonDown(spellThree);
        bool spellFourPressed  = Input.GetButtonDown(spellFour);

        if (up || down || right || left)
        {
            navigationInput = true;
        }
        Current = new MenuInputs()
        {
            Up         = up,
            Down       = down,
            Left       = left,
            Right      = right,
            Select     = selectPressed,
            Deselect   = deselectPressed,
            Validate   = validatePressed,
            SpellOne   = spellOnePressed,
            SpellTwo   = spellTwoPressed,
            SpellThree = spellThreePressed,
            SpellFour  = spellFourPressed
        };
    }
Пример #7
0
 public static void AddGenericMapping(MenuInputs menuInput, ButtonGeneric button)
 {
     List<ButtonGeneric> buttons = new List<ButtonGeneric>(ButtonMappings[(int)menuInput]);
     buttons.Add(button);
     ButtonMappings[(int)menuInput] = buttons.ToArray();
 }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        Vector2 rotateInput = new Vector2(Input.GetAxis(cursorHorizontal), Input.GetAxis(cursorVertical));

        bool up = false;

        if (Input.GetAxisRaw(verticalMove) < 0)
        {
            if (!upIsBeingPressed)
            {
                up = true;
                upIsBeingPressed = true;
            }
        }
        else
        {
            upIsBeingPressed = false;
        }

        bool down = false;

        if (Input.GetAxisRaw(verticalMove) > 0)
        {
            if (!downIsBeingPressed)
            {
                down = true;
                downIsBeingPressed = true;
            }
        }
        else
        {
            downIsBeingPressed = false;
        }


        bool left = false;

        if (Input.GetAxisRaw(horizontalMove) < 0)
        {
            if (!leftIsBeingPressed)
            {
                left = true;
                leftIsBeingPressed = true;
            }
        }
        else
        {
            leftIsBeingPressed = false;
        }

        bool right = false;

        if (Input.GetAxisRaw(horizontalMove) > 0)
        {
            if (!rightIsBeingPressed)
            {
                right = true;
                rightIsBeingPressed = true;
            }
        }
        else
        {
            rightIsBeingPressed = false;
        }



        bool select   = Input.GetButtonDown(selectInput);
        bool deselect = Input.GetButtonDown(deselectInput);
        bool validate = Input.GetButtonDown(pause);

        Current = new MenuInputs()
        {
            Up          = up,
            Down        = down,
            Left        = left,
            Right       = right,
            Select      = select,
            Deselect    = deselect,
            Validate    = validate,
            RotateInput = rotateInput
        };
    }
 // Use this for initialization
 void Start()
 {
     Current = new MenuInputs();
 }