public static void drawManeuverPager(NodeManager curState) { PatchedConicSolver solver = NodeTools.getSolver(); GUILayout.BeginHorizontal(); if(GUILayout.Button("<")) { int count = solver.maneuverNodes.Count; if(count > 1) { // get the previous or last node int idx = solver.maneuverNodes.IndexOf(curState.node); if(idx == 0) { curState.nextNode = solver.maneuverNodes[--count]; } else { curState.nextNode = solver.maneuverNodes[--idx]; } } } if(GUILayout.Button("Editing Node " + (solver.maneuverNodes.IndexOf(curState.node) + 1))) { MapView.MapCamera.SetTarget(curState.node.scaledSpaceTarget); } if(GUILayout.Button(">")) { int count = solver.maneuverNodes.Count; if(count > 1) { // get the previous or last node int idx = solver.maneuverNodes.IndexOf(curState.node); if(idx == count - 1) { curState.nextNode = solver.maneuverNodes[0]; } else { curState.nextNode = solver.maneuverNodes[++idx]; } } } GUILayout.EndHorizontal(); }
/// <summary> /// Overridden function from MonoBehavior /// </summary> public void Update() { if(!FlightDriver.Pause && canShowNodeEditor) { PatchedConicSolver solver = NodeTools.getSolver(); if(solver.maneuverNodes.Count > 0) { if(!curState.hasNode() || !solver.maneuverNodes.Contains(curState.node)) { // get the first one if we can't find the current or it's null curState = new NodeManager(solver.maneuverNodes[0]); } else if(curState.hasNode()) { curState.updateNode(); curState = curState.nextState(); } } else { if(curState.hasNode()) { curState = new NodeManager(); curState.resizeClockWindow = true; } } processKeyInput(); } }