Skip to content

Commit 756f940

Browse files
author
Malah
committed
correct lock gui error, #41
1 parent 84de617 commit 756f940

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed
-3.5 KB
Binary file not shown.

QuickGoTo/QG_GUI.cs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -353,25 +353,27 @@ internal void RefreshStyle(bool force = false) {
353353
Log ("RefreshStyle force: " + force, "QGUI");
354354
}
355355

356-
void Lock(bool activate, ControlTypes Ctrl) {
357-
if (HighLogic.LoadedSceneIsEditor) {
358-
if (activate) {
359-
EditorLogic.fetch.Lock(true, true, true, "EditorLock" + MOD);
360-
} else {
361-
EditorLogic.fetch.Unlock ("EditorLock" + MOD);
362-
}
363-
}
364-
if (activate) {
365-
InputLockManager.SetControlLock (Ctrl, "Lock" + MOD);
366-
} else {
367-
InputLockManager.RemoveControlLock ("Lock" + MOD);
368-
}
369-
if (InputLockManager.GetControlLock ("Lock" + MOD) != ControlTypes.None) {
370-
InputLockManager.RemoveControlLock ("Lock" + MOD);
371-
}
372-
if (InputLockManager.GetControlLock ("EditorLock" + MOD) != ControlTypes.None) {
373-
InputLockManager.RemoveControlLock ("EditorLock" + MOD);
374-
}
356+
void Lock(bool activate, ControlTypes Ctrl) {
357+
if (HighLogic.LoadedSceneIsEditor) {
358+
if (activate) {
359+
if (InputLockManager.GetControlLock("EditorLock" + MOD) == ControlTypes.None) {
360+
EditorLogic.fetch.Lock(true, true, true, "EditorLock" + MOD);
361+
}
362+
} else {
363+
if (InputLockManager.GetControlLock("EditorLock" + MOD) != ControlTypes.None) {
364+
EditorLogic.fetch.Unlock("EditorLock" + MOD);
365+
}
366+
}
367+
}
368+
if (activate) {
369+
if (InputLockManager.GetControlLock("Lock" + MOD) == ControlTypes.None) {
370+
InputLockManager.SetControlLock(Ctrl, "Lock" + MOD);
371+
}
372+
return;
373+
}
374+
if (InputLockManager.GetControlLock("Lock" + MOD) != ControlTypes.None) {
375+
InputLockManager.RemoveControlLock("Lock" + MOD);
376+
}
375377
Log ("Lock " + activate, "QGUI");
376378
}
377379

QuickGoTo/QuickGoTo.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
<None Include="GameData\QuickMods\QuickGoTo\Textures\StockToolBar.dds" />
9090
<None Include="GameData\QuickMods\QuickGoTo\Textures\StockTS.dds" />
9191
<None Include="GameData\QuickMods\QuickGoTo\Textures\StockVAB.dds" />
92-
<None Include="Lang.cfg" />
9392
<None Include="Lang\en-us.cfg" />
9493
<None Include="Lang\fr-fr.cfg" />
9594
<None Include="GameData\QuickMods\QuickGoTo\Lang\en-us.cfg" />

0 commit comments

Comments
 (0)