public override void ButtonClicked(MenuButton button) { base.ButtonClicked(button); if (button == backButton) { BackButtonPressed(); } else if (button == applyToAllGamepadsButton) { ApplyToAllGamepadsPressed(); } else { GamepadControlsMenuButton controlsButton = (GamepadControlsMenuButton)button; if (controlsButton.buttonType == GamepadControlsMenuButtonType.Button) { controlsButton.SetWaitingForInput(); buttonIndexPressed = buttonList.IndexOf(button); waitingForAllKeysToBeUnpressed = true; waitingForKeyPress = true; } else if (controlsButton.buttonType == GamepadControlsMenuButtonType.JoystickOption) { JoystickOptions currentInput = (JoystickOptions)ControlsConfig.gamepadControls[controlsButton.controlsTKey][controlsButton.controllerIndex]; controlsButton.SetNewInput(ControlsConfig.GetNextJoystickOption(currentInput)); } else if (controlsButton.buttonType == GamepadControlsMenuButtonType.Toggle) { bool currentToggle = (ControlsConfig.gamepadControls[controlsButton.controlsTKey][controlsButton.controllerIndex] == (int)ToggleOptions.True); controlsButton.SetNewInput(!currentToggle); } } }
public static JoystickOptions GetNextJoystickOption(JoystickOptions joystickOption) { if (joystickOption == JoystickOptions.Left) { return(JoystickOptions.Right); } else { return(JoystickOptions.Left); } }
public void ToStringTest() { var joystick = JoystickOptions.Create() .AddJoystickType() .AddTimed() .AddAutoFire() .AddSwap34() .AddButtonWrap(); var iniJoystick = joystick.ToString(); Assert.AreEqual(iniJoystick, "[joystick]\r\n\r\njoysticktype=auto\r\ntimed=true\r\nautofire=false\r\nswap34=false\r\nbuttonwrap=false\r\n"); }
public void LoadDictionaryTest() { JoystickOptions joystick = new JoystickOptions(); var dictionary = new Dictionary <string, object>() { { "joysticktype", "auto" }, { "timed", "true" }, { "autofire", "false" }, { "swap34", "false" }, { "buttonwrap", "false" } }; joystick.LoadDictionary(dictionary); Assert.AreEqual(joystick.JoystickType, Joystick.Auto); Assert.IsTrue(joystick.Timed); Assert.IsFalse(joystick.AutoFire); Assert.IsFalse(joystick.Swap34); Assert.IsFalse(joystick.ButtonWrap); }
public void SetNewInput(JoystickOptions joystickOption) { SetSideImageSize((int)joystickOption); ControlsConfig.gamepadControls[controlsTKey][controllerIndex] = (int)joystickOption; }