|
6 | 6 | using SpaceWarp.API.UI.Appbar; |
7 | 7 | using MicroEngineer.UI; |
8 | 8 | using KSP.Game; |
| 9 | +using BepInEx.Configuration; |
9 | 10 |
|
10 | 11 | namespace MicroMod |
11 | 12 | { |
12 | | - [BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.4.0")] |
| 13 | + [BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.5.0")] |
13 | 14 | [BepInDependency(SpaceWarpPlugin.ModGuid, SpaceWarpPlugin.ModVer)] |
14 | 15 | public class MicroEngineerMod : BaseSpaceWarpPlugin |
15 | 16 | { |
16 | 17 | public static MicroEngineerMod Instance { get; set; } |
17 | 18 | public string GUID; |
| 19 | + |
| 20 | + private ConfigEntry<bool> _enableKeybinding; |
| 21 | + private ConfigEntry<KeyCode> _keybind1; |
| 22 | + private ConfigEntry<KeyCode> _keybind2; |
18 | 23 |
|
19 | 24 | public override void OnInitialized() |
20 | 25 | { |
@@ -52,14 +57,20 @@ public override void OnInitialized() |
52 | 57 | OABSceneController.Instance.ShowGui = isOpen; |
53 | 58 | Utility.SaveLayout(); |
54 | 59 | }); |
| 60 | + |
| 61 | + _enableKeybinding = Config.Bind("Micro Engineer", "Enable keybinding", true, "Enables or disables keyboard shortcuts to show or hide windows in Flight and OAB scenes."); |
| 62 | + _keybind1 = Config.Bind("Micro Engineer", "Keycode 1", KeyCode.LeftControl, "First keycode."); |
| 63 | + _keybind2 = Config.Bind("Micro Engineer", "Keycode 2", KeyCode.E, "Second keycode."); |
55 | 64 | } |
56 | 65 |
|
57 | 66 | public void Update() |
58 | 67 | { |
59 | 68 | Manager.Instance.Update(); |
60 | 69 |
|
61 | | - // Keyboard shortcut for opening UI |
62 | | - if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.E)) |
| 70 | + // Keyboard shortcut for opening the UI |
| 71 | + if (_enableKeybinding.Value && |
| 72 | + (_keybind1.Value != KeyCode.None ? Input.GetKey(_keybind1.Value) : true) && |
| 73 | + (_keybind2.Value != KeyCode.None ? Input.GetKeyDown(_keybind2.Value) : true)) |
63 | 74 | { |
64 | 75 | if (Utility.GameState.GameState == GameState.FlightView || Utility.GameState.GameState == GameState.Map3DView) |
65 | 76 | { |
|
0 commit comments