private static void SaveAllKeybindValues()
        {
            foreach (var action in UnsavedKeybindDict.Keys)
            {
                if (action == leftClickString || action == middleClickString || action == rightClickString)
                {
                    KeyCode code = InputManager.Instance.ParseKeyCodeString(UnsavedKeybindDict[action]);
                    InputManager.JoystickUIActions uiAction = InputManager.JoystickUIActions.LeftClick;

                    if (action == middleClickString)
                    {
                        uiAction = InputManager.JoystickUIActions.MiddleClick;
                    }
                    else if (action == rightClickString)
                    {
                        uiAction = InputManager.JoystickUIActions.RightClick;
                    }

                    KeyCode curCode = InputManager.Instance.GetJoystickUIBinding(uiAction);

                    if (curCode != code)
                    {
                        InputManager.Instance.SetJoystickUIBinding(code, uiAction);
                        Debug.LogFormat("Bound joystick {0} with Code {1}", action, code.ToString());
                    }
                }
                else
                {
                    InputManager.AxisActions axisAction = (InputManager.AxisActions)Enum.Parse(typeof(InputManager.AxisActions), action);
                    string code = UnsavedKeybindDict[action];

                    // Rebind only if new code is different
                    string curCode = InputManager.Instance.GetAxisBinding(axisAction);
                    if (curCode != code)
                    {
                        InputManager.Instance.SetAxisBinding(code, axisAction);
                        Debug.LogFormat("Bound AxisAction {0} with Code {1}", axisAction, code.ToString());
                    }
                }
            }
        }
Beispiel #2
0
 private void SetupAxisKeybindButton(Button button, InputManager.AxisActions action, int x, int y)
 {
     SetupKeybindButton(button, action.ToString(), x, y);
     button.OnMouseClick += AxisKeybindButton_OnMouseClick;
 }