public static MyGuiHelperBase GetEditorControlHelper(MyEditorControlEnums controlHelper) { MyGuiHelperBase ret; if (m_editorControlHelpers.TryGetValue(controlHelper, out ret)) return ret; else return null; }
public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyMouseButtonsEnum?defaultControlMouse, Keys?defaultControlKey, MyJoystickButtonsEnum?defaultControlJoy, MyJoystickAxesEnum?defaultControlJoyAxis) : this(control, text, controlType) { m_mouseButton = defaultControlMouse.HasValue ? defaultControlMouse.Value : MyMouseButtonsEnum.None; m_keyboardKey = defaultControlKey.HasValue ? defaultControlKey.Value : Keys.None; m_joystickButton = defaultControlJoy.HasValue ? defaultControlJoy.Value : MyJoystickButtonsEnum.None; m_joystickAxis = defaultControlJoyAxis.HasValue ? defaultControlJoyAxis.Value : MyJoystickAxesEnum.None; }
public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType) { m_editorControl = control; m_gameControlType = MyGuiGameControlType.EDITOR; m_text = text; m_controlType = controlType; m_joystickButton = MyJoystickButtonsEnum.None; m_joystickAxis = MyJoystickAxesEnum.None; m_mouseButton = MyMouseButtonsEnum.None; m_keyboardKey = Keys.None; }
public static MyGuiHelperBase GetEditorControlHelper(MyEditorControlEnums controlHelper) { MyGuiHelperBase ret; if (m_editorControlHelpers.TryGetValue(controlHelper, out ret)) { return(ret); } else { return(null); } }
public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType) { m_editorControl = control; m_gameControlType = MyGuiGameControlType.EDITOR; m_text = text; m_controlType = controlType; m_joystickButton = MyJoystickButtonsEnum.None; m_joystickAxis = MyJoystickAxesEnum.None; m_mouseButton = MyMouseButtonsEnum.None; m_keyboardKey = Keys.None; }
public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyMouseButtonsEnum? defaultControlMouse, Keys? defaultControlKey, MyJoystickButtonsEnum? defaultControlJoy, MyJoystickAxesEnum? defaultControlJoyAxis) : this(control, text, controlType) { m_mouseButton = defaultControlMouse.HasValue ? defaultControlMouse.Value : MyMouseButtonsEnum.None; m_keyboardKey = defaultControlKey.HasValue ? defaultControlKey.Value : Keys.None; m_joystickButton = defaultControlJoy.HasValue ? defaultControlJoy.Value : MyJoystickButtonsEnum.None; m_joystickAxis = defaultControlJoyAxis.HasValue ? defaultControlJoyAxis.Value : MyJoystickAxesEnum.None; }
public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyMouseButtonsEnum defaultControl) : this(control, text, controlType, defaultControl, null, null, null) { }
public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, Keys defaultControl) : this(control, text, controlType, null, defaultControl, null, null) { }
public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyMouseButtonsEnum defaultControl) : this(control, text, controlType, defaultControl, null, null, null) { }
public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, Keys defaultControl) : this(control, text, controlType, null, defaultControl, null, null) { }
private MyControl FindNotAssignedEditorControl(MyEditorControlEnums type, MyGuiInputDeviceEnum deviceType) { foreach (var item in m_editorControlsList) { if (item.GetEditorControlEnum().Value == type && item.IsControlAssigned(deviceType) == false) return item; } throw new Exception("Editor control \"" + MyEnumsToStrings.GameControlEnums[(int)type] + "\" not found at control list or control is already assigned."); }
private void LoadEditorControl(string[] control, MyEditorControlEnums controlType, MyGuiInputDeviceEnum device, int controlId) { switch (device) { case MyGuiInputDeviceEnum.Keyboard: Keys key = (Keys)Enum.Parse(typeof(Keys), control[controlId]); if (!IsKeyValid(key)) { throw new Exception("Key \"" + key.ToString() + "\" is already assigned or is not valid."); } FindNotAssignedEditorControl(controlType, device).SetControl(key); break; case MyGuiInputDeviceEnum.Mouse: MyMouseButtonsEnum mouse = ParseMyMouseButtonsEnum(control[controlId]); if (!IsMouseButtonValid(mouse)) { throw new Exception("Mouse button \"" + mouse.ToString() + "\" is already assigned or is not valid."); } FindNotAssignedEditorControl(controlType, device).SetControl(mouse); break; case MyGuiInputDeviceEnum.Joystick: MyJoystickButtonsEnum joy = ParseMyJoystickButtonsEnum(control[controlId]); if (!IsJoystickButtonValid(joy)) { throw new Exception("Joystick button \"" + joy.ToString() + "\" is already assigned or is not valid."); } FindNotAssignedEditorControl(controlType, device).SetControl(joy); break; case MyGuiInputDeviceEnum.JoystickAxis: MyJoystickAxesEnum joyAxis = ParseMyJoystickAxesEnum(control[controlId]); if (!IsJoystickAxisValid(joyAxis)) { throw new Exception("Joystick axis \"" + joyAxis.ToString() + "\" is already assigned or is not valid."); } FindNotAssignedEditorControl(controlType, device).SetControl(joyAxis); break; case MyGuiInputDeviceEnum.None: break; default: break; } }
// Returns a string value of the button or key assigned to a control for editor. public String GetEditorControlTextEnum(MyEditorControlEnums control) { //return m_controlsList[(int)control].GetControlButtonName(); return m_editorControlsList[(int)control].GetControlButtonName(MyGuiInputDeviceEnum.Keyboard); }
// Check is an assigned control was released in previous state public bool WasEditorControlReleased(MyEditorControlEnums control) { // If you are trying to set a control that does not exist do nothing. if ((int)control > m_editorControlsList.Length) { return false; } if (m_editorControlsList[(int)control] == null) { return false; } return m_editorControlsList[(int)control].WasReleased(); }
// Check if an assigned control for editor is currently pressed. public float GetEditorControlAnalogState(MyEditorControlEnums control) { // If you are trying to set a control that does not exist do nothing. if ((int)control > m_editorControlsList.Length || m_editorControlsList[(int)control] == null) { return 0; } return m_editorControlsList[(int)control].GetAnalogState(); }