Exemplo n.º 1
0
    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();
        }
    }
Exemplo n.º 2
0
    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();
        }
    }
Exemplo n.º 3
0
    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);
        });
    }
Exemplo n.º 4
0
 public void ShowPreloader(string title, string message)
 {
     MNP.ShowPreloader(title, message);
     Invoke("OnPreloaderTimeOut", 3f);
 }