public ResultPopupScreen(ScenarioResult result, Scenario scenario) { gameResult = result; gameScenario = scenario; if (result.Team1Human && !result.Team2Human) { if (result.Team1Win && !result.Team2Win) resultText = "Victory"; if (result.Team1Win && result.Team2Win) resultText = "Stalemate"; if (!result.Team1Win && result.Team2Win) resultText = "Defeat"; numStars = result.Team1ScoreRewarded; } if (!result.Team1Human && result.Team2Human) { if (!result.Team1Win && result.Team2Win) resultText = "Victory"; if (result.Team1Win && result.Team2Win) resultText = "Stalemate"; if (result.Team1Win && !result.Team2Win) resultText = "Defeat"; numStars = result.Team2ScoreRewarded; } if (result.Team1Human && result.Team2Human) { if (result.Team1Win && !result.Team2Win) resultText = "Red Wins"; if (result.Team1Win && result.Team2Win) resultText = "Stalemate"; if (!result.Team1Win && result.Team2Win) resultText = "Blue Wins"; } if (!result.Team1Human && !result.Team2Human) { if (result.Team1Win && !result.Team2Win) resultText = "Red Wins"; if (result.Team1Win && result.Team2Win) resultText = "Stalemate"; if (!result.Team1Win && result.Team2Win) resultText = "Blue Wins"; } TransitionOnTime = TimeSpan.FromSeconds(1.5); TransitionOffTime = TimeSpan.FromSeconds(1.5); IsPopup = true; EnabledGestures = GestureType.Tap; }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); bool found = false; foreach (GameScreen screen in ScreenManager.GetScreens()) { if (screen.GetType() == typeof(PauseBackgroundScreen)) found = true; } if (!found) { gameSession.Update(gameTime); if (gameSession.Team1Win || gameSession.Team2Win) { if (!resultReached) { resultReached = true; ScenarioResult result = new ScenarioResult(gameSession, gameScenario); ScreenManager.AddScreen(new ResultPopupScreen(result, gameScenario), null); } } } }