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 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); }