void UpdateBindedInputControlsTextBox() { Control pageControls = window.Controls["TabControl"].Controls["Controls"]; InputDevice inputDevice = comboBoxInputDevices.SelectedItem as InputDevice; string text = ""; foreach (GameControlsManager.GameControlItem item in GameControlsManager.Instance.Items) { string valueStr = ""; //keys and mouse buttons if (inputDevice == null) { foreach (GameControlsManager.SystemKeyboardMouseValue value in item.DefaultKeyboardMouseValues) { if (valueStr != "") { valueStr += ", "; } switch (value.Type) { case GameControlsManager.SystemKeyboardMouseValue.Types.Key: valueStr += string.Format("\"{0}\" key", value.Key); break; case GameControlsManager.SystemKeyboardMouseValue.Types.MouseButton: valueStr += string.Format("\"{0}\" mouse button", value.MouseButton); break; } } } //joystick JoystickInputDevice joystickInputDevice = inputDevice as JoystickInputDevice; if (joystickInputDevice != null) { foreach (GameControlsManager.SystemJoystickValue value in item.DefaultJoystickValues) { if (valueStr != "") { valueStr += ", "; } switch (value.Type) { case GameControlsManager.SystemJoystickValue.Types.Button: if (joystickInputDevice.GetButtonByName(value.Button) != null) { valueStr += string.Format("\"{0}\"", value.Button); } break; case GameControlsManager.SystemJoystickValue.Types.Axis: if (joystickInputDevice.GetAxisByName(value.Axis) != null) { valueStr += string.Format("axis \"{0} {1}\"", value.Axis, value.AxisFilter); } break; case GameControlsManager.SystemJoystickValue.Types.POV: if (joystickInputDevice.GetPOVByName(value.POV) != null) { valueStr += string.Format("\"{0} {1}\"", value.POV, value.POVDirection); } break; } } } if (valueStr != "") { text += string.Format("{0} - {1}\n", item.ControlKey.ToString(), valueStr); } } pageControls.Controls["Controls"].Text = text; }
void UpdateBindedInputControlsTextBox() { Control pageControls = window.Controls["TabControl"].Controls["Controls"]; //!!!!temp string text = "Configuring of custom controls is not implemented\n"; text += "\n"; InputDevice inputDevice = comboBoxInputDevices.SelectedItem as InputDevice; text += "Binded keys:\n\n"; foreach (GameControlsManager.GameControlItem item in GameControlsManager.Instance.Items) { string valueStr = ""; //keys and mouse buttons if (inputDevice == null) { foreach (GameControlsManager.SystemKeyboardMouseValue value in item.DefaultKeyboardMouseValues) { switch (value.Type) { case GameControlsManager.SystemKeyboardMouseValue.Types.Key: valueStr += string.Format("Key: {0}", value.Key); break; case GameControlsManager.SystemKeyboardMouseValue.Types.MouseButton: valueStr += string.Format("MouseButton: {0}", value.MouseButton); break; } } } //joystick JoystickInputDevice joystickInputDevice = inputDevice as JoystickInputDevice; if (joystickInputDevice != null) { foreach (GameControlsManager.SystemJoystickValue value in item.DefaultJoystickValues) { switch (value.Type) { case GameControlsManager.SystemJoystickValue.Types.Button: if (joystickInputDevice.GetButtonByName(value.Button) != null) { valueStr += string.Format("Button: {0}", value.Button); } break; case GameControlsManager.SystemJoystickValue.Types.Axis: if (joystickInputDevice.GetAxisByName(value.Axis) != null) { valueStr += string.Format("Axis: {0}({1})", value.Axis, value.AxisFilter); } break; case GameControlsManager.SystemJoystickValue.Types.POV: if (joystickInputDevice.GetPOVByName(value.POV) != null) { valueStr += string.Format("POV: {0}({1})", value.POV, value.POVDirection); } break; } } } if (valueStr != "") { text += string.Format("{0} - {1}\n", item.ControlKey.ToString(), valueStr); } } pageControls.Controls["Controls"].Text = text; }