/// <summary> /// Processes keyboard input. /// </summary> private void processKeyInput() { if (!Input.anyKeyDown) { return; } // Fix for a bug in Linux where typing would still control game elements even if // a textbox was focused. if (GUIUtility.keyboardControl != 0) { return; } // process any key input for settings if (waitForKey) { KeyCode key = NodeTools.fetchKey(); // if the time is up or we have no key to process, reset. if (((keyWaitTime + 5.0) < Planetarium.GetUniversalTime()) || key == KeyCode.None) { currentWaitKey = 255; waitForKey = false; return; } // which key are we waiting for? switch (currentWaitKey) { case (byte)KEYS.PROGINC: options.progInc = key; break; case (byte)KEYS.PROGDEC: options.progDec = key; break; case (byte)KEYS.NORMINC: options.normInc = key; break; case (byte)KEYS.NORMDEC: options.normDec = key; break; case (byte)KEYS.RADIINC: options.radiInc = key; break; case (byte)KEYS.RADIDEC: options.radiDec = key; break; case (byte)KEYS.TIMEINC: options.timeInc = key; break; case (byte)KEYS.TIMEDEC: options.timeDec = key; break; case (byte)KEYS.PAGEINC: options.pageIncrement = key; break; case (byte)KEYS.PAGECON: options.pageConics = key; break; case (byte)KEYS.HIDEWINDOW: options.hideWindow = key; break; case (byte)KEYS.ADDWIDGET: options.addWidget = key; break; } currentWaitKey = 255; waitForKey = false; return; } // process normal keyboard input // change increment if (Input.GetKeyDown(options.pageIncrement)) { if (Event.current.alt) { options.downIncrement(); } else { options.upIncrement(); } } // prograde increment if (Input.GetKeyDown(options.progInc)) { curState.addPrograde(options.increment); } // prograde decrement if (Input.GetKeyDown(options.progDec)) { curState.addPrograde(options.increment * -1.0); } // normal increment if (Input.GetKeyDown(options.normInc)) { curState.addNormal(options.increment); } // normal decrement if (Input.GetKeyDown(options.normDec)) { curState.addNormal(options.increment * -1.0); } // radial increment if (Input.GetKeyDown(options.radiInc)) { curState.addRadial(options.increment); } // radial decrement if (Input.GetKeyDown(options.radiDec)) { curState.addRadial(options.increment * -1.0); } // UT increment if (Input.GetKeyDown(options.timeInc)) { curState.addUT(options.increment * (options.largeUTIncrement ? 10.0 : 1.0)); } // UT decrement if (Input.GetKeyDown(options.timeDec)) { curState.addUT(options.increment * (options.largeUTIncrement ? -10.0 : -1.0)); } // Page Conics if (Input.GetKeyDown(options.pageConics)) { options.pageConicsMode(); } // hide/show window if (Input.GetKeyDown(options.hideWindow)) { shown = !shown; } // open node gizmo if (Input.GetKeyDown(options.addWidget)) { NodeTools.CreateNodeGizmo(curState.node); } }