public void focus() { var enc = NodeTools.FindNextEncounter(); if (enc != null) { MapView.MapCamera.SetTarget(enc); } }
public string suggestPresetName() { var current = _parent.NodeManager.CurrentNode.patch.referenceBody; var next = NodeTools.FindNextEncounter(); if (current != null && next != null && current != next) { return(Localizer.Format("<<1>> - <<2>>", current.GetDisplayName(), next.GetDisplayName())); } return(""); }
internal void ProcessRegularHotkeys() { repeatButtonPressed = false; if (expectedHotkeyCooldown > 0) { expectedHotkeyCooldown--; return; } if (Input.anyKey && GUIUtility.keyboardControl == 0 && !KeyboardLocked) { ManeuverNode node = nodeManager.CurrentNode; // process normal keyboard input double dvx = 0; double dvy = 0; double dvz = 0; double dut = 0; bool changed = false; // prograde increment if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.PROGINC)) && RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.PROGINC))) { dvz += config.Increment; changed = true; } // prograde decrement if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.PROGDEC)) && RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.PROGDEC))) { dvz -= config.Increment; changed = true; } // prograde zero if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.PROGZER))) { nodeManager.ChangeNodeDVMult(1, 1, 0); } // normal increment if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.NORMINC)) && RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.NORMINC))) { dvy += config.Increment; changed = true; } // normal decrement if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.NORMDEC)) && RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.NORMDEC))) { dvy -= config.Increment; changed = true; } // normal zero if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.NORMZER))) { nodeManager.ChangeNodeDVMult(1, 0, 1); } // radial increment if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.RADIINC)) && RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.RADIINC))) { dvx += config.Increment; changed = true; } // radial decrement if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.RADIDEC)) && RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.RADIDEC))) { dvx -= config.Increment; changed = true; } // radial zero if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.RADIZER))) { nodeManager.ChangeNodeDVMult(0, 1, 1); } // UT increment if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.TIMEINC)) && RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.TIMEINC))) { dut += config.IncrementUt; changed = true; } // UT decrement if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.TIMEDEC)) && RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.TIMEDEC))) { dut -= config.IncrementUt; changed = true; } if (changed) { nodeManager.ChangeNodeDiff(dvx, dvy, dvz, dut); } // change increment if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.PAGEINC))) { if (Event.current.alt) { config.SetIncrementUp(); } else { config.SetIncrementDown(); } } // toggle x10 if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.PAGEX10))) { config.X10UTincrement = !config.X10UTincrement; } // next node if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.NEXTMAN))) { nodeManager.SwitchNextNode(); } // prev node if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.PREVMAN))) { nodeManager.SwitchPreviousNode(); } // delete node if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.MNVRDEL))) { nodeManager.DeleteNode(); } // turn orbit up if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.TURNOUP))) { if (RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.TURNOUP))) { nodeManager.TurnOrbitUp(); } } // turn orbit down if (Input.GetKey(config.GetHotkey(PreciseManeuverConfig.HotkeyType.TURNODN))) { if (RepeatButtonDelay(config.GetHotkey(PreciseManeuverConfig.HotkeyType.TURNODN))) { nodeManager.TurnOrbitDown(); } } // circularize orbit if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.CIRCORB))) { nodeManager.CircularizeOrbit(); } // focus on target if (Input.GetKeyDown(config.GetHotkey(PreciseManeuverConfig.HotkeyType.FOCNENC))) { var nextEnc = NodeTools.FindNextEncounter(); if (nextEnc != null) { MapObject mapObject = PlanetariumCamera.fetch.targets.Find(o => (o.celestialBody != null) && (o.celestialBody == nextEnc)); MapView.MapCamera.SetTarget(mapObject); } } } // manage the repeating hotkeys if (repeatButtonPressed) { if (repeatButtonPressInterval < 50) { repeatButtonPressInterval++; } repeatButtonReleaseInterval = 0; } else { if (repeatButtonReleaseInterval < 2) { repeatButtonReleaseInterval++; } else { if (repeatButtonReleaseInterval < 100) { nodeManager.EndAtomicChange(); repeatButtonReleaseInterval = 100; } repeatButtonPressInterval = 0; repeatButtonPressedCode = KeyCode.None; } } }