void Update() { if (!HighLogic.LoadedSceneIsFlight) { return; } Vessel _vessel = FlightGlobals.ActiveVessel; string[] _keys = Enum.GetNames(typeof(QKey.Key)); int _length = _keys.Length; for (int _key = 1; _key < _length; _key++) { QKey.Key _getKey = (QKey.Key)_key; if (_getKey == QKey.Key.WarpToNode) { continue; } if (QKey.isKeyDown(_getKey)) { StartCoroutine(startSAS(QKey.GetAutoPilot(_getKey))); ScreenMessages.PostScreenMessage(string.Format("[{0}] {1}", MOD, QKey.GetText(_getKey)), 5, ScreenMessageStyle.UPPER_CENTER); Log(QKey.GetText(_getKey), "QSAS"); } } if (QKey.isKeyDown(QKey.Key.WarpToNode)) { if (_vessel.patchedConicSolver.maneuverNodes.Count != 0) { double _UT; ManeuverNode _manNode = _vessel.patchedConicSolver.maneuverNodes[0]; if (!QSettings.Instance.WarpToEnhanced) { _UT = _manNode.UT - 60; } else { double _estimatedBurnTime = _manNode.GetBurnVector(_vessel.orbit).magnitude / _vessel.specificAcceleration; _UT = _manNode.UT - (_estimatedBurnTime / 2) - 15; } if (Planetarium.GetUniversalTime() > _UT) { ScreenMessages.PostScreenMessage(string.Format("[{0}] No need to time warp!", MOD), 5, ScreenMessageStyle.UPPER_CENTER); Log("No need to time warp!", "QSAS"); return; } TimeWarp.fetch.WarpTo(_UT); Log(QKey.GetText(QKey.Key.WarpToNode), "QSAS"); } else { ScreenMessages.PostScreenMessage(string.Format("[{0}] No maneuver node!", MOD), 5, ScreenMessageStyle.UPPER_CENTER); Log("No maneuver node!", "QSAS"); } } }
void Update() { if (QKey.SetKey == QKey.Key.None) { return; } if (Event.current.isKey) { KeyCode _key = Event.current.keyCode; if (_key != KeyCode.None) { QKey.SetCurrentKey(QKey.SetKey, _key); QKey.SetKey = QKey.Key.None; } } }
void DrawSettings(int id) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Box("Toolbars", GUILayout.Height(30)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); QSettings.Instance.StockToolBar = GUILayout.Toggle(QSettings.Instance.StockToolBar, "Use the Stock Toolbar", GUILayout.Width(400)); GUILayout.EndHorizontal(); if (QBlizzyToolbar.isAvailable) { GUILayout.BeginHorizontal(); QSettings.Instance.BlizzyToolBar = GUILayout.Toggle(QSettings.Instance.BlizzyToolBar, "Use the Blizzy Toolbar", GUILayout.Width(400)); GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); GUILayout.Box("Options", GUILayout.Height(30)); GUILayout.EndHorizontal(); QSettings.Instance.WarpToEnhanced = GUILayout.Toggle(QSettings.Instance.WarpToEnhanced, "Warp to the ½ of the burn time + 15 seconds", GUILayout.Width(400)); GUILayout.BeginHorizontal(); GUILayout.Box("Keyboard shortcuts", GUILayout.Height(30)); GUILayout.EndHorizontal(); QKey.DrawConfigKey(QKey.Key.Current); QKey.DrawConfigKey(QKey.Key.Prograde); QKey.DrawConfigKey(QKey.Key.Retrograde); QKey.DrawConfigKey(QKey.Key.Normal); QKey.DrawConfigKey(QKey.Key.AntiNormal); QKey.DrawConfigKey(QKey.Key.RadialIn); QKey.DrawConfigKey(QKey.Key.RadialOut); QKey.DrawConfigKey(QKey.Key.TargetPrograde); QKey.DrawConfigKey(QKey.Key.TargetRetrograde); QKey.DrawConfigKey(QKey.Key.Maneuver); QKey.DrawConfigKey(QKey.Key.WarpToNode); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Save & Close", GUILayout.Height(30))) { HideSettings(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
void DrawSettings(int id) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Box(Localizer.Format("quicksas_toolbars"), GUILayout.Height(30)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Box(Localizer.Format("quicksas_options"), GUILayout.Height(30)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); QSettings.Instance.WarpToEnhanced = GUILayout.Toggle(QSettings.Instance.WarpToEnhanced, Localizer.Format("quicksas_warpTime"), GUILayout.Width(400)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Box(Localizer.Format("quicksas_keyShortCuts"), GUILayout.Height(30)); GUILayout.EndHorizontal(); QKey.DrawConfigKey(QKey.Key.Current); QKey.DrawConfigKey(QKey.Key.Prograde); QKey.DrawConfigKey(QKey.Key.Retrograde); QKey.DrawConfigKey(QKey.Key.Normal); QKey.DrawConfigKey(QKey.Key.AntiNormal); QKey.DrawConfigKey(QKey.Key.RadialIn); QKey.DrawConfigKey(QKey.Key.RadialOut); QKey.DrawConfigKey(QKey.Key.TargetPrograde); QKey.DrawConfigKey(QKey.Key.TargetRetrograde); QKey.DrawConfigKey(QKey.Key.Maneuver); QKey.DrawConfigKey(QKey.Key.WarpToNode); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(Localizer.Format("quicksas_close"), GUILayout.Height(30))) { HideSettings(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
void OnGUI() { if (!WindowSettings) { return; } GUI.skin = HighLogic.Skin; if (QKey.SetKey != QKey.Key.None) { RectSetKey = GUILayout.Window(1545156, RectSetKey, QKey.DrawSetKey, string.Format("Set Key: {0}", QKey.GetText(QKey.SetKey)), GUILayout.ExpandHeight(true)); return; } RectSettings = GUILayout.Window(1545175, RectSettings, DrawSettings, MOD + " " + VERSION); }
void OnGUI() { if (!WindowSettings) { return; } GUI.skin = HighLogic.Skin; if (QKey.SetKey != QKey.Key.None) { RectSetKey = ClickThruBlocker.GUILayoutWindow(1545156, RectSetKey, QKey.DrawSetKey, Localizer.Format("quicksas_setKey", QKey.GetText(QKey.SetKey)), GUILayout.ExpandHeight(true)); return; } RectSettings = ClickThruBlocker.GUILayoutWindow(1545175, RectSettings, DrawSettings, RegisterToolbar.MOD + " " + RegisterToolbar.VERSION); }