diff --git a/Changelog.txt b/Changelog.txt index c370a3f..742d61e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,10 @@ ChangeLog +0.1.10.9 + Fixed Popupshown.cfg from having endless repeats of the popupshown = true appended + Fixed error which caused buildings to be non-clickable if clicking on a control in the window closed it (such as an X or a Close button) + Made all members of Log class to be internal, to avoid conflicts with KSP_Log + 0.1.10.6 Added missing files diff --git a/ClickThroughBlocker.version b/ClickThroughBlocker.version index 4d9b354..24e5f02 100644 --- a/ClickThroughBlocker.version +++ b/ClickThroughBlocker.version @@ -10,7 +10,7 @@ "MAJOR": 0, "MINOR": 1, "PATCH": 10, - "BUILD": 6 + "BUILD": 9 }, "KSP_VERSION_MIN": { "MAJOR": 1, diff --git a/ClickThroughBlocker/AssemblyVersion.cs b/ClickThroughBlocker/AssemblyVersion.cs index 3818ba7..92f6d55 100644 --- a/ClickThroughBlocker/AssemblyVersion.cs +++ b/ClickThroughBlocker/AssemblyVersion.cs @@ -5,4 +5,4 @@ using System.Reflection; - [assembly: AssemblyVersion("0.1.10.5")] + [assembly: AssemblyVersion("0.1.10.9")] diff --git a/ClickThroughBlocker/CBTGlobalMonitor.cs b/ClickThroughBlocker/CBTGlobalMonitor.cs index c85a77c..c33a6db 100644 --- a/ClickThroughBlocker/CBTGlobalMonitor.cs +++ b/ClickThroughBlocker/CBTGlobalMonitor.cs @@ -31,17 +31,13 @@ void FixedUpdate() if (HighLogic.CurrentGame.Parameters.CustomParams().focusFollowsclick) { - if (FocusLock.focusLockDict.Count > 0) - //Log.Info("CBTGlobalMonitor.FixedUpate, focusFollowsClick, count: " + ClickThruBlocker.focusLockDict.Count + ", timeTics: " + timeTics); foreach (var w in FocusLock.focusLockDict) { - // Log.Info("CBTGlobalMonitor.FixedUpate, lockName: " + w.Key + ", lastUpdated: " + w.Value.win.lastUpdated); if (w.Value.win.lastUpdated < globalTimeTics - 4) { - Log.Info("CBTGlobalMonitor.FixedUpate, FreeLock lockName: " + w.Key + ", lastUpdated: " + w.Value.win.lastUpdated); - FocusLock.FreeLock(w.Key,1); - w.Value.win.OnDestroy(); - break; + FocusLock.FreeLock(w.Key, 1); + w.Value.win.OnDestroy(); + break; } } } diff --git a/ClickThroughBlocker/CBTMonitor.cs b/ClickThroughBlocker/CBTMonitor.cs index 389d1f8..4a6f2ef 100644 --- a/ClickThroughBlocker/CBTMonitor.cs +++ b/ClickThroughBlocker/CBTMonitor.cs @@ -4,13 +4,12 @@ #if !DUMMY namespace ClickThroughFix { - //[KSPAddon(KSPAddon.Startup.SpaceCentre, true)] - [KSPAddon(KSPAddon.Startup.EditorAny, false)] + [KSPAddon(KSPAddon.Startup.SpaceCentre, true)] class CBTMonitor : MonoBehaviour { void Start() { - //DontDestroyOnLoad(this); + DontDestroyOnLoad(this); // GameEvents.onGameSceneLoadRequested.Add(onGameSceneLoadRequested); ClickThruBlocker.CTBWin.activeBlockerCnt = 0; } @@ -28,8 +27,6 @@ void Update() { if (HighLogic.CurrentGame.Parameters.CustomParams().focusFollowsclick) return; - - //if (HighLogic.LoadedSceneIsEditor ) { if (ClickThruBlocker.CTBWin.activeBlockerCnt > 0) { @@ -38,7 +35,6 @@ void Update() if (EditorLogic.fetch == null) { - Log.Info("EditorLogic.fetch == null"); return; } @@ -75,9 +71,7 @@ void LateUpdate() d = 0; ClickThruBlocker.CTBWin win = null; - //timeTics++; { - foreach (var w in ClickThruBlocker.winList) { if (w.Value.lastUpdated + 4 < CBTGlobalMonitor.globalTimeTics) //+ 0.05 < Planetarium.GetUniversalTime()) diff --git a/ClickThroughBlocker/ClearInputLocks.cs b/ClickThroughBlocker/ClearInputLocks.cs index 9766c6c..11f9b61 100644 --- a/ClickThroughBlocker/ClearInputLocks.cs +++ b/ClickThroughBlocker/ClearInputLocks.cs @@ -65,11 +65,14 @@ void ClearInputLocksToggle() internal static MonoBehaviour modeWindow = null; void CallModeWindow() { - ClickThroughFix.Log.Info("CallModeWindow, modeWindow: " + (modeWindow != null)); + //ClickThroughFix.Log.Info("CallModeWindow, modeWindow: " + (modeWindow != null)); if (modeWindow == null) modeWindow = gameObject.AddComponent(); else + { Destroy(modeWindow); + InputLockManager.ClearControlLocks(); + } } } } diff --git a/ClickThroughBlocker/ClickThroughBlocker.cs b/ClickThroughBlocker/ClickThroughBlocker.cs index 4ab7926..00aa37b 100644 --- a/ClickThroughBlocker/ClickThroughBlocker.cs +++ b/ClickThroughBlocker/ClickThroughBlocker.cs @@ -144,7 +144,7 @@ internal void PreventInFlightClickthrough(Rect r) { if (mouseOverWindow) { - Log.Info("PreventInFlightClickthrough, mouse clicked and over window, weLockedFlightInputs:" + weLockedFlightInputs + ", lockName: " + lockName); + //Log.Info("PreventInFlightClickthrough, mouse clicked and over window, weLockedFlightInputs:" + weLockedFlightInputs + ", lockName: " + lockName); if (!weLockedFlightInputs && !Input.GetMouseButton(1) && lockName != null) { //InputLockManager.SetControlLock(ControlTypes.ALLBUTCAMERAS, lockName); @@ -154,7 +154,7 @@ internal void PreventInFlightClickthrough(Rect r) } else { - Log.Info("PreventInFlightClickthrough, mouse clicked and NOT over window, weLockedFlightInputs:" + weLockedFlightInputs + ", lockName: " + lockName); + //Log.Info("PreventInFlightClickthrough, mouse clicked and NOT over window, weLockedFlightInputs:" + weLockedFlightInputs + ", lockName: " + lockName); if (weLockedFlightInputs && lockName != null) { diff --git a/ClickThroughBlocker/FocusLock.cs b/ClickThroughBlocker/FocusLock.cs index 0c52f0e..ef63cd3 100644 --- a/ClickThroughBlocker/FocusLock.cs +++ b/ClickThroughBlocker/FocusLock.cs @@ -19,8 +19,6 @@ internal FocusLock(string lockName, ClickThruBlocker.CTBWin win) internal static void SetLock(string lockName, ClickThruBlocker.CTBWin win, int i) { - Log.Info("SetLock: " + lockName + ", i: " + i); - FocusLock focusLock; if (HighLogic.LoadedSceneIsEditor) EditorLogic.fetch.Lock(true, true, true, lockName); @@ -39,7 +37,6 @@ internal static void SetLock(string lockName, ClickThruBlocker.CTBWin win, int i internal static void FreeLock(string lockName, int i) { focusLockDict.Remove(lockName); - Log.Info("FreeLock: " + lockName + ", i: " + i); // flight if (!HighLogic.LoadedSceneIsEditor) InputLockManager.RemoveControlLock(lockName); diff --git a/ClickThroughBlocker/Log.cs b/ClickThroughBlocker/Log.cs index 6fe3864..8b6d1f8 100644 --- a/ClickThroughBlocker/Log.cs +++ b/ClickThroughBlocker/Log.cs @@ -9,7 +9,7 @@ namespace ClickThroughFix { internal static class Log { - public enum LEVEL + internal enum LEVEL { OFF = 0, ERROR = 1, @@ -20,27 +20,27 @@ public enum LEVEL }; static string PREFIX = "ClickThroughBlocker: "; - public static void setTitle(string t) + internal static void setTitle(string t) { PREFIX = t + ": "; } - public static LEVEL level = LEVEL.INFO; + internal static LEVEL level = LEVEL.INFO; - public static LEVEL GetLevel() + internal static LEVEL GetLevel() { return level; } - public static void SetLevel(LEVEL level) + internal static void SetLevel(LEVEL level) { UnityEngine.Debug.Log("log level " + level); Log.level = level; } - public static LEVEL GetLogLevel() + internal static LEVEL GetLogLevel() { return level; } @@ -50,12 +50,12 @@ private static bool IsLevel(LEVEL level) return level == Log.level; } - public static bool IsLogable(LEVEL level) + internal static bool IsLogable(LEVEL level) { return level <= Log.level; } - public static void Trace(String msg) + internal static void Trace(String msg) { if (IsLogable(LEVEL.TRACE)) { @@ -63,7 +63,7 @@ public static void Trace(String msg) } } - public static void Detail(String msg) + internal static void Detail(String msg) { if (IsLogable(LEVEL.DETAIL)) { @@ -72,7 +72,7 @@ public static void Detail(String msg) } [ConditionalAttribute("DEBUG")] - public static void Info(String msg) + internal static void Info(String msg) { if (IsLogable(LEVEL.INFO)) @@ -82,7 +82,7 @@ public static void Info(String msg) } // [ConditionalAttribute("DEBUG")] - public static void Test(String msg) + internal static void Test(String msg) { //if (IsLogable(LEVEL.INFO)) { @@ -91,7 +91,7 @@ public static void Test(String msg) } - public static void Warning(String msg) + internal static void Warning(String msg) { if (IsLogable(LEVEL.WARNING)) { @@ -99,7 +99,7 @@ public static void Warning(String msg) } } - public static void Error(String msg) + internal static void Error(String msg) { if (IsLogable(LEVEL.ERROR)) { @@ -107,7 +107,7 @@ public static void Error(String msg) } } - public static void Exception(Exception e) + internal static void Exception(Exception e) { Log.Error("exception caught: " + e.GetType() + ": " + e.Message); } diff --git a/ClickThroughBlocker/OneTimePopup.cs b/ClickThroughBlocker/OneTimePopup.cs index 5354233..7bc693e 100644 --- a/ClickThroughBlocker/OneTimePopup.cs +++ b/ClickThroughBlocker/OneTimePopup.cs @@ -3,6 +3,7 @@ using KSP.IO; using UnityEngine; +using ClickThroughFix; namespace ClearAllInputLocks @@ -37,12 +38,20 @@ public void Start() popupRect.y = (Screen.height - HEIGHT) / 2; } +#if false + void OnDestroy() + { + InputLockManager.ClearControlLocks(); + } +#endif + public void OnGUI() { if (visible) { GUI.skin = HighLogic.Skin; - popupRect = ClickThroughFix.ClickThruBlocker.GUILayoutWindow(847733455, popupRect, PopUpWindow, "Click Through Blocker Focus Setting"); + //popupRect = GUILayout.Window(847733455, popupRect, PopUpWindow, "Click Through Blocker Focus Setting"); + popupRect = ClickThruBlocker.GUILayoutWindow(84733455, popupRect, PopUpWindow, "Click Through Blocker Focus Setting"); } } @@ -102,7 +111,8 @@ void PopUpWindow(int id) void CreatePopUpFlagFile() { - System.IO.File.AppendAllText(POPUP_FILE_FLAG, "popupshown = true"); + RemovePopUpFlagFile(); // remove first to avoid any overwriting + System.IO.File.WriteAllText(POPUP_FILE_FLAG, "popupshown = true"); } public static void RemovePopUpFlagFile() diff --git a/ClickThroughBlocker/SceneChangeCleanup.cs b/ClickThroughBlocker/SceneChangeCleanup.cs index 32a7256..395c5de 100644 --- a/ClickThroughBlocker/SceneChangeCleanup.cs +++ b/ClickThroughBlocker/SceneChangeCleanup.cs @@ -27,7 +27,6 @@ void onGameSceneLoadRequested(GameScenes gs) if (!ongameSceneLoadRequestedCalled) { ongameSceneLoadRequestedCalled = true; - ClickThroughFix.Log.Info("SceneChangeCleanup.onGameSceneLoadRequested"); InputLockManager.ClearControlLocks(); } } @@ -38,7 +37,6 @@ void onGUIApplicationLauncherReady() if (!onGUIApplicationLauncherReadyCalled) { onGUIApplicationLauncherReadyCalled = true; - ClickThroughFix.Log.Info("SceneChangeCleanup.onGUIApplicationLauncherReady"); if (!isRunning) StartCoroutine("CleanupInputLocks"); } @@ -47,11 +45,9 @@ void onGUIApplicationLauncherReady() bool onLevelWasLoadedGUIReadycalled = false; void onLevelWasLoadedGUIReady(GameScenes gs) { - Log.Info("onLevelWasLoadedGUIReady"); if (!onLevelWasLoadedGUIReadycalled) { onLevelWasLoadedGUIReadycalled = true; - ClickThroughFix.Log.Info("SceneChangeCleanup.onLevelWasLoadedGUIReady"); if (!isRunning) StartCoroutine("CleanupInputLocks"); } diff --git a/GameData/000_ClickThroughBlocker/ClickThroughBlocker.version b/GameData/000_ClickThroughBlocker/ClickThroughBlocker.version index 3ea791d..24e5f02 100644 --- a/GameData/000_ClickThroughBlocker/ClickThroughBlocker.version +++ b/GameData/000_ClickThroughBlocker/ClickThroughBlocker.version @@ -10,7 +10,7 @@ "MAJOR": 0, "MINOR": 1, "PATCH": 10, - "BUILD": 5 + "BUILD": 9 }, "KSP_VERSION_MIN": { "MAJOR": 1, diff --git a/GameData/000_ClickThroughBlocker/changelog.cfg b/GameData/000_ClickThroughBlocker/changelog.cfg index 5371049..70ab96e 100644 --- a/GameData/000_ClickThroughBlocker/changelog.cfg +++ b/GameData/000_ClickThroughBlocker/changelog.cfg @@ -5,7 +5,38 @@ KERBALCHANGELOG license = Lesser GPLv3 author = Linuxgurugamer + VERSION + { + version = 0.1.10.8 + CHANGE + { + change = Fixed buildings being non-clickable after selecting FocusFollowsMouse + type = update + } + } + + VERSION + { + version = 1.0.10.7 + CHANGE + { + change = Internal cleanup + type = update + subchange = Made all members of Log class to be internal, to avoid conflicts with KSP_Log + } + } + VERSION + { + version = 1.0.10.6 + CHANGE + { + change = Added missing files + type = update + } + } + + VERSION { version = 1.0.10.5 CHANGE diff --git a/changelog.cfg b/changelog.cfg index 5371049..2f4468e 100644 --- a/changelog.cfg +++ b/changelog.cfg @@ -5,7 +5,41 @@ KERBALCHANGELOG license = Lesser GPLv3 author = Linuxgurugamer + VERSION + { + version = 0.1.10.9 + CHANGE + { + change = Fixed lock issues + type = update + subchange = Fixed Popupshown.cfg from having endless repeats of the popupshown = true appended + subchange = Fixed error which caused buildings to be non-clickable if clicking on a control in the window closed it (such as an X or a Close button) + subchange = Made all members of Log class to be internal, to avoid conflicts with KSP_Log + } + } + + VERSION + { + version = 1.0.10.7 + CHANGE + { + change = Internal cleanup + type = update + subchange = Made all members of Log class to be internal, to avoid conflicts with KSP_Log + } + } + VERSION + { + version = 1.0.10.6 + CHANGE + { + change = Added missing files + type = update + } + } + + VERSION { version = 1.0.10.5 CHANGE