示例#1
0
    public void SetUp(float yPos, GameControls control, string keybind)
    {
        Control = control;
        gameControlText.text = control.ToString().AddSpacesBetweenCamelCase();
        keyBindText.text     = keybind;

        GetComponent <RectTransform>().localPosition = new Vector2(0, yPos);
    }
示例#2
0
 void ButtonCreationHelper(int controller_id, GameControls control, int buttonID)
 {
     AddAxis(new InputAxis()
     {
         name           = ammend(controller_id, control.ToString()),
         positiveButton = JoyStickButton(buttonID, controller_id + 1),
         joyNum         = controller_id + 1 //reset to zero
     });
 }
示例#3
0
    public void ChangeKeyBind()
    {
        if (!isComposite)
        {
            var rebindOperation = selectedAction.PerformInteractiveRebinding()
                                  .Start()
                                  .OnComplete(result =>
            {
                Debug.LogFormat("Rebinded {0} to {1}"
                                , keyToChange.ToString()
                                , selectedAction.GetBindingDisplayString());


                GameManager.Manager.SavePlayerBindings();
                UpdateText();
                result.Dispose();
            });
        }
        else
        {
            var bindingToChange = selectedAction.bindings[compositeId];

            var rebindComposite = selectedAction.PerformInteractiveRebinding()
                                  .WithTargetBinding(compositeId)
                                  .Start()
                                  .OnComplete(result =>
            {
                Debug.LogFormat("Rebinded {0} to {1}"
                                , bindingToChange.ToDisplayString()
                                , selectedAction.GetBindingDisplayString(bindingIndex: compositeId));

                GameManager.Manager.SavePlayerBindings();
                UpdateText();
                result.Dispose();
            });
        }


        UpdateText("Press any key to rebind");
    }
示例#4
0
    private void Start()
    {
        PlayerInputAction actions     = GameManager.Manager.InputActions;
        InputAction       inputAction = null;

        if (keyActionText != null)
        {
            keyActionText.text = currControl.ToString();
        }

        switch (currControl)
        {
        case GameControls.Interact:
            inputAction = actions.PlayerControls.Pickup;
            break;

        case GameControls.Repair:
            inputAction = actions.PlayerControls.Repair;
            break;

        case GameControls.Switch:
            inputAction = actions.PlayerControls.Switch;
            break;
        }

        if (keyRebindText == null)
        {
            return;
        }

        if (isComposite)
        {
            keyRebindText.text = inputAction.GetBindingDisplayString(bindingIndex: compositeId + 1);
        }
        else
        {
            keyRebindText.text = inputAction.GetBindingDisplayString();
        }
    }