/// <summary> /// Creates new CustomGame object. /// </summary> public CustomGame(CustomGameBuilder customGameBuilder = null) { if (customGameBuilder == null) { customGameBuilder = new CustomGameBuilder(); } // Get the overwatch process. if (customGameBuilder.OverwatchProcess != null) { OverwatchProcess = customGameBuilder.OverwatchProcess; } else { OverwatchProcess = GetOverwatchProcess(); } if (OverwatchProcess == null) { throw new MissingOverwatchProcessException("Could not find any Overwatch processes running."); } // Initialize the LockHandler. LockHandler = new LockHandler(this); // Save the customGameBuilder values to the class. ScreenshotMethod = customGameBuilder.ScreenshotMethod; OpenChatIsDefault = customGameBuilder.OpenChatIsDefault; DefaultKeys = customGameBuilder.DefaultKeys; DisableInput = customGameBuilder.DisableInput; // Create a link between OnExit and OverwatchProcess.Exited. OverwatchProcess.EnableRaisingEvents = true; OverwatchProcess.Exited += InvokeOnExit; // Move the window to the correct position on the desktop for scanning and input. SetupWindow(); Thread.Sleep(250); // Create subclass instances. Commands = new Commands(this); AI = new AI(this); Chat = new Chat(this); Pause = new Pause(this); PlayerInfo = new PlayerInfo(this); Interact = new Interact(this); Settings = new Settings(this); UpdateScreen(); #if DEBUG if (customGameBuilder.DebugMode) { SetupDebugWindow(); } #endif if (OpenChatIsDefault) { Chat.OpenChat(); } else { Chat.CloseChat(); } StartPersistentScanning(); }