public void Act() { if (!state.HasFlag(MenuState.ExitToMainMenuStart)) { // exit to main menu keyboard.Tap(SendInput.ScanCode.ESC); Thread.Sleep(1000); // wait for the menu to come up keyboard.TapWait(SendInput.ScanCode.KEY_W); keyboard.TapWait(SendInput.ScanCode.KEY_W); keyboard.TapWait(SendInput.ScanCode.SPACEBAR); // quit to menu Thread.Sleep(800); // wait a bit longer for the menu to load. keyboard.TapWait(SendInput.ScanCode.KEY_D); // select the yes option state |= MenuState.ExitToMainMenuStart; return; } if (!state.HasFlag(MenuState.YesExit)) { // in case there is a logout timer, wait until yes goes white if (menuSensor.MatchBlue(menuSensor.template_yes)) { keyboard.TapWait(SendInput.ScanCode.SPACEBAR); // confirm state |= MenuState.YesExit; } return; } if (!state.HasFlag(MenuState.Start)) { if (menuSensor.MatchScreen(menuSensor.template_start)) { keyboard.TapWait(SendInput.ScanCode.KEY_S); keyboard.TapWait(SendInput.ScanCode.SPACEBAR); // play game state |= MenuState.Start; } return; } if (!state.HasFlag(MenuState.ChooseMode)) { Thread.Sleep(1000); // give the menu time to open if (state.HasFlag(MenuState.Solo)) { // choose solo keyboard.TapWait(SendInput.ScanCode.KEY_S); keyboard.TapWait(SendInput.ScanCode.KEY_S); keyboard.TapWait(SendInput.ScanCode.SPACEBAR); } else { // choose nth private group keyboard.TapWait(SendInput.ScanCode.KEY_S); keyboard.TapWait(SendInput.ScanCode.SPACEBAR); Thread.Sleep(500); // wait for list of groups to open for (int i = 0; i < nPrivateGroup; i++) { keyboard.TapWait(SendInput.ScanCode.KEY_S); } nPrivateGroup++; keyboard.TapWait(SendInput.ScanCode.SPACEBAR); } state |= MenuState.ChooseMode; return; } if (!state.HasFlag(MenuState.LandedMenu)) { if (menuSensor.MatchMenuColour(menuSensor.template_landedmenu)) { keyboard.TapWait(SendInput.ScanCode.KEY_S); keyboard.TapWait(SendInput.ScanCode.SPACEBAR); // select Return To Surface keyboard.TapWait(SendInput.ScanCode.KEY_W); keyboard.TapWait(SendInput.ScanCode.SPACEBAR); // select Station Services state |= MenuState.LandedMenu; } return; } if (!state.HasFlag(MenuState.StationMenu)) { // Wait for the station menu to open if (menuSensor.MatchScreen(menuSensor.template_mission_unselected) || menuSensor.MatchScreen(menuSensor.template_mission_selected)) { state |= MenuState.StationMenu; } return; } if (!state.HasFlag(MenuState.MissionBoardSelected)) { // scroll down to mission board if (!menuSensor.MatchScreen(menuSensor.template_mission_selected)) { keyboard.TapWait(SendInput.ScanCode.KEY_S); } else { keyboard.Tap(SendInput.ScanCode.SPACEBAR); // open mission board state |= MenuState.MissionBoardSelected; } return; } state = MenuState.None; }