public static MyGuiHelperBase GetEditorControlHelper(MyEditorControlEnums controlHelper)
 {
     MyGuiHelperBase ret;
     if (m_editorControlHelpers.TryGetValue(controlHelper, out ret))
         return ret;
     else
         return null;
 }
示例#2
0
 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;
 }
示例#3
0
 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);
            }
        }
示例#5
0
 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;
 }
示例#6
0
 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;
 }
示例#7
0
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyMouseButtonsEnum defaultControl)
     : this(control, text, controlType, defaultControl, null, null, null)
 {
 }
示例#8
0
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, Keys defaultControl)
     : this(control, text, controlType, null, defaultControl, null, null)
 {
 }
示例#9
0
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyMouseButtonsEnum defaultControl)
     : this(control, text, controlType, defaultControl, null, null, null)
 {
 }
示例#10
0
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, Keys defaultControl)
     : this(control, text, controlType, null, defaultControl, null, null)
 {
 }
示例#11
0
 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.");
 }
示例#12
0
 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;
     }
 }
示例#13
0
 //  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);
 }
示例#14
0
        //  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();
        }
示例#15
0
        //  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();
        }