private void OverwriteAssignment(MyControl controlAlreadySet, MyKeys key) { Debug.Assert(controlAlreadySet != null); Debug.Assert(m_deviceType == MyGuiInputDeviceEnum.Keyboard || m_deviceType == MyGuiInputDeviceEnum.KeyboardSecond); Debug.Assert(controlAlreadySet.GetKeyboardControl() == key || controlAlreadySet.GetSecondKeyboardControl() == key); if (controlAlreadySet.GetKeyboardControl() == key) { controlAlreadySet.SetControl(MyGuiInputDeviceEnum.Keyboard, MyKeys.None); } else { controlAlreadySet.SetControl(MyGuiInputDeviceEnum.KeyboardSecond, MyKeys.None); } m_controlBeingSet.SetControl(m_deviceType, key); }
private void AssignAlreadyAssignedCommand(MyGuiScreenMessageBoxCallbackEnum r, MyControl control) { if (r == MyGuiScreenMessageBoxCallbackEnum.YES) { switch (m_deviceType) { case MyGuiInputDeviceEnum.Keyboard: m_control.SetControl(control.GetKeyboardControl()); control.SetControl(Keys.None); break; case MyGuiInputDeviceEnum.Mouse: m_control.SetControl(control.GetMouseControl()); control.SetControl(MyMouseButtonsEnum.None); break; case MyGuiInputDeviceEnum.Joystick: m_control.SetControl(control.GetJoystickControl()); control.SetControl(MyJoystickButtonsEnum.None); break; case MyGuiInputDeviceEnum.JoystickAxis: m_control.SetControl(control.GetJoystickAxisControl()); control.SetControl(MyJoystickAxesEnum.None); break; } m_buttonsDictionary[m_control].SetText(new StringBuilder(m_control.GetControlButtonName(m_deviceType))); if (m_buttonsDictionary.ContainsKey(control)) { m_buttonsDictionary[control].SetText(new StringBuilder(control.GetControlButtonName(m_deviceType))); } CloseScreen(); } else { MyGuiManager.GetInput().GetListOfPressedKeys(m_oldPressedKeys); MyGuiManager.GetInput().GetListOfPressedMouseButtons(m_oldPressedMouseButtons); MyGuiManager.GetInput().GetListOfPressedJoystickButtons(m_oldPressedJoystickButtons); MyGuiManager.GetInput().GetListOfPressedJoystickAxes(m_oldPressedJoystickAxes); } }