public void Show(bool hasPlayerWon, ConfirmationContext context) { _context = context; var congratulations = hasPlayerWon ? "Yay, you've won!, so great!" : "Yay, you've ALMOST won! Neat!"; label.text = congratulations; gameObject.SetActive(true); }
private IEnumerator QuitConfirmRoutine() { var context = new ConfirmationContext(); confirmPopup.Setup("Are you sure you want to quit?", context); while (!context.IsFinished) { yield return(null); } if (context.IsConfirmed) { DoQuit(); } }
public void ShowInGame(ConfirmationContext doesUserWantToQuit) { _onLeftButtonClick = () => { gameObject.SetActive(false); doesUserWantToQuit.Cancel(); }; leftButtonLabel.text = "OK"; leftButton.gameObject.SetActive(true); _onRightButtonClick = () => StartQuitConfirmFlow(doesUserWantToQuit); rightButtonLabel.text = "Quit"; rightButton.gameObject.SetActive(true); gameObject.SetActive(true); }
private IEnumerator QuitConfirmationFlowRoutine(ConfirmationContext doesUserWantToQuit) { var menuManager = ManagerLocator.TryGet <MenuUIManager>(); var quitConfirm = new ConfirmationContext(); menuManager.ShowConfirmPopup("Back to main menu?", quitConfirm); while (!quitConfirm.IsFinished) { yield return(null); } if (quitConfirm.IsConfirmed) { gameObject.SetActive(false); doesUserWantToQuit.Confirm(); } }
private IEnumerator GameOverRoutine(GameController.GameResult playerHasWon) { var gc = ManagerLocator.TryGet <GameController>(); gc.PauseGame(true); if (playerHasWon != GameController.GameResult.PlayerQuit) { var playerWon = playerHasWon == GameController.GameResult.PlayerWon; var context = new ConfirmationContext(); gameOverPopup.Show(playerWon, context); while (!context.IsFinished) { yield return(null); } } gc.AbortGameServices(); ShowMainMenu(); }
private IEnumerator PauseGameRoutine(GameController gc) { gc.PauseGame(true); var doesUserWantToQuit = new ConfirmationContext(); settingsPopup.ShowInGame(doesUserWantToQuit); while (!doesUserWantToQuit.IsFinished) { yield return(null); } if (doesUserWantToQuit.IsConfirmed) { gc.HandlePlayerQuit(); } else { gc.PauseGame(false); } }
public void Setup(string thingToConfirm, ConfirmationContext context) { label.text = thingToConfirm; _context = context; gameObject.SetActive(true); }
private void Teardown() { _context = null; gameObject.SetActive(false); }
public void ShowConfirmPopup(string text, ConfirmationContext confirmContext) { confirmPopup.Setup(text, confirmContext); }
private void StartQuitConfirmFlow(ConfirmationContext doesUserWantToQuit) { StartCoroutine(QuitConfirmationFlowRoutine(doesUserWantToQuit)); }