void Update() { #if UNITY_ANDROID if (Input.GetKeyUp(KeyCode.Escape)) { // Ask if user wants to exit NativeUI.AlertPopup alert = NativeUI.ShowTwoButtonAlert("Exit App", "Do you want to exit?", "Yes", "No"); if (alert != null) { alert.OnComplete += delegate(int button) { if (button == 0) { Application.Quit(); } } } ; } #endif }
void Update() { // Exit on Android Back button if (Input.GetKeyUp(KeyCode.Escape)) { NativeUI.AlertPopup alert = NativeUI.ShowTwoButtonAlert( title, message, yesButton, noButton ); if (alert != null) { alert.OnComplete += (int button) => { switch (button) { case 0: // Yes Application.Quit(); break; case 1: // No break; } }; } } }
// This callback is called once the uploading has completed. // It receives the URL of the uploaded image. void OnGiphyUploadCompleted(string url) { progressText.text = "DONE"; isUploadingGif = false; uploadedGifUrl = url; #if UNITY_EDITOR bool shouldOpen = UnityEditor.EditorUtility.DisplayDialog("Upload Completed", "The GIF image has been uploaded to Giphy at " + url + ". Open it in the browser?", "Yes", "No"); if (shouldOpen) { Application.OpenURL(uploadedGifUrl); } #else NativeUI.AlertPopup alert = NativeUI.ShowTwoButtonAlert("Upload Completed", "The GIF image has been uploaded to Giphy at " + url + ". Open it in the browser?", "Yes", "No"); if (alert != null) { alert.OnComplete += (int buttonId) => { if (buttonId == 0) { Application.OpenURL(uploadedGifUrl); } }; } #endif }
IEnumerator CRWaitAndShowPopup(bool hasNewUpdate, string title, string message) { // Wait until no other alert is showing. while (NativeUI.IsShowingAlert()) { yield return(new WaitForSeconds(0.1f)); } if (!hasNewUpdate) { NativeUI.Alert(title, message); } else { NativeUI.AlertPopup alert = NativeUI.ShowTwoButtonAlert( title, message, "Yes", "No"); if (alert != null) { alert.OnComplete += (int button) => { if (button == 0) { NativeUI.Alert( "Open App Store", "The user has opted to update! In a real app you would want to open the app store for them to download the new version."); } }; } } }
// This callback is called once the GIF exporting has completed. // It receives the filepath of the generated image. void OnGifExportCompleted(AnimatedClip clip, string path) { progressText.text = "DONE"; isExportingGif = false; exportedGifPath = path; #if UNITY_EDITOR bool shouldUpload = UnityEditor.EditorUtility.DisplayDialog("Export Completed", "A GIF file has been created. Do you want to upload it to Giphy?", "Yes", "No"); if (shouldUpload) { UploadGIFToGiphy(); } #else NativeUI.AlertPopup popup = NativeUI.ShowTwoButtonAlert("Export Completed", "A GIF file has been created. Do you want to upload it to Giphy?", "Yes", "No"); if (popup != null) { popup.OnComplete += (int buttonId) => { if (buttonId == 0) { UploadGIFToGiphy(); } }; } #endif }
public void DeleteSavedGame() { if (selectedSavedGame == null) { NativeUI.Alert("Alert", "Please select a saved game by using the select UI or entering its name into the input box."); return; } else { NativeUI.AlertPopup alert = NativeUI.ShowTwoButtonAlert( "Delete Saved Game?", "Do you want to delete the saved game '" + selectedSavedGame.Name + "'?", "Yes", "No"); if (alert != null) { alert.OnComplete += (int button) => { if (button == 0) { GameServices.SavedGames.DeleteSavedGame(selectedSavedGame); selectedSavedGame = null; NativeUI.Alert("Alert", "Saved game deleted!"); } }; } } }
public void ShowOneButtonAlert() { NativeUI.AlertPopup alert = NativeUI.Alert("Sample Alert", "This is a simple (1-button) alert."); if (alert != null) { alert.OnComplete += OnAlertComplete; } }
public void ShowThreeButtonsAlert() { NativeUI.AlertPopup alert = NativeUI.ShowThreeButtonAlert("Sample Alert", "This is a 3-button alert.", "Button 1", "Button 2", "Button 3"); if (alert != null) { alert.OnComplete += OnAlertComplete; } }
public override void OnEnter() { NativeUI.AlertPopup alert = NativeUI.AlertPopup.Alert(title.Value, message.Value); if (alert != null) { alert.OnComplete += OnAlertComplete; } else { Finish(); } }
public override void OnEnter() { NativeUI.AlertPopup alert = NativeUI.ShowTwoButtonAlert( title.Value, message.Value, firstButtonLabel.Value, secondButtonLabel.Value ); if (alert != null) { alert.OnComplete += OnAlertComplete; } else { Finish(); } }
private void ResetPasswordWithEmailFailed() { NativeUI.AlertPopup alertPopup = NativeUI.Alert(AuthenticationsDebugs.ResetPasswordPaths.ResetPasswordFailed, AuthenticationsDebugs.ResetPasswordPaths.ResetPasswordFailedDetails); }
private void ResetPasswordWithEmailSuccessful() { NativeUI.AlertPopup alertPopup = NativeUI.Alert(AuthenticationsDebugs.ResetPasswordPaths.ResetPasswordSuccessful, AuthenticationsDebugs.ResetPasswordPaths.ResetPasswordSuccessfulDetails); BottomNavigationBarManager.Instance.ShowUserNavigation(); }