private MyGuiScreenMessageBox MakeControlIsAlreadyAssignedDialog(MyControl controlAlreadySet, StringBuilder controlButtonName) { return MyGuiSandbox.CreateMessageBox( buttonType: MyMessageBoxButtonsType.YES_NO, messageText: new StringBuilder(string.Format(MyTexts.GetString(MyCommonTexts.ControlAlreadyAssigned), controlButtonName, MyTexts.Get(controlAlreadySet.GetControlName()))), messageCaption: MyTexts.Get(MyCommonTexts.CanNotAssignControl)); }
public MyGuiControlAssignKeyMessageBox(MyGuiInputDeviceEnum deviceType, MyControl controlBeingSet, MyStringId messageText) : base( styleEnum: MyMessageBoxStyleEnum.Error, buttonType: MyMessageBoxButtonsType.NONE, messageText: MyTexts.Get(messageText), messageCaption: MyTexts.Get(MyCommonTexts.SelectControl), okButtonText: default(MyStringId), cancelButtonText: default(MyStringId), yesButtonText: default(MyStringId), noButtonText: default(MyStringId), callback: null, timeoutInMiliseconds: 0, focusedResult: ResultEnum.YES, canHideOthers: true, size: null) { DrawMouseCursor = false; m_isTopMostScreen = false; m_controlBeingSet = controlBeingSet; m_deviceType = deviceType; MyInput.Static.GetListOfPressedKeys(m_oldPressedKeys); MyInput.Static.GetListOfPressedMouseButtons(m_oldPressedMouseButtons); m_closeOnEsc = false; CanBeHidden = true; }
private void ShowControlIsAlreadyAssigned(MyControl controlAlreadySet, StringBuilder controlButtonName, Action overwriteAssignmentCallback) { Debug.Assert(controlAlreadySet != null); Debug.Assert(overwriteAssignmentCallback != null); var messageBox = MakeControlIsAlreadyAssignedDialog(controlAlreadySet, controlButtonName); messageBox.ResultCallback = delegate(ResultEnum r) { if (r == ResultEnum.YES) { overwriteAssignmentCallback(); CloseScreen(); } else { MyInput.Static.GetListOfPressedKeys(m_oldPressedKeys); MyInput.Static.GetListOfPressedMouseButtons(m_oldPressedMouseButtons); } }; MyGuiSandbox.AddScreen(messageBox); }
private MyGuiControlButton MakeControlButton(MyControl control, Vector2 position, MyGuiInputDeviceEnum device) { StringBuilder boundText = null; control.AppendBoundButtonNames(ref boundText, device); MyControl.AppendUnknownTextIfNeeded(ref boundText, MyTexts.GetString(MyCommonTexts.UnknownControl_None)); var button = new MyGuiControlButton( position: position, text: boundText, onButtonClick: OnControlClick, visualStyle: MyGuiControlButtonStyleEnum.ControlSetting, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); button.UserData = new ControlButtonData(control, device); return button; }
public ControlButtonData(MyControl control, MyGuiInputDeviceEnum device) { this.Control = control; this.Device = device; }
public void CopyFrom(MyControl other) { m_data = other.m_data; }
protected override void InitInput() { base.InitInput(); // Add signals render mode toggle control MyGuiDescriptor helper = new MyGuiDescriptor(MyCommonTexts.ControlName_ToggleSignalsMode, MyCommonTexts.ControlName_ToggleSignalsMode_Tooltip); MyGuiGameControlsHelpers.Add(MyControlsSpace.TOGGLE_SIGNALS, helper); MyControl control = new MyControl(MyControlsSpace.TOGGLE_SIGNALS, helper.NameEnum, MyGuiControlTypeEnum.Systems1, null, MyKeys.H, description: helper.DescriptionEnum); MyInput.Static.AddDefaultControl(MyControlsSpace.TOGGLE_SIGNALS, control); // Add cube size build mode for cube builder control helper = new MyGuiDescriptor(MyCommonTexts.ControlName_CubeSizeMode, MyCommonTexts.ControlName_CubeSizeMode_Tooltip); MyGuiGameControlsHelpers.Add(MyControlsSpace.CUBE_BUILDER_CUBESIZE_MODE, helper); control = new MyControl(MyControlsSpace.CUBE_BUILDER_CUBESIZE_MODE, helper.NameEnum, MyGuiControlTypeEnum.Systems3, null, MyKeys.R, description: helper.DescriptionEnum); MyInput.Static.AddDefaultControl(MyControlsSpace.CUBE_BUILDER_CUBESIZE_MODE, control); }
protected static void AddDefaultGameControl( Dictionary<MyStringId, MyControl> self, MyGuiControlTypeEnum controlTypeEnum, MyStringId controlId, MyMouseButtonsEnum? mouse = null, MyKeys? key = null, MyKeys? key2 = null) { var helper = MyGuiGameControlsHelpers.GetGameControlHelper(controlId); self[controlId] = new MyControl(controlId, helper.NameEnum, controlTypeEnum, mouse, key, defaultControlKey2: key2, description: helper.DescriptionEnum); }
public void AddDefaultControl(MyStringId stringId, MyControl control) { }
public void AddDefaultControl(MyStringId stringId, MyControl control) { #if !XB1_SKIPASSERTFORNOW Debug.Assert(false, "Not implemented!"); #endif // !XB1_SKIPASSERTFORNOW }
public void AddDefaultControl(MyStringId stringId, MyControl control) { m_gameControlsList[stringId] = control; m_defaultGameControlsList[stringId] = control; }
public MyControl(MyControl other) { this.CopyFrom(other); }
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); }
protected override void InitInput() { base.InitInput(); // Add signals render mode toggle control MyGuiDescriptor helper = new MyGuiDescriptor(MyCommonTexts.ControlName_ToggleSignalsMode, MyCommonTexts.ControlName_ToggleSignalsMode_Tooltip); MyGuiGameControlsHelpers.Add(MyControlsSpace.TOGGLE_SIGNALS, helper); MyControl control = new MyControl(MyControlsSpace.TOGGLE_SIGNALS, helper.NameEnum, MyGuiControlTypeEnum.Systems1, null, MyKeys.H, description: helper.DescriptionEnum); MyInput.Static.AddDefaultControl(MyControlsSpace.TOGGLE_SIGNALS, control); }
private void OverwriteAssignment(MyControl controlAlreadySet, MyMouseButtonsEnum button) { Debug.Assert(controlAlreadySet != null); Debug.Assert(m_deviceType == MyGuiInputDeviceEnum.Mouse); Debug.Assert(controlAlreadySet.GetMouseControl() == button); controlAlreadySet.SetControl(MyMouseButtonsEnum.None); m_controlBeingSet.SetControl(button); }