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)));
         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);
     }
 }
 private void ShowControlIsAlreadyAssigned(MyControl control)
 {
     MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR,
         new StringBuilder(string.Format(MyTextsWrapper.Get(MyTextsWrapperEnum.ControlAlreadyAssigned).ToString(), control.GetControlButtonName(m_deviceType), MyTextsWrapper.Get(control.GetControlName()).ToString())),
         MyTextsWrapper.Get(MyTextsWrapperEnum.CanNotAssignControl), MyTextsWrapperEnum.Yes, MyTextsWrapperEnum.No,
         delegate(MyGuiScreenMessageBoxCallbackEnum r)
         {
             AssignAlreadyAssignedCommand(r, control);
         }));
 }
            public MyGuiControlAssignKeyMessageBox(Dictionary<MyControl, MyGuiControlButton> buttonsDictionary, MyGuiInputDeviceEnum deviceType, MyControl control, MyTextsWrapperEnum messageText)
                : base(MyMessageBoxType.NULL, messageText, MyTextsWrapperEnum.SelectControl, null)
            {
                DrawMouseCursor = false;
                m_isTopMostScreen = false;
                m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ProgressBackground", flags: TextureFlags.IgnoreQuality);
                m_size = new Vector2(598 / 1600f, 368 / 1200f);
                m_control = control;
                m_buttonsDictionary = buttonsDictionary;
                m_deviceType = deviceType;

                MyGuiManager.GetInput().GetListOfPressedKeys(m_oldPressedKeys);
                MyGuiManager.GetInput().GetListOfPressedMouseButtons(m_oldPressedMouseButtons);
                MyGuiManager.GetInput().GetListOfPressedJoystickButtons(m_oldPressedJoystickButtons);
                MyGuiManager.GetInput().GetListOfPressedJoystickAxes(m_oldPressedJoystickAxes);
                m_interferenceVideoColor = Vector4.One;
                m_closeOnEsc = false;
                m_screenCanHide = true;
                //Controls.Add(new MyGuiControlRotatingWheel(this, new Vector2(0, 0.05f), Vector4.One, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));
            }
Ejemplo n.º 4
0
        public MyControl Clone()
        {
            MyControl copy = (MyControl)this.MemberwiseClone();

            return(copy);
        }
Ejemplo n.º 5
0
 void CheckValidControls(MyControl[] controls)
 {
     foreach (MyControl control in controls)
     {                
         MyCommonDebugUtils.AssertDebug(IsKeyValid(control.GetKeyboardControl()));                
         MyCommonDebugUtils.AssertDebug(IsMouseButtonValid(control.GetMouseControl()));
         MyCommonDebugUtils.AssertDebug(IsJoystickButtonValid(control.GetJoystickControl()));                
     }
 }
Ejemplo n.º 6
0
 //  This is used to copy the list of controls into backup lists or for reverting changes to the list
 private static MyControl[] CloneControls(MyControl[] original, MyControl[] copy)
 {
     for (int i = 0; i < original.Length; i++)
     {   
         copy[i] = original[i].Clone();
     }
     return copy;
 }