Ejemplo n.º 1
0
        public void textureLoadFailed(string error)
        {
            var buttons = new string[] { "OK" };

            EtceteraBinding.showAlertWithTitleMessageAndButtons("Error Loading Texture.  Did you choose a photo first?", error, buttons);
            Debug.Log("textureLoadFailed: " + error);
        }
Ejemplo n.º 2
0
        void OnGUI()
        {
            beginColumn();


            if (GUILayout.Button("Get Current Language"))
            {
                Debug.Log("current launguage: " + EtceteraBinding.getCurrentLanguage());
            }


            if (GUILayout.Button("Get Locale Info for Keys"))
            {
                Debug.Log("currency symbol: " + EtceteraBinding.localeObjectForKey(true, "kCFLocaleCurrencySymbolKey"));
                Debug.Log("country code: " + EtceteraBinding.localeObjectForKey(true, "kCFLocaleCountryCodeKey"));
            }


            if (GUILayout.Button("Get Localized String"))
            {
                string loc = EtceteraBinding.getLocalizedString("hello", "hello in English");
                Debug.Log("'hello' localized: " + loc);
            }


            if (GUILayout.Button("Alert with one Button"))
            {
                var buttons = new string[] { "OK" };
                EtceteraBinding.showAlertWithTitleMessageAndButtons("This is the title", "You should really read this before pressing OK", buttons);
            }


            if (GUILayout.Button("Alert with three Buttons"))
            {
                var buttons = new string[] { "OK", "In The Middle", "Cancel" };
                EtceteraBinding.showAlertWithTitleMessageAndButtons("This is another title", "You should really read this before pressing a button", buttons);
            }


            if (GUILayout.Button("Show Prompt with 1 Field"))
            {
                EtceteraBinding.showPromptWithOneField("Enter your name", "This is the name of the main character", "name", true);
            }


            // Second row
            endColumn(true);


            if (GUILayout.Button("Show Prompt with 2 Fields"))
            {
                EtceteraBinding.showPromptWithTwoFields("Enter your credentials", "", "username", "password", false);
            }


            if (GUILayout.Button("Open Web Page"))
            {
                // you can also use a local file that is in your .app bundle or elsewhere

                /*
                 * var path = Application.dataPath.Replace( "Data", "" );
                 * path = System.IO.Path.Combine( path, "file.html" );
                 */

                EtceteraBinding.showWebPage("http://www.prime31.com", true);
            }


            if (GUILayout.Button("Show Mail Composer"))
            {
                EtceteraBinding.showMailComposer("*****@*****.**", "Tell us what you think", "I <b>really</b> like this game!", true);
            }


            if (GUILayout.Button("Show SMS Composer"))
            {
                // Make sure SMS is available before we try to show the composer
                if (EtceteraBinding.isSMSAvailable())
                {
                    EtceteraBinding.showSMSComposer("some text to prefill the message with");
                }
            }


            if (GUILayout.Button("Mail Composer with Screenshot"))
            {
                // we call this as a coroutine so that it can use a couple frames to hande its business
                StartCoroutine(EtceteraBinding.showMailComposerWithScreenshot(null, "Game Screenshot", "I like this game!", false));
            }


            if (GUILayout.Button("Take Screen Shot"))
            {
                StartCoroutine(EtceteraBinding.takeScreenShot("someScreenshot.png", imagePath =>
                {
                    Debug.Log("Screenshot taken and saved to: " + imagePath);
                }));
            }


            endColumn();


            if (bottomRightButton("Next Scene"))
            {
                Application.LoadLevel("EtceteraTestSceneTwo");
            }
        }
Ejemplo n.º 3
0
 void Start()
 {
     // example of setting the popover rect (only used on the iPad when showing the photo picker)
     EtceteraBinding.setPopoverPoint(500, 200);
 }
Ejemplo n.º 4
0
        void OnGUI()
        {
            beginColumn();


            if (GUILayout.Button("Show Activity View"))
            {
                EtceteraBinding.showActivityView();

                // hide the activity view after a short delay
                StartCoroutine(hideActivityView());
            }


            if (GUILayout.Button("Show Bezel Activity View"))
            {
                EtceteraBinding.showBezelActivityViewWithLabel("Loading Stuff...");

                // hide the activity view after a short delay
                StartCoroutine(hideActivityView());
            }


            if (GUILayout.Button("Prompt to Review This App"))
            {
                EtceteraBinding.askForReview("Do you like this game?", "Please review the game if you do!", "572395608");
            }


            if (GUILayout.Button("Open App Store to Review Page"))
            {
                EtceteraBinding.openAppStoreReviewPage("572395608");
            }


            if (GUILayout.Button("Register for Push"))
            {
                EtceteraBinding.registerForRemoteNotifications(P31RemoteNotificationType.Alert | P31RemoteNotificationType.Badge | P31RemoteNotificationType.Sound);
            }


            if (GUILayout.Button("Get Registered Push Types"))
            {
                P31RemoteNotificationType types = EtceteraBinding.getEnabledRemoteNotificationTypes();

                if ((types & P31RemoteNotificationType.Alert) != P31RemoteNotificationType.None)
                {
                    Debug.Log("registered for alerts");
                }

                if ((types & P31RemoteNotificationType.Sound) != P31RemoteNotificationType.None)
                {
                    Debug.Log("registered for sounds");
                }

                if ((types & P31RemoteNotificationType.Badge) != P31RemoteNotificationType.None)
                {
                    Debug.Log("registered for badges");
                }
            }


            // Second row
            endColumn(true);


            if (GUILayout.Button("Set Urban Airship Credentials"))
            {
                // enter your own Urban Airship credentials here!
                EtceteraBinding.setUrbanAirshipCredentials("S8Tf2CiUQSuh2A4NVdD2CA", "J6O97Dm2QK2-GGXZsPMlEA", "optional alias");
            }


            if (GUILayout.Button("Set Push.IO Credentials"))
            {
                // enter your own Push.IO credentials here!
                EtceteraBinding.setPushIOCredentials("5VRVDMujew_a9UQ");

                // optinally, pass in categories
                //EtceteraBinding.setPushIOCredentials( "5VRVDMujew_a9UQ", new string[] { "BaseballPlayers", "Gamers" } );
            }


            if (GUILayout.Button("Prompt for Photo"))
            {
                EtceteraBinding.promptForPhoto(0.25f, PhotoPromptType.CameraAndAlbum);
            }


            if (GUILayout.Button("Prompt for Multiple Photos"))
            {
                EtceteraBinding.promptForMultiplePhotos(3, 0.25f);
            }


            if (GUILayout.Button("Prompt for Video"))
            {
                EtceteraBinding.promptForVideo(PhotoPromptType.CameraAndAlbum);
            }


            if (GUILayout.Button("Load Photo Texture"))
            {
                if (imagePath == null)
                {
                    var buttons = new string[] { "OK" };
                    EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons);
                    return;
                }

                // No need to resize because we asked for an image scaled from the picker but this is how we sould do it if we wanted to.
                // Resize the image so that we dont end up trying to load a gigantic image
                //EtceteraBinding.resizeImageAtPath( imagePath, 256, 256 );

                // Add 'file://' to the imagePath so that it is accessible via the WWW class
                StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + imagePath, textureLoaded, textureLoadFailed));
            }


            if (GUILayout.Button("Save Photo to Album"))
            {
                if (imagePath == null)
                {
                    var buttons = new string[] { "OK" };
                    EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons);
                    return;
                }

                EtceteraBinding.saveImageToPhotoAlbum(imagePath);
            }


            if (GUILayout.Button("Get Image Size"))
            {
                if (imagePath == null)
                {
                    var buttons = new string[] { "OK" };
                    EtceteraBinding.showAlertWithTitleMessageAndButtons("Error Getting Image Size", "You have to choose a photo before checking it's size", buttons);
                    return;
                }

                var size = EtceteraBinding.getImageSize(imagePath);
                Debug.Log("image size: " + size);
            }


            endColumn();


            // Next scene button
            if (bottomRightButton("Next"))
            {
                loadLevel("EtceteraTestSceneThree");
            }
        }
Ejemplo n.º 5
0
        public IEnumerator hideActivityView()
        {
            yield return(new WaitForSeconds(2.0f));

            EtceteraBinding.hideActivityView();
        }
Ejemplo n.º 6
0
        void OnGUI()
        {
            beginColumn();


            if (GUILayout.Button("Show Activity View"))
            {
                EtceteraBinding.showActivityView();

                // hide the activity view after a short delay
                StartCoroutine(hideActivityView());
            }


            if (GUILayout.Button("Show Bezel Activity View"))
            {
                EtceteraBinding.showBezelActivityViewWithLabel("Loading Stuff...");

                // hide the activity view after a short delay
                StartCoroutine(hideActivityView());
            }


            if (GUILayout.Button("Prompt to Review This App"))
            {
                EtceteraBinding.askForReview("Do you like this game?", "Please review the game if you do!", "572395608");
            }


            if (GUILayout.Button("Open App Store to Review Page"))
            {
                EtceteraBinding.openAppStoreReviewPage("572395608");
            }


            if (GUILayout.Button("Register for Push"))
            {
                EtceteraBinding.registerForRemoteNotifications(P31RemoteNotificationType.Alert | P31RemoteNotificationType.Badge | P31RemoteNotificationType.Sound);
            }


            if (GUILayout.Button("Get Registered Push Types"))
            {
                P31RemoteNotificationType types = EtceteraBinding.getEnabledRemoteNotificationTypes();

                if ((types & P31RemoteNotificationType.Alert) != P31RemoteNotificationType.None)
                {
                    Debug.Log("registered for alerts");
                }

                if ((types & P31RemoteNotificationType.Sound) != P31RemoteNotificationType.None)
                {
                    Debug.Log("registered for sounds");
                }

                if ((types & P31RemoteNotificationType.Badge) != P31RemoteNotificationType.None)
                {
                    Debug.Log("registered for badges");
                }
            }


            if (GUILayout.Button("Register with GameThrive"))
            {
                // registerDeviceWithGameThrive must be called in a couroutine since it makes a WWW request
                // Make sure you use your own appId and that you pass the actual deviceToken that the remoteRegistrationSucceededEvent
                // provides!
                StartCoroutine(EtceteraBinding.registerDeviceWithGameThrive("13aa4c98-1931-11e4-aefc-5bf05f62f703", "token", null, www =>
                {
                    // check for an error or success. If www.error is not null then an error occured
                    if (www.error == null)
                    {
                        // success! Lets dump the data to the console so we can see what was returned
                        Debug.Log("GameThrive registration success: " + www.text);
                    }
                    else
                    {
                        Debug.Log("Error registering with GameThrive: " + www.error);
                    }
                }));
            }


            // Second row
            endColumn(true);


            if (GUILayout.Button("Set Urban Airship Credentials"))
            {
                // enter your own Urban Airship credentials here!
                EtceteraBinding.setUrbanAirshipCredentials("S8Tf2CiUQSuh2A4NVdD2CA", "J6O97Dm2QK2-GGXZsPMlEA", "optional alias");
            }


            if (GUILayout.Button("Set Push.IO Credentials"))
            {
                // enter your own Push.IO credentials here!
                EtceteraBinding.setPushIOCredentials("5VRVDMujew_a9UQ");

                // optinally, pass in categories
                //EtceteraBinding.setPushIOCredentials( "5VRVDMujew_a9UQ", new string[] { "BaseballPlayers", "Gamers" } );
            }


            if (GUILayout.Button("Prompt for Photo"))
            {
                EtceteraBinding.promptForPhoto(0.25f, PhotoPromptType.CameraAndAlbum);
            }


            if (GUILayout.Button("Prompt for Multiple Photos"))
            {
                EtceteraBinding.promptForMultiplePhotos(3, 0.25f);
            }


            if (GUILayout.Button("Load Photo Texture"))
            {
                if (imagePath == null)
                {
                    var buttons = new string[] { "OK" };
                    EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons);
                    return;
                }

                // No need to resize because we asked for an image scaled from the picker but this is how we sould do it if we wanted to
                // Resize the image so that we dont end up trying to load a gigantic image
                //EtceteraBinding.resizeImageAtPath( imagePath, 256, 256 );

                // Add 'file://' to the imagePath so that it is accessible via the WWW class
                StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + imagePath, textureLoaded, textureLoadFailed));
            }


            if (GUILayout.Button("Save Photo to Album"))
            {
                if (imagePath == null)
                {
                    var buttons = new string[] { "OK" };
                    EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons);
                    return;
                }

                EtceteraBinding.saveImageToPhotoAlbum(imagePath);
            }


            if (GUILayout.Button("Get Image Size"))
            {
                if (imagePath == null)
                {
                    var buttons = new string[] { "OK" };
                    EtceteraBinding.showAlertWithTitleMessageAndButtons("Error Getting Image Size", "You have to choose a photo before checking it's size", buttons);
                    return;
                }

                var size = EtceteraBinding.getImageSize(imagePath);
                Debug.Log("image size: " + size);
            }


            endColumn();


            // Next scene button
            if (bottomRightButton("Next"))
            {
                Application.LoadLevel("EtceteraTestSceneThree");
            }
        }
Ejemplo n.º 7
0
        void OnGUI()
        {
            beginColumn();

            GUILayout.Label("Inline Webview Methods");

            if (GUILayout.Button("Show Inline WebView"))
            {
                // remember, iOS uses points not pixels for positioning and layout!
                EtceteraBinding.inlineWebViewShow(50, 10, 260, 300);
                EtceteraBinding.inlineWebViewSetUrl("http://google.com");
            }


            if (GUILayout.Button("Close Inline WebView"))
            {
                EtceteraBinding.inlineWebViewClose();
            }


            if (GUILayout.Button("Set Url of Inline WebView"))
            {
                EtceteraBinding.inlineWebViewSetUrl("http://prime31.com");
            }


            if (GUILayout.Button("Set Frame of Inline WebView"))
            {
                // remember, iOS uses points not pixels for positioning and layout!
                EtceteraBinding.inlineWebViewSetFrame(10, 200, 250, 250);
            }


            // Second row
            endColumn(true);


            if (GUILayout.Button("Get Badge Count"))
            {
                Debug.Log("badge count is: " + EtceteraBinding.getBadgeCount());
            }


            if (GUILayout.Button("Set Badge Count"))
            {
                EtceteraBinding.setBadgeCount(46);
            }


            if (GUILayout.Button("Get First 25 Contacts"))
            {
                // note that accessing contacts requires special permission. Please see note in the documentation available here: https://prime31.com/docs#iosEtc
                var contacts = EtceteraBinding.getContacts(0, 25);
                Utils.logObject(contacts);
            }


            if (GUILayout.Button("Get Pasteboard String"))
            {
                Debug.Log("Pasteboard string: " + EtceteraBinding.getPasteboardString());
            }


            if (GUILayout.Button("Set Pasteboard String"))
            {
                EtceteraBinding.setPasteboardString("setting the pasteboard string from Unity");
            }


            if (GUILayout.Button("Set Pasteboard Image"))
            {
                StartCoroutine(EtceteraBinding.getScreenShotTexture(tex =>
                {
                    var bytes = tex.EncodeToPNG();
                    EtceteraBinding.setPasteboardImage(bytes);
                }));
            }



            endColumn();


            // Next scene button
            if (bottomRightButton("Back"))
            {
                Application.LoadLevel("EtceteraTestScene");
            }
        }
Ejemplo n.º 8
0
        void OnGUI()
        {
            beginColumn();



            if (GUILayout.Button("Prompt for Photo"))
            {
                EtceteraBinding.promptForPhoto(0.25f, PhotoPromptType.CameraAndAlbum);
            }


            if (GUILayout.Button("Prompt for Multiple Photos"))
            {
                EtceteraBinding.promptForMultiplePhotos(3, 0.25f);
            }


            if (GUILayout.Button("Load Photo Texture"))
            {
                if (imagePath == null)
                {
                    var buttons = new string[] { "OK" };
                    EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons);
                    return;
                }

                // No need to resize because we asked for an image scaled from the picker but this is how we sould do it if we wanted to
                // Resize the image so that we dont end up trying to load a gigantic image
                //EtceteraBinding.resizeImageAtPath( imagePath, 256, 256 );

                // Add 'file://' to the imagePath so that it is accessible via the WWW class
                StartCoroutine(EtceteraManager.textureFromFileAtPath("file://" + imagePath, textureLoaded, textureLoadFailed));
            }


            if (GUILayout.Button("Save Photo to Album"))
            {
                if (imagePath == null)
                {
                    var buttons = new string[] { "OK" };
                    EtceteraBinding.showAlertWithTitleMessageAndButtons("Load Photo Texture Error", "You have to choose a photo before loading", buttons);
                    return;
                }

                EtceteraBinding.saveImageToPhotoAlbum(imagePath);
            }


            if (GUILayout.Button("Get Image Size"))
            {
                if (imagePath == null)
                {
                    var buttons = new string[] { "OK" };
                    EtceteraBinding.showAlertWithTitleMessageAndButtons("Error Getting Image Size", "You have to choose a photo before checking it's size", buttons);
                    return;
                }

                var size = EtceteraBinding.getImageSize(imagePath);
                Debug.Log("image size: " + size);
            }


            endColumn();


            // Next scene button
            if (bottomRightButton("Next"))
            {
                Application.LoadLevel("EtceteraTestSceneThree");
            }
        }