示例#1
0
        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"))
            {
                Debug.Log("persistance: " + Application.persistentDataPath);
                Debug.Log("caches: " + Application.temporaryCachePath);
                // 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");
            }
        }