private async void Mapping_Result_Received(object sender, Map.Mapping.Result e) { if (!game.IsGameAutoPhase) { if (e.isCorrect) { await ShowCorrectUI(); } else if (!e.isCorrect & e.clickLocation != null) { await ShowWrongUI(e); } else if (!e.isCorrect & e.clickLocation == null) { await ShowWrongUI(e); } } else { // remove the current target location so it can't pop up again mapping.Locations_auto_temp.Remove(e.targetLocation); // update debug AutoPilot_RefreshDebug(); if (e.isCorrect) { mapping.ChangeLocationItemState(e.targetLocation, Map.LocationItem.Mode.ShowEllipseAndText); autopilot_correctcounter++; autopilot_correctlist.Add(e.targetLocation); await Task.Delay(TimeSpan.FromSeconds(1)); } else if (!e.isCorrect & e.clickLocation != null) { /* * mapping.ChangeLocationItemState(e.clickLocation, Map.LocationItem.Mode.ShowEllipseAndText); * await Task.Delay(TimeSpan.FromSeconds(0.5)); * mapping.ChangeLocationItemState(e.targetLocation, Map.LocationItem.Mode.ShowEllipseAndText); * await Task.Delay(autopilot_locationduration); * mapping.ChangeLocationItemState(mapping.TargetLocation, Map.LocationItem.Mode.Hide); */ await ShowWrongUI(e); autopilot_wrongcounter++; autopilot_wronglist.Add(e.targetLocation); if (game.AutoPhaseShowsCorrectionAfterWrongAnswer) { await Task.Delay(TimeSpan.FromSeconds(2)); } } else { await ShowWrongUI(e); autopilot_wrongcounter++; autopilot_wronglist.Add(e.targetLocation); if (game.AutoPhaseShowsCorrectionAfterWrongAnswer) { await Task.Delay(TimeSpan.FromSeconds(2)); } } AutoPilot_ChooseNextTarget(); } }
public async Task ShowWrongUI(Map.Mapping.Result e) { game.IsGameReady = false; HideTargetLocationIndicator(); if (e != null) { if (e.clickLocation != null & e.clickLocation != "") { mapping.ChangeLocationItemState(e.clickLocation, Map.LocationItem.Mode.ShowEllipseAndText_Error); await Task.Delay(TimeSpan.FromSeconds(.8)); } } // change game status game.ChangeGameStatus(Game.GameStatus.UI); TimeSpan duration; if (!game.IsGameAutoPhase) { duration = TimeSpan.FromSeconds(3); } else { duration = autopilot_chooseUI_duration; } UI_In.Begin(); UI_Wrong_In.Begin(); await Task.Delay(duration); UI_Wrong_Out.Begin(); await Task.Delay(TimeSpan.FromSeconds(.3)); UI_Out.Begin(); bool shouldShowCorrection = true; if (e != null & !game.IsGameAutoPhase) // if the game is played normally, show the correction. { shouldShowCorrection = true; } if (game.IsGameAutoPhase & game.AutoPhaseShowsCorrectionAfterWrongAnswer) // if the game is autopiloting, and correction is on, show correction { shouldShowCorrection = true; } if (game.IsGameAutoPhase & !game.AutoPhaseShowsCorrectionAfterWrongAnswer) // if the game is autopiloting, and correction is off, don't show correction { shouldShowCorrection = false; } if (shouldShowCorrection) { mapping.ChangeLocationItemState(mapping.TargetLocation, Map.LocationItem.Mode.ShowEllipseAndText); } game.ChangeGameStatus(Game.GameStatus.Waiting); }