public ControlWithDescription(MyGameControlEnums control) { MyControl c = MyGuiManager.GetInput().GetGameControl(control); Control = c.GetControlButtonStringBuilder(MyGuiInputDeviceEnum.Keyboard); Description = MyTextsWrapper.Get(c.GetControlName()); }
public ControlWithDescription(MyGameControlEnums control1, MyGameControlEnums control2) { MyControl c1 = MyGuiManager.GetInput().GetGameControl(control1); MyControl c2 = MyGuiManager.GetInput().GetGameControl(control2); Control = new StringBuilder().Append(c1.GetControlButtonStringBuilder(MyGuiInputDeviceEnum.Keyboard)).Append(", ").Append(c2.GetControlButtonStringBuilder(MyGuiInputDeviceEnum.Keyboard)); Description = new StringBuilder().Append(MyTextsWrapper.Get(c1.GetControlName())).Append(" / ").Append(MyTextsWrapper.Get(c2.GetControlName())); }
public static MyGuiHelperBase GetGameControlHelper(MyGameControlEnums controlHelper) { MyGuiHelperBase ret; if (m_gameControlHelpers.TryGetValue(controlHelper, out ret)) return ret; else return null; }
public MyControl(MyGameControlEnums 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 MyGuiScreenUseProgressBar(MyTextsWrapperEnum caption, StringBuilder text, float value, MySoundCuesEnum?progressCueEnum, MySoundCuesEnum?cancelCueEnum, MyGameControlEnums gameControl, int closeTime, int successTime, int decimals, MySoundCuesEnum?successCueEnum = null) : base(caption, text, value, progressCueEnum, cancelCueEnum, decimals, successCueEnum) { DrawMouseCursor = false; m_gameControl = gameControl; m_closeTime = closeTime; m_successTime = successTime; //m_startedTime = MyMinerGame.TotalGamePlayTimeInMilliseconds; }
public MyGuiScreenUseProgressBar(MyTextsWrapperEnum caption, StringBuilder text, float value, MySoundCuesEnum? progressCueEnum, MySoundCuesEnum? cancelCueEnum, MyGameControlEnums gameControl, int closeTime, int successTime, int decimals, MySoundCuesEnum? successCueEnum = null) : base(caption, text, value, progressCueEnum, cancelCueEnum, decimals, successCueEnum) { DrawMouseCursor = false; m_gameControl = gameControl; m_closeTime = closeTime; m_successTime = successTime; //m_startedTime = MyMinerGame.TotalGamePlayTimeInMilliseconds; }
public MyControl(MyGameControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType) { m_gameControl = control; m_gameControlType = MyGuiGameControlType.GAME; 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 GetGameControlHelper(MyGameControlEnums controlHelper) { MyGuiHelperBase ret; if (m_gameControlHelpers.TryGetValue(controlHelper, out ret)) { return(ret); } else { return(null); } }
public MyControl(MyGameControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, Keys defaultControl, Keys defaultSecondControl) : this(control, text, controlType, null, defaultControl, null, null) { m_keyboardKey2 = defaultSecondControl; }
public ControlWithDescription(StringBuilder controlString, MyGameControlEnums control) : this(controlString, MyTextsWrapper.Get(MyGuiManager.GetInput().GetGameControl(control).GetControlName())) { }
private void ShowOrHideNotification(bool show, ref MyHudNotification.MyNotification notification, MyTextsWrapperEnum text, MyGameControlEnums? gameControl) { if (show) { if (notification == null) { notification = new MyHudNotification.MyNotification(text, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR, null, null); if (gameControl.HasValue) { notification.SetTextFormatArguments(new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(gameControl.Value) }); } notification.Disappear(); } if (notification.IsDisappeared()) { notification.Appear(); MyHudNotification.AddNotification(notification); } } else { if (notification != null && !notification.IsDisappeared()) notification.Disappear(); } }
public MyControl(MyGameControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyMouseButtonsEnum defaultControl) : this(control, text, controlType, defaultControl, null, null, null) { }
public MyControl(MyGameControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, Keys defaultControl) : this(control, text, controlType, null, defaultControl, null, null) { }
public ControlWithDescription(MyGameControlEnums control, StringBuilder descriptionString) : this(new StringBuilder(MyGuiManager.GetInput().GetGameControlTextEnum(control)), descriptionString) { }
private void LoadGameControl(string controlName, MyGameControlEnums controlType, MyGuiInputDeviceEnum device) { switch (device) { case MyGuiInputDeviceEnum.Keyboard: Keys key = (Keys)Enum.Parse(typeof(Keys), controlName); if (!IsKeyValid(key)) { throw new Exception("Key \"" + key.ToString() + "\" is already assigned or is not valid."); } FindNotAssignedGameControl(controlType, device).SetControl(key); break; case MyGuiInputDeviceEnum.Mouse: MyMouseButtonsEnum mouse = ParseMyMouseButtonsEnum(controlName); if (!IsMouseButtonValid(mouse)) { throw new Exception("Mouse button \"" + mouse.ToString() + "\" is already assigned or is not valid."); } FindNotAssignedGameControl(controlType, device).SetControl(mouse); break; case MyGuiInputDeviceEnum.Joystick: MyJoystickButtonsEnum joy = ParseMyJoystickButtonsEnum(controlName); if (!IsJoystickButtonValid(joy)) { throw new Exception("Joystick button \"" + joy.ToString() + "\" is already assigned or is not valid."); } FindNotAssignedGameControl(controlType, device).SetControl(joy); break; case MyGuiInputDeviceEnum.JoystickAxis: MyJoystickAxesEnum joyAxis = ParseMyJoystickAxesEnum(controlName); if (!IsJoystickAxisValid(joyAxis)) { throw new Exception("Joystick axis \"" + joyAxis.ToString() + "\" is already assigned or is not valid."); } FindNotAssignedGameControl(controlType, device).SetControl(joyAxis); break; case MyGuiInputDeviceEnum.None: break; default: break; } }
public MyControl GetGameControl(MyGameControlEnums control) { return m_gameControlsList[(int)control]; }
// Check is an assigned control was released in previous state public bool WasGameControlReleased(MyGameControlEnums control) { // If you are trying to set a control that does not exist do nothing. if ((int)control > m_gameControlsList.Length) { return false; } if (m_gameControlsList[(int)control] == null) { return false; } return m_gameControlsList[(int)control].WasReleased(); }
// Returns a string value of the button or key assigned to a control for game. public String GetGameControlTextEnum(MyGameControlEnums control) { //return m_controlsList[(int)control].GetControlButtonName(); return m_gameControlsList[(int)control].GetControlButtonName(MyGuiInputDeviceEnum.Keyboard); }
public MyControl(MyGameControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyJoystickAxesEnum defaultControl) : this(control, text, controlType, null, null, null, defaultControl) { }
public MyPhysObjectSmallShipConfigItemBoolSwitch(StringBuilder name, bool isDefaultOn, Action onChangeValueCallback, Func<bool> isEnableCallback, int minChangeThreshold, MyGameControlEnums? associatedControl) : this(name, MyTextsWrapper.Get(MyTextsWrapperEnum.On), MyTextsWrapper.Get(MyTextsWrapperEnum.Off), isDefaultOn, onChangeValueCallback, isEnableCallback, minChangeThreshold, associatedControl) { }
public MyPhysObjectSmallShipConfigItemBoolSwitchWithLevel(StringBuilder name, float levelIntervalInSeconds, float levelMinValue, float levelMaxValue, StringBuilder trueText, StringBuilder falseText, bool isDefaultTrue, Action onChangeValue, Func<bool> isEnableCallback, int minChangeThreshold, MyGameControlEnums? associatedControl) : base(name, trueText, falseText, isDefaultTrue, onChangeValue, isEnableCallback, minChangeThreshold, associatedControl) { m_intervalInSeconds = levelIntervalInSeconds; m_levelMinValue = levelMinValue; m_levelMaxValue = levelMaxValue; m_levelChangePerSecond = (m_levelMaxValue - m_levelMinValue) / m_intervalInSeconds; }
public MyControl(MyGameControlEnums 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 MyGuiScreenUseProgressBar(MyTextsWrapperEnum caption, MyTextsWrapperEnum text, float value, MySoundCuesEnum? progressCueEnum, MySoundCuesEnum? cancelCueEnum, MyGameControlEnums gameControl, int closeTime, int successTime, int decimals, MySoundCuesEnum? successCueEnum = null) : this(caption, MyTextsWrapper.Get(text), value, progressCueEnum, cancelCueEnum, gameControl, closeTime, successTime, decimals, successCueEnum) { }
// Check if an assigned control for game is currently pressed. public float GetGameControlAnalogState(MyGameControlEnums control) { // If you are trying to set a control that does not exist do nothing. if ((int)control > m_gameControlsList.Length || m_gameControlsList[(int)control] == null) { return 0; } return m_gameControlsList[(int)control].GetAnalogState(); }
public MyPhysObjectSmallShipConfigItem(StringBuilder name, Action onChangeValueCallback, Func<bool> isEnableCallback, MyGameControlEnums? associatedControl) { Name = name; m_changeValueCallback = onChangeValueCallback; m_isEnableCallback = isEnableCallback; AssociatedControl = associatedControl; }
private MyControl FindNotAssignedGameControl(MyGameControlEnums type, MyGuiInputDeviceEnum deviceType) { foreach (var item in m_gameControlsList) { if (item.GetGameControlEnum().Value == type && item.IsControlAssigned(deviceType) == false) return item; } throw new Exception("Game control \"" + MyEnumsToStrings.GameControlEnums[(int)type] + "\" not found at control list or control is already assigned."); }
public MyPhysObjectSmallShipConfigItemBoolSwitch(StringBuilder name, StringBuilder trueText, StringBuilder falseText, bool isDefaultTrue, Action onChangeValue, Func<bool> isEnableCallback, int minChangeThreshold, MyGameControlEnums? associatedControl) : base(name, onChangeValue, isEnableCallback, associatedControl) { m_value = isDefaultTrue; m_trueText = trueText; m_falseText = falseText; m_minChangeThreshold = minChangeThreshold; }
public MyGuiScreenUseProgressBar(MyTextsWrapperEnum caption, MyTextsWrapperEnum text, float value, MySoundCuesEnum?progressCueEnum, MySoundCuesEnum?cancelCueEnum, MyGameControlEnums gameControl, int closeTime, int successTime, int decimals, MySoundCuesEnum?successCueEnum = null) : this(caption, MyTextsWrapper.Get(text), value, progressCueEnum, cancelCueEnum, gameControl, closeTime, successTime, decimals, successCueEnum) { }
public MyPhysObjectSmallShipConfigItemIntArray(int[] array, int defaultIndex, StringBuilder name, Action onChangeValueCallback, Func<bool> isEnableCallback, MyGameControlEnums? associatedControl) : base(name, onChangeValueCallback, isEnableCallback, associatedControl) { m_array = array; m_index = defaultIndex; m_texts = new StringBuilder[array.Length]; for (int i = 0; i < array.Length; i++) { m_texts[i] = new StringBuilder(array[i].ToString(CultureInfo.InvariantCulture)); } }