public void forgetSendEmail() { if (forgetEmail.text.Length == 0) { MNPopup mNPopup = new MNPopup("Error", "Please Input Correct!"); mNPopup.AddAction("Ok", () => { Debug.Log("Ok action callback"); }); mNPopup.Show(); } else { //MNP.ShowPreloader("", ""); ParseUser.RequestPasswordResetAsync(forgetEmail.text).ContinueWith(t => { MNP.HidePreloader(); if (t.IsFaulted) { // Errors from Parse Cloud and network interactions using (IEnumerator <System.Exception> enumerator = t.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException error = (ParseException)enumerator.Current; // error.Message will contain an error message // error.Code will return "OtherCause" UnityMainThreadDispatcher.Instance().Enqueue(showErrorWithMessage(error.Message)); } } } else { UnityMainThreadDispatcher.Instance().Enqueue(showSuccessWithMessage("Send Email Successful!")); } }); } }
private void SendNotification(string message, string recepientId) { var messageData = new Dictionary <string, string> { { "open_messages_for_id", GetSocial.User.Id } }; var builder = GetSocialAction.CreateBuilder("open_chat_message"); builder.AddActionData(messageData); var notificationContent = NotificationContent.NotificationWithText(message) .WithTitle(GetSocial.User.DisplayName) .WithAction(builder.Build()); var recepients = new List <string> { recepientId }; GetSocial.User.SendNotification(recepients, notificationContent, summary => { MNP.HidePreloader(); }, error => { MNP.HidePreloader(); }); }
public void changeNickNameConfirm() { if (changeNickName.text.Length == 0) { MNPopup mNPopup = new MNPopup("Error", "Please Input Correct!"); mNPopup.AddAction("Ok", () => { Debug.Log("Ok action callback"); }); mNPopup.Show(); } else { ParseUser.CurrentUser["nickName"] = changeNickName.text; //MNP.ShowPreloader("", ""); ParseUser.CurrentUser.SaveAsync().ContinueWith(t => { MNP.HidePreloader(); if (t.IsFaulted) { // Errors from Parse Cloud and network interactions using (IEnumerator <System.Exception> enumerator = t.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException error = (ParseException)enumerator.Current; // error.Message will contain an error message // error.Code will return "OtherCause" UnityMainThreadDispatcher.Instance().Enqueue(showErrorWithMessage(error.Message)); } } } else { UnityMainThreadDispatcher.Instance().Enqueue(changedNickname()); } }); } }
void OnGUI() { UpdateToStartPos(); GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Native Pop Ups", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Rate PopUp with events")) { MNRateUsPopup rateUs = new MNRateUsPopup("rate us", "rate us, please", "Rate Us", "No, Thanks", "Later"); rateUs.SetAppleId(appleId); rateUs.SetAndroidAppUrl(androidAppUrl); rateUs.AddDeclineListener(() => { Debug.Log("rate us declined"); }); rateUs.AddRemindListener(() => { Debug.Log("remind me later"); }); rateUs.AddRateUsListener(() => { Debug.Log("rate us!!!"); }); rateUs.AddDismissListener(() => { Debug.Log("rate us dialog dismissed :("); }); rateUs.Show(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Dialog PopUp")) { MNPopup popup = new MNPopup("title", "dialog message"); popup.AddAction("action1", () => { Debug.Log("action 1 action callback"); }); popup.AddAction("action2", () => { Debug.Log("action 2 action callback"); }); popup.AddDismissListener(() => { Debug.Log("dismiss listener"); }); popup.Show(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Message PopUp")) { MNPopup popup = new MNPopup("title", "dialog message"); popup.AddAction("Ok", () => { Debug.Log("Ok action callback"); }); popup.AddDismissListener(() => { Debug.Log("dismiss listener"); }); popup.Show(); } StartY += YButtonStep; StartX = XStartPos; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Prealoder")) { MNP.ShowPreloader("Title", "Message"); Invoke("OnPreloaderTimeOut", 3f); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Hide Prealoder")) { MNP.HidePreloader(); } }
void OnGUI() { UpdateToStartPos(); GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Native Pop Ups", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Rate PopUp with events")) { MobileNativeRateUs ratePopUp = new MobileNativeRateUs("Like this game?", "Please rate to support future updates!"); ratePopUp.SetAppleId(appleId); ratePopUp.SetAndroidAppUrl(androidAppUrl); ratePopUp.OnComplete += OnRatePopUpClose; ratePopUp.Start(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Dialog PopUp")) { MobileNativeDialog dialog = new MobileNativeDialog("Dialog Titile", "Dialog message"); dialog.OnComplete += OnDialogClose; Invoke("Dismiss", 2.0f); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Message PopUp")) { MobileNativeMessage msg = new MobileNativeMessage("Message Titile", "Message message"); msg.OnComplete += OnMessageClose; } StartY += YButtonStep; StartX = XStartPos; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Prealoder")) { MNP.ShowPreloader("Title", "Message"); Invoke("OnPreloaderTimeOut", 3f); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Hide Prealoder")) { MNP.HidePreloader(); } }
private void SendChatMessage(string message) { var feedId = GenerateChatId(new[] { GetSocial.User.Id, Receiver.Id }); var messageContentBuilder = ActivityPostContent.CreateBuilder() .WithText(message); MNP.ShowPreloader("Sending message", "Please wait..."); GetSocial.PostActivityToFeed(feedId, messageContentBuilder.Build(), post => { SendNotification(message, Receiver.Id); LoadMessages(); }, error => { MNP.HidePreloader(); _console.LogE("Failed to send message, error: " + error); }); }
public void createUserClicked() { if (createEmail.text.Length == 0 || createPassword.text.Length == 0 || createUsername.text.Length == 0) { MNPopup mNPopup = new MNPopup("Error", "Please Input Correct!"); mNPopup.AddAction("Ok", () => { Debug.Log("Ok action callback"); }); mNPopup.Show(); } else { var user = new ParseUser(); user.Username = createUsername.text; user.Password = createPassword.text; user.Email = createEmail.text; // other fields can be set just like with ParseObject user["nickName"] = createUsername.text; //MNP.ShowPreloader("", "Creating..."); user.SignUpAsync().ContinueWith(t => { MNP.HidePreloader(); if (t.IsFaulted) { // Errors from Parse Cloud and network interactions using (IEnumerator <System.Exception> enumerator = t.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException error = (ParseException)enumerator.Current; // error.Message will contain an error message // error.Code will return "OtherCause" UnityMainThreadDispatcher.Instance().Enqueue(showErrorWithMessage(error.Message)); } } } else { UnityMainThreadDispatcher.Instance().Enqueue(createSuccess()); } }); } }
public void loginClicked() { if (loginUsername.text.Length == 0 || loginPassword.text.Length == 0) { MNPopup mNPopup = new MNPopup("Error", "Please Input Correct!"); mNPopup.AddAction("Ok", () => { Debug.Log("Ok action callback"); }); mNPopup.Show(); } else { //MNP.ShowPreloader("", "Login..."); ParseUser.LogInAsync(loginUsername.text, loginPassword.text).ContinueWith(t => { MNP.HidePreloader(); if (t.IsFaulted || t.IsCanceled) { // The login failed. Check the error to see why. using (IEnumerator <System.Exception> enumerator = t.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException error = (ParseException)enumerator.Current; // error.Message will contain an error message // error.Code will return "OtherCause" UnityMainThreadDispatcher.Instance().Enqueue(showErrorWithMessage(error.Message)); } } } else { //shouldLoginIn = true; UnityMainThreadDispatcher.Instance().Enqueue(loginSucceed()); // Login was successful. } }); } }
//-------------------------------------- // GET/SET //-------------------------------------- //-------------------------------------- // EVENTS //-------------------------------------- private void OnPreloaderTimeOut() { MNP.HidePreloader(); }