Esempio n. 1
0
    public void Setup(string _toMap)
    {
        bindingToMap = _toMap;

        // Automatically set the onclick function and change the name text to the binding.
        button.onClick.AddListener(OnClick);
        bindingName.text = _toMap;

        // Update the button text with the binding's value and make the GO active
        BindingUtils.UpdateTextWithBinding(bindingToMap, buttonText);
        gameObject.SetActive(true);
    }
Esempio n. 2
0
    private void Update()
    {
        if (isRebinding)
        {
            KeyCode pressed = BindingUtils.GetAnyPressedKey();
            if (pressed != KeyCode.None)
            {
                BindingManager.Rebind(bindingToMap, pressed);
                BindingUtils.UpdateTextWithBinding(bindingToMap, buttonText);

                isRebinding = false;
            }
        }
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        // Are we rebinding the key?
        if (isRebinding)
        {
            // Try to get any key in the input and check if it was sucessful
            KeyCode pressed = BindingUtils.GetAnyPressedKey();
            if (pressed != KeyCode.None)
            {
                // Rebind the key and update the button text
                BindingManager.Rebind(bindingToMap, pressed);
                BindingUtils.UpdateTextWithBinding(bindingToMap, buttonText);

                // Reset the isRebinding flag as we have now rebound the key
                isRebinding = false;
            }
        }
    }