Exemple #1
0
    public void askForReview(string appName, string bundleId)
    {
#if UNITY_ANDROID
        EtceteraAndroid.askForReviewNow("Review " + appName + "!", "Review " + appName + " if you like it.");
#elif UNITY_IPHONE
        //EtceteraBinding.openAppStoreReviewPage(AppConfigs.pu
        EtceteraBinding.askForReview("Review " + appName + "!", "Review " + appName + " if you like it.", bundleId);
#endif
    }
    void OnGUI()
    {
        beginColumn();

        if (GUILayout.Button("Show Toast"))
        {
            EtceteraAndroid.showToast("Hi. Something just happened in the game and I want to tell you but not interrupt you", true);
        }


        if (GUILayout.Button("Play Video"))
        {
            // closeOnTouch has no effect if you are showing controls
            EtceteraAndroid.playMovie("http://techslides.com/demos/sample-videos/small.3gp", 0xFF0000, false, EtceteraAndroid.ScalingMode.AspectFit, true);
        }


        if (GUILayout.Button("Show Alert"))
        {
            EtceteraAndroid.showAlert("Alert Title Here", "Something just happened.  Do you want to have a snack?", "Yes", "Not Now");
        }


        if (GUILayout.Button("Single Field Prompt"))
        {
            EtceteraAndroid.showAlertPrompt("Enter Digits", "I'll call you if you give me your number", "phone number", "867-5309", "Send", "Not a Chance");
        }


        if (GUILayout.Button("Two Field Prompt"))
        {
            EtceteraAndroid.showAlertPromptWithTwoFields("Need Info", "Enter your credentials:", "username", "harry_potter", "password", string.Empty, "OK", "Cancel");
        }


        if (GUILayout.Button("Show Progress Dialog"))
        {
            EtceteraAndroid.showProgressDialog("Progress is happening", "it will be over in just a second...");
            Invoke("hideProgress", 1);
        }


        if (GUILayout.Button("Text to Speech Speak"))
        {
            EtceteraAndroid.setPitch(Random.Range(0, 5));
            EtceteraAndroid.setSpeechRate(Random.Range(0.5f, 1.5f));
            EtceteraAndroid.speak("Howdy. Im a robot voice");
        }


        if (GUILayout.Button("Prompt for Video"))
        {
            EtceteraAndroid.promptToTakeVideo("fancyVideo");
        }



        endColumn(true);


        if (GUILayout.Button("Show Web View"))
        {
            EtceteraAndroid.showWebView("http://prime31.com");
        }


        if (GUILayout.Button("Email Composer"))
        {
            // grab an attachment for this email, in this case a screenshot
            StartCoroutine(saveScreenshotToSDCard(path =>
            {
                EtceteraAndroid.showEmailComposer("*****@*****.**", "Message subject", "click <a href='http://somelink.com'>here</a> for a present", true, path);
            }));
        }


        if (GUILayout.Button("SMS Composer"))
        {
            EtceteraAndroid.showSMSComposer("I did something really cool in this game!");
        }


        if (GUILayout.Button("Share Image Natively"))
        {
            StartCoroutine(saveScreenshotToSDCard(path =>
            {
                EtceteraAndroid.shareImageWithNativeShareIntent(path, "Sharing a screenshot...");
            }));
        }


        if (GUILayout.Button("Share Text and Image Natively"))
        {
            StartCoroutine(saveScreenshotToSDCard(path =>
            {
                EtceteraAndroid.shareWithNativeShareIntent("Check this out!", "Some Subject", "Sharing a screenshot and text...", path);
            }));
        }


        if (GUILayout.Button("Prompt to Take Photo"))
        {
            EtceteraAndroid.promptToTakePhoto("photo.jpg");
        }


        if (GUILayout.Button("Prompt for Album Image"))
        {
            EtceteraAndroid.promptForPictureFromAlbum("albumImage.jpg");
        }


        if (GUILayout.Button("Save Image to Gallery"))
        {
            StartCoroutine(saveScreenshotToSDCard(path =>
            {
                var didSave = EtceteraAndroid.saveImageToGallery(path, "My image from Unity");
                Debug.Log("did save to gallery: " + didSave);
            }));
        }


        if (GUILayout.Button("Ask For Review"))
        {
            // reset just in case you accidentally press dont ask again while playing with the demo scene
            EtceteraAndroid.resetAskForReview();
            EtceteraAndroid.askForReviewNow("Please rate my app!", "It will really make me happy if you do...");
        }


        endColumn();


        if (bottomRightButton("Next Scene"))
        {
            Application.LoadLevel("EtceteraTestSceneTwo");
        }
    }
Exemple #3
0
    void OnGUI()
    {
        float yPos       = 5.0f;
        float xPos       = 5.0f;
        float width      = (Screen.width >= 800 || Screen.height >= 800) ? 320 : 160;
        float height     = (Screen.width >= 800 || Screen.height >= 800) ? 55 : 30;
        float heightPlus = height + 3.0f;


        if (GUI.Button(new Rect(xPos, yPos, width, height), "Show Toast"))
        {
            EtceteraAndroid.showToast("Hi.  Something just happened in the game and I want to tell you but not interrupt you", true);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Play Video"))
        {
            // closeOnTouch has no effect if you are showing controls
            EtceteraAndroid.playMovie("http://www.daily3gp.com/vids/747.3gp", 0xFF0000, false, EtceteraAndroid.ScalingMode.AspectFit, true);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Show Alert"))
        {
            EtceteraAndroid.showAlert("Alert Title Here", "Something just happened.  Do you want to have a snack?", "Yes", "Not Now");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Single Field Prompt"))
        {
            EtceteraAndroid.showAlertPrompt("Enter Digits", "I'll call you if you give me your number", "phone number", "867-5309", "Send", "Not a Chance");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Two Field Prompt"))
        {
            EtceteraAndroid.showAlertPromptWithTwoFields("Need Info", "Enter your credentials:", "username", "harry_potter", "password", string.Empty, "OK", "Cancel");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Show Progress Dialog"))
        {
            EtceteraAndroid.showProgressDialog("Progress is happening", "it will be over in just a second...");
            Invoke("hideProgress", 1);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Text to Speech Speak"))
        {
            EtceteraAndroid.setPitch(Random.Range(0, 5));
            EtceteraAndroid.setSpeechRate(Random.Range(0.5f, 1.5f));
            EtceteraAndroid.speak("Howdy. Im a robot voice");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Prompt for Video"))
        {
            EtceteraAndroid.promptToTakeVideo("fancyVideo");
        }



        // second column of buttons
        xPos = Screen.width - width - 5.0f;
        yPos = 5.0f;

        if (GUI.Button(new Rect(xPos, yPos, width, height), "Show Web View"))
        {
            EtceteraAndroid.showWebView("http://prime31.com");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Email Composer"))
        {
            // grab an attachment for this email
            var path = saveScreenshotToSDCard();

            EtceteraAndroid.showEmailComposer("*****@*****.**", "Message subject", "click <a href='http://somelink.com'>here</a> for a present", true, path);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "SMS Composer"))
        {
            EtceteraAndroid.showSMSComposer("I did something really cool in this game!");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Prompt to Take Photo"))
        {
            EtceteraAndroid.promptToTakePhoto(512, 512, "photo.jpg");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Prompt for Album Image"))
        {
            EtceteraAndroid.promptForPictureFromAlbum(512, 512, "albumImage.jpg");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Save Image to Gallery"))
        {
            var path = saveScreenshotToSDCard();

            var didSave = EtceteraAndroid.saveImageToGallery(path, "My image from Unity");
            Debug.Log("did save to gallery: " + didSave);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Ask For Review"))
        {
            // reset just in case you accidentally press dont ask again
            EtceteraAndroid.resetAskForReview();
            EtceteraAndroid.askForReviewNow("Please rate my app!", "It will really make me happy if you do...");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Next Scene"))
        {
            Application.LoadLevel("EtceteraTestSceneTwo");
        }
    }