private void ActionAvailableGameSavesLoaded(GooglePlayResult res) { GooglePlaySavedGamesManager.ActionAvailableGameSavesLoaded -= ActionAvailableGameSavesLoaded; if (res.IsSucceeded) { foreach (GP_SnapshotMeta meta in GooglePlaySavedGamesManager.Instance.AvailableGameSaves) { Debug.Log("Meta.Title: " + meta.Title); Debug.Log("Meta.Description: " + meta.Description); Debug.Log("Meta.CoverImageUrl): " + meta.CoverImageUrl); Debug.Log("Meta.LastModifiedTimestamp: " + meta.LastModifiedTimestamp); Debug.Log("Meta.TotalPlayedTime" + meta.TotalPlayedTime); } if (GooglePlaySavedGamesManager.Instance.AvailableGameSaves.Count > 0) { GP_SnapshotMeta s = GooglePlaySavedGamesManager.Instance.AvailableGameSaves[0]; AndroidDialog dialog = AndroidDialog.Create("Load Snapshot?", "Would you like to load " + s.Title); dialog.ActionComplete += OnSpanshotLoadDialogComplete; } } else { AndroidMessage.Create("Fail", "Available Game Saves Load failed"); } }
public void init() { #if UNITY_ANDROID AndroidDialog dialog = AndroidDialog.Create(title, message, yesButton, noButton); dialog.urlString = urlString; #endif }
private void OnInvite(string invitationId) { inviteId = invitationId; AndroidDialog dialog = AndroidDialog.Create("Invite", "You have new invite from firend", "Start Playing", "Open Inbox"); dialog.OnComplete += OnInvDialogComplete; }
void HandleInvitationReceived(UM_RTM_Invite invite) { inviteId = invite.Id; AndroidDialog dialog = AndroidDialog.Create("Invite", "You have new invite from: " + invite.SenderId, "Manage Manually", "Open Google Inbox"); dialog.ActionComplete += OnInvDialogComplete; }
//The timer script. public IEnumerator TIMER() { PlayerPrefs.SetInt("notificationCounter", 0); timer -= Time.deltaTime * 1; while (PlayerPrefs.GetInt("paused") == 0) { //Changes interactability of the buttons on study page. studyButton.interactable = false; resetButton.interactable = true; pauseButton.interactable = true; resumeButton.interactable = false; //Changes the color of the ring around the timer. timer -= Time.deltaTime; float value = timer / duration; fillImage.fillAmount = value; //Gets the time and displays it right under the timer. TimeSpan t = TimeSpan.FromSeconds(timer); PlayerPrefs.SetInt("hours", t.Hours); PlayerPrefs.SetInt("minutes", t.Minutes); PlayerPrefs.SetInt("seconds", t.Seconds); PlayerPrefs.SetString("timerString", string.Format("{0:0}:{1:00}:{2:00}", PlayerPrefs.GetInt("hours"), PlayerPrefs.GetInt("minutes"), PlayerPrefs.GetInt("seconds"))); text.text = PlayerPrefs.GetString("timerString"); yield return(null); //When time runs out. Create a popup and reset the timer. if (PlayerPrefs.GetInt("hours") <= 0 && PlayerPrefs.GetInt("minutes") <= 0 && PlayerPrefs.GetInt("seconds") <= 0 && PlayerPrefs.GetInt("notificationCounter") == 0 && PlayerPrefs.GetInt("hasPlayedBefore") == 2) { ResetClock(); Pause(); fillImage.fillAmount = 1f; PlayerPrefs.SetString("choice", "timer"); AndroidDialog.Create("Time's Up", "Try taking a break", "Sure", "No Thanks"); studyButton.interactable = true; resetButton.interactable = false; pauseButton.interactable = false; resumeButton.interactable = false; text.text = "Study"; PlayerPrefs.SetInt("notificationCounter", 1); PlayerPrefs.Save(); } if (PlayerPrefs.GetInt("paused") == 1 || PlayerPrefs.GetInt("paused") == 2) { PlayerPrefs.Save(); break; } } }
private void OnInvite(GP_Invite invitation) { if (invitation.InvitationType != GP_InvitationType.INVITATION_TYPE_REAL_TIME) { return; } inviteId = invitation.Id; AndroidDialog dialog = AndroidDialog.Create("Invite", "You have new invite from: " + invitation.Participant.DisplayName, "Manage Manually", "Open Google Inbox"); dialog.ActionComplete += OnInvDialogComplete; }
private void ActionAvailableDeviceAccountsLoaded(List <string> accounts) { string msg = "Device contains following google accounts:" + "\n"; foreach (string acc in GooglePlayManager.Instance.deviceGoogleAccountList) { msg += acc + "\n"; } AndroidDialog dialog = AndroidDialog.Create("Accounts Loaded", msg, "Sign With Fitst one", "Do Nothing"); dialog.ActionComplete += SighDialogComplete; }
private void OnInvDialogComplete(AndroidDialogResult result) { //parsing result switch (result) { case AndroidDialogResult.YES: AndroidDialog dialog = AndroidDialog.Create("Manage Invite", "Would you like to accept this invite?", "Accept", "Decline"); dialog.ActionComplete += OnInvManageDialogComplete; break; case AndroidDialogResult.NO: GooglePlayRTM.instance.OpenInvitationInBoxUI(); break; } }
public IEnumerator TIMER() { PlayerPrefs.SetInt("notificationCounter", 0); timer -= Time.deltaTime * 1; while (PlayerPrefs.GetInt("paused") == 0) { studyButton.interactable = false; resetButton.interactable = true; pauseButton.interactable = true; resumeButton.interactable = false; timer -= Time.deltaTime; float value = timer / duration; fillImage.fillAmount = value; TimeSpan t = TimeSpan.FromSeconds(timer); PlayerPrefs.SetInt("hours", t.Hours); PlayerPrefs.SetInt("minutes", t.Minutes); PlayerPrefs.SetInt("seconds", t.Seconds); PlayerPrefs.SetString("timerString", string.Format("{0:0}:{1:00}:{2:00}", PlayerPrefs.GetInt("hours"), PlayerPrefs.GetInt("minutes"), PlayerPrefs.GetInt("seconds"))); text.text = PlayerPrefs.GetString("timerString"); yield return(null); if (PlayerPrefs.GetInt("hours") <= 0 && PlayerPrefs.GetInt("minutes") <= 0 && PlayerPrefs.GetInt("seconds") <= 0 && PlayerPrefs.GetInt("notificationCounter") == 0 && PlayerPrefs.GetInt("hasPlayedBefore") == 2) { ResetClock(); Pause(); fillImage.fillAmount = 1f; AndroidDialog.Create("Time's Up", "Try taking a break", "Sure", "No Thanks"); studyButton.interactable = true; resetButton.interactable = false; pauseButton.interactable = false; resumeButton.interactable = false; text.text = "Study"; PlayerPrefs.SetInt("notificationCounter", 1); PlayerPrefs.Save(); } if (PlayerPrefs.GetInt("paused") == 1 || PlayerPrefs.GetInt("paused") == 2) { PlayerPrefs.Save(); break; } } }
//-------------------------------------- // INITIALIZE //-------------------------------------- //-------------------------------------- // PUBLIC METHODS //-------------------------------------- void OnGUI() { if (GUI.Button(new Rect(10, 10, 150, 50), "Rate Dialog PopUp")) { AndroidRateUsPopUp rate = AndroidRateUsPopUp.Create("Rate Us", rateText, rateUrl); rate.addEventListener(BaseEvent.COMPLETE, OnRatePopUpClose); } if (GUI.Button(new Rect(10, 70, 150, 50), "Dialog PopUp")) { AndroidDialog dialog = AndroidDialog.Create("Dialog Titile", "Dialog message"); dialog.addEventListener(BaseEvent.COMPLETE, OnDialogClose); } if (GUI.Button(new Rect(10, 130, 150, 50), "Message PopUp")) { AndroidMessage msg = AndroidMessage.Create("Message Titile", "Message message"); msg.addEventListener(BaseEvent.COMPLETE, OnMessageClose); } }
void OnPendingGiftsDetected(List <GPGameRequest> gifts) { AndroidDialog dialog = AndroidDialog.Create("Pending Gifts Detected", "You got few gifts from your friends, do you whant to take a look?"); dialog.ActionComplete += OnPromtGiftDialogClose; }
private void DialogPopUp() { AndroidDialog dialog = AndroidDialog.Create("Dialog Titile", "Dialog message"); dialog.OnComplete += OnDialogClose; }
private void OnPendingGiftsDetected(CEvent e) { AndroidDialog dialog = AndroidDialog.Create("Pending Gifts Detected", "You got few gifts from your friends, do you whant to take a look?"); dialog.addEventListener(BaseEvent.COMPLETE, OnPromtGiftDialogClose); }
public static void Popup(string title, string message, string yes, string no, string blah) { // Method that simplify creating a Popup AndroidDialog.Create(title, message, yes, no); PlayerPrefs.SetString("choice", blah); }
public void DialogPopUp() { AndroidDialog dialog = AndroidDialog.Create("Dialog Titile", "Dialog message"); dialog.ActionComplete += OnDialogClose; }
public void init() { AndroidDialog.Create(this.title, this.message, this.yesButton, this.noButton).urlString = this.urlString; }