public void Update() { bool ctrl = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl); bool alt = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.LeftAlt); // mute/unmute messages with keyboard // done in update because unity is a mess if (ctrl && Input.GetKeyDown(KeyCode.N)) { if (!Message.IsMuted()) { Message.Post("Messages muted", "Be careful out there"); Message.Mute(); } else { Message.Unmute(); Message.Post("Messages unmuted"); } } // toggle body info window with keyboard if (alt && Input.GetKeyDown(KeyCode.N)) { BodyInfo.Toggle(); } // add progress descriptions to technologies techDescriptions(); }
public static void KeyboardInput() { // mute/unmute messages with keyboard if (Input.GetKeyDown(KeyCode.Pause)) { if (!Message.IsMuted()) { Message.Post("Messages muted", "Be careful out there"); Message.Mute(); } else { Message.Unmute(); Message.Post("Messages unmuted"); } } // toggle body info window with keyboard if (MapView.MapIsEnabled && Input.GetKeyDown(KeyCode.B)) { UI.Open(BodyInfo.Body_info); } // call action scripts // - avoid creating vessel data for invalid vessels Vessel v = FlightGlobals.ActiveVessel; if (v == null) { return; } VesselData vd = v.KerbalismData(); if (!vd.IsSimulated) { return; } // call scripts with 1-5 key if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1)) { vd.computer.Execute(v, ScriptType.action1); } if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2)) { vd.computer.Execute(v, ScriptType.action2); } if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3)) { vd.computer.Execute(v, ScriptType.action3); } if (Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Keypad4)) { vd.computer.Execute(v, ScriptType.action4); } if (Input.GetKeyDown(KeyCode.Alpha5) || Input.GetKeyDown(KeyCode.Keypad5)) { vd.computer.Execute(v, ScriptType.action5); } }
public static void KeyboardInput() { // mute/unmute messages with keyboard if (Input.GetKeyDown(KeyCode.Pause)) { if (!Message.IsMuted()) { Message.Post("Messages muted", "Be careful out there"); Message.Mute(); } else { Message.Unmute(); Message.Post("Messages unmuted"); } } // toggle body info window with keyboard if (MapView.MapIsEnabled && Input.GetKeyDown(KeyCode.B)) { UI.open(BodyInfo.body_info); } // call action scripts // - avoid creating vessel data for invalid vessels Vessel v = FlightGlobals.ActiveVessel; if (v != null && DB.vessels.ContainsKey(Lib.RootID(v))) { // get computer Computer computer = DB.Vessel(v).computer; // call scripts with 1-5 key if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1)) { computer.execute(v, ScriptType.action1); } if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2)) { computer.execute(v, ScriptType.action2); } if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3)) { computer.execute(v, ScriptType.action3); } if (Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Keypad4)) { computer.execute(v, ScriptType.action4); } if (Input.GetKeyDown(KeyCode.Alpha5) || Input.GetKeyDown(KeyCode.Keypad5)) { computer.execute(v, ScriptType.action5); } } }