static bool Prefix() { return(Patcher.Run(() => { // If escape was not pressed or if it was pressed with either shift key we run the game's default function if (!Input.GetKeyDown(KeyCode.Escape) || (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) { return true; } WindowController.CloseAll(excludeSituations: WindowController.AnyTopPanelsVisible()); return false; })); }
public static void CloseAll(bool excludeSituations = false) { var prevLastClosed = lastClosed; lastClosed = DateTime.Now; WindowController.HideAllNotifications(); // We do a little throttling here because spamming esc can give some minor visual errors if ((prevLastClosed - lastClosed).TotalSeconds < 0.35) { Registry.Retrieve <INotifier>().PushTextToLog("__HideAllNotifications()"); // hijacked method } if (!excludeSituations) { Registry.Retrieve <TabletopManager>().CloseAllSituationWindowsExcept(null); } }