Пример #1
0
    void OnGUI()
    {
        var meeting = gameObject.GetComponent <Meeting>();

        if (meeting == null)
        {
            KitchenSink.OnGUIBack();

            GUI.Label(new Rect(50, 50, 500, 50), "MUST first setup Game Center and Multiplayer in iTunesConnect. See README.txt.");

            if (GUI.Button(new Rect(Screen.width / 2 - 50, 100, 100, 100), "Create / Join"))
            {
                CreateMeeting();
            }

            if (GUI.Button(new Rect(Screen.width / 2 - 50, 220, 100, 100), "Create / Join\nCustom UI\n(Takes a while)"))
            {
                CreateMeetingCustom();
            }

            //TODO: need cancel button
        }

        OnGUILog();
    }
Пример #2
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height / 2 - 50));
            GUILayout.BeginHorizontal();
            OnGUIActivitySheet();
            OnGUIEmail();
            OnGUISMS();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            OnGUIPost();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            OnGUIDirectTwitter();
            OnGUIDirectFacebook();
            OnGUIDirectSinaWeibo();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            OnGUISaveToPhotoLibrary();
            OnGUIInstagram();
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }

        OnGUILog();
    }
Пример #3
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height / 2 - 50));
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Show alert", GUILayout.ExpandHeight(true)))
            {
                GUIXT.ShowAlert("Alert title", "Alert message", "Cancel", new string[] { "OK", "Hi", "Hello" });
            }

            if (GUILayout.Button("Show input", GUILayout.ExpandHeight(true)))
            {
                GUIXT.ShowAlert("Input Prompt", "Enter something", "Cancel", new string[] { "OK" }, UIAlertViewStyle.PlainTextInput);
            }

            if (GUILayout.Button("Pick image\nfrom\nphoto library", GUILayout.ExpandHeight(true)))
            {
                GUIXT.ShowImagePicker();
            }

            if (GUILayout.Button("Take photo\nfrom camera", GUILayout.ExpandHeight(true)))
            {
                GUIXT.ShowImagePicker(UIImagePickerControllerSourceType.Camera);
            }

            if (GUILayout.Button("Show battery info", GUILayout.ExpandHeight(true)))
            {
                ShowBatteryInfo();
            }

            if (GUILayout.Button("Show picker view", GUILayout.ExpandHeight(true)))
            {
                ShowPickerView();
            }

            if (GUILayout.Button("Hide picker view", GUILayout.ExpandHeight(true)))
            {
                HidePickerView();
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            if (_image != null)
            {
                GUI.DrawTexture(new Rect(Screen.width / 2, Screen.height / 2, Screen.width / 2 - 100, Screen.height / 2 - 100), _image);
            }
        }

        OnGUILog();
    }
Пример #4
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height / 2 - 50));

            GUILayout.Label("MUST first setup iTunesConnect and change IAPTest.cs with correct product IDs.");
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Buy Coins", GUILayout.ExpandHeight(true)))
            {
                // buy 2 coins
                IAPXT.Buy(coinsProductID, 2);
            }

            if (GUILayout.Button("Premium", GUILayout.ExpandHeight(true)))
            {
                // buy premium upgrade
                IAPXT.Buy(premiumProductID);
            }

            if (GUILayout.Button("No Ads", GUILayout.ExpandHeight(true)))
            {
                // buy no ads upgrade
                IAPXT.Buy(noAdsProductID);
            }

            if (GUILayout.Button("Restore", GUILayout.ExpandHeight(true)))
            {
                // restore all previously bought products
                IAPXT.RestoreCompletedTransactions();
            }

            if (GUILayout.Button("Store View", GUILayout.ExpandHeight(true)))
            {
                // show the store view in game
                IAPXT.ShowStore("571059586");
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }

        OnGUILog();
    }
Пример #5
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            if (_photo != null)
            {
                // figure out a scale that fits on screen
                float scale       = (float)Screen.width / (float)_photo.width;
                float heightScale = ((float)Screen.height - 330.0f) / (float)_photo.height;
                scale = (scale < heightScale) ? scale : heightScale;

                // draw the filtered image
                GUI.DrawTexture(new Rect(0, 280, _photo.width * scale, _photo.height * scale), _photo);

                // draw the scrambled faces
                if (_faces != null)
                {
                    for (int i = 0; i < _faces.Length; i++)
                    {
                        var face = _faces[i];
                        var rect = face.bounds;
                        rect.Set(rect.x * scale * CONVERT_SCALE, rect.y * scale * CONVERT_SCALE + 280,
                                 rect.width * scale * CONVERT_SCALE, rect.height * scale * CONVERT_SCALE);
                        GUI.DrawTexture(rect, _scrambledFaces[i]);
                    }
                }
            }

            if (GUI.Button(new Rect(50, 50, 100, 100), "Photos Library"))
            {
                GUIXT.ShowImagePicker();
            }

            if (GUI.Button(new Rect(200, 50, 100, 100), "Take Photo"))
            {
                GUIXT.ShowImagePicker(UIImagePickerControllerSourceType.Camera);
            }
        }

        OnGUILog();
    }
Пример #6
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height / 2 - 50));
            GUILayout.BeginHorizontal();

            text = GUILayout.TextField(text, GUILayout.Width(Screen.width - 200), GUILayout.ExpandHeight(true));
            if (GUILayout.Button("Send", GUILayout.ExpandHeight(true)))
            {
                SendData(text);
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }

        OnGUILog();
    }
Пример #7
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height / 2 - 50));
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Load Player Photo", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.localPlayer.LoadPhoto(GKPhotoSize.Normal, delegate(Texture2D photo) {
                    if (photo != null)
                    {
                        Log("Loaded photo");
                        GameObject.Find("PlayerPhoto").guiTexture.texture = photo;
                    }
                    else
                    {
                        Log("Local player has no photo or error loading photo.");
                    }
                });
            }

            if (GUILayout.Button("Show Game Center", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ShowGameCenter();
            }

            if (GUILayout.Button("Show Banner", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ShowBanner("Game Kit Basics", "Hello from U3DXT!");

                long score = 100;
                Debug.Log("Reporting score " + score + " on leaderboard " + leaderboardID);
                Social.ReportScore(score, leaderboardID, success => {
                    Debug.Log(success ? "Reported score successfully" : "Failed to report score");
                });
            }

            if (GUILayout.Button("Show Leaderboard", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ShowLeaderboard(leaderboardID);
            }

            if (GUILayout.Button("Show Achievement", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ShowAchievements();
            }

            if (GUILayout.Button("Get Leaderboard", GUILayout.ExpandHeight(true)))
            {
                RetrieveTopTenScores();
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            scoreText = GUILayout.TextField(scoreText, GUILayout.ExpandWidth(true));
            if (GUILayout.Button("Report Score", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ReportScore(leaderboardID, Convert.ToInt64(scoreText));
            }

            achievementText = GUILayout.TextField(achievementText, GUILayout.ExpandWidth(true));
            if (GUILayout.Button("Report Achievement", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ReportAchievement(achievementID, Convert.ToDouble(achievementText));
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }

        OnGUILog();
    }
Пример #8
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, 100));
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Show Map", GUILayout.ExpandHeight(true)))
            {
                if (mapView == null)
                {
                    mapView = new MKMapView(new Rect(25, 100, Screen.width / 2 - 50, Screen.height / 2 - 150));

                    // create custom annotation view
                    mapView.viewHandler = delegate(MKMapView view, MKAnnotation annotation) {
                        // try to reuse old view
                        var annotationView = mapView.DequeueReusableAnnotationView("annoview");
                        if (annotationView == null)
                        {
                            Debug.Log("creating new annotation view");
//							annotationView = new MKPinAnnotationView(annotation, "annoview");
                            annotationView = new MKAnnotationView(annotation, "annoview");
                            annotationView.canShowCallout = true;

                            var image = new UIImage(new NSData(new NSURL("http://u3dxt.com/wp-content/uploads/2013/06/gears_14662320_s-225x225.jpg")));
                            annotationView.image = image;
                        }
                        else
                        {
                            Debug.Log("reusing old annotation view");
                            annotationView.annotation = annotation;
                        }

                        return(annotationView);
                    };
                }

                UIApplication.deviceRootViewController.view.AddSubview(mapView);

                MKCoordinateRegion newRegion = new MKCoordinateRegion();
                newRegion.center.latitude     = 37.786996;
                newRegion.center.longitude    = -122.440100;
                newRegion.span.latitudeDelta  = 0.112872;
                newRegion.span.longitudeDelta = 0.109863;

                mapView.SetRegion(newRegion, true);
            }

            if (GUILayout.Button("Hide Map", GUILayout.ExpandHeight(true)))
            {
                mapView.RemoveFromSuperview();
            }

            if (GUILayout.Button("Add marker", GUILayout.ExpandHeight(true)))
            {
                Annotation ggBridge = new Annotation(new CLLocationCoordinate2D(37.810000, -122.477450),
                                                     "Golden Gate Bridge", "Opened: May 27, 1937");
                mapView.AddAnnotation(ggBridge);
            }

            if (GUILayout.Button("Clear marker", GUILayout.ExpandHeight(true)))
            {
                mapView.RemoveAnnotations(mapView.annotations);
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }

//		OnGUILog();
    }
Пример #9
0
    private void OnGUI()
    {
        KitchenSink.OnGUIBack();

        GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height / 2 - 50));

        //this is the original way of how objective C use call back functions: Delegates using separate files.
        //in this case the file is PeoplePickerNavigationControllerDelegate.cs
        //we have have it easier to use delegates instead of creating new files for each delegate.
        //see examples above.  Ex: PersonalXT.CalendarAccess += delegate( ....
        if (GUILayout.Button("pick/select from contacts", GUILayout.ExpandHeight(true)))
        {
            ABPeoplePickerNavigationController picker = new ABPeoplePickerNavigationController();
            if (pickerDelegate == null)
            {
                pickerDelegate = new PeoplePickerNavigationControllerDelegate();
            }
            picker.peoplePickerDelegate = pickerDelegate;
            UIApplication.deviceRootViewController.PresentViewController(picker, true, null);
        }

        if (GUILayout.Button("get all contacts", GUILayout.ExpandHeight(true)))
        {
            Log("Address book authorization status: " + ABAddressBook.GetAuthorizationStatus());

            var addressBook = ABAddressBook.Create(null, null);
            addressBook.RequestAccess(delegate(bool granted, NSError error) {
                Log("Granted: " + granted);

                //convienent function to get the names of the contacts
                string[] contactList = PersonalXT.GetAllContactNames();
                for (int i = 0; i < contactList.Length; i++)
                {
                    Log("Contact " + i + ": " + contactList[i]);
                }
            });
        }

        if (GUILayout.Button("add new contacts", GUILayout.ExpandHeight(true)))
        {
            addNewContact();
        }

        if (GUILayout.Button("init Calendar and show events within 30 days", GUILayout.ExpandHeight(true)))
        {
            checkEventStoreAccessForCalendar();
        }

        if (GUILayout.Button("add an event for tomorrow", GUILayout.ExpandHeight(true)))
        {
            addEventForTomorrow();
        }

        if (GUILayout.Button("add alarm to events", GUILayout.ExpandHeight(true)))
        {
            createAlarmForEvents();
        }

        if (GUILayout.Button("add reminder with geolocation of current location", GUILayout.ExpandHeight(true)))
        {
            PersonalXT.RequestReminderAccess();
        }

        if (GUILayout.Button("reverse geocode happiest place on earth", GUILayout.ExpandHeight(true)))
        {
            CLLocation location = new CLLocation(33.809, -117.919);
            CLGeocoder geocoder = new CLGeocoder();
            geocoder.ReverseGeocodeLocation(location, delegate(object[] placemarks, NSError error) {
                if (error != null)
                {
                    Debug.Log(error.LocalizedDescription());
                }
                else
                {
                    foreach (var p in placemarks)
                    {
                        var placemark = p as CLPlacemark;

                        Debug.Log("placemark: " + placemark.name + "\n"
                                  + ABAddressFormatting.ABCreateString(placemark.addressDictionary, true));
                    }
                }
            });
        }

        if (GUILayout.Button("Significant location change", GUILayout.ExpandHeight(true)))
        {
            if (!CLLocationManager.LocationServicesEnabled() || !CLLocationManager.SignificantLocationChangeMonitoringAvailable())
            {
                Debug.Log("Significant change monitoring not available.");
            }
            else
            {
//				CLLocationManager manager = new CLLocationManager();

                manager.StartMonitoringSignificantLocationChanges();
            }
        }


        //commented out remove all events and reminders so users don't accidentally remove important events

        /*
         * if (GUILayout.Button("remove all Events", GUILayout.ExpandHeight(true))) {
         *      PersonalXT.RemoveAllEvents();
         *      Log ("Removed events");
         * }
         *
         * if (GUILayout.Button("remove all Reminders", GUILayout.ExpandHeight(true))) {
         *      PersonalXT.GetAllReminders(); //you can get all the reminders and handle them in line 59 above
         *      //PersonalXT.RemoveAllReminders(); //or you can simply call removeAllReminders
         * }*/

        GUILayout.EndArea();
        OnGUILog();
    }
Пример #10
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, 100));            //Screen.height/2 - 50));
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Front/Back", GUILayout.ExpandHeight(true)))
            {
                _cameraVideo.Stop();
                _cameraVideo.useFrontCamera = !_cameraVideo.useFrontCamera;
                _cameraVideo.Play();
            }

            if (GUILayout.Button("Detection On/Off", GUILayout.ExpandHeight(true)))
            {
                if (_isDetecting)
                {
                    StopDetection();
                }
                else
                {
                    StartDetection();
                }
            }

            if (GUILayout.Button("Show/Hide Log", GUILayout.ExpandHeight(true)))
            {
                _showingLog = !_showingLog;
            }

            if (GUILayout.Button("Clear Log", GUILayout.ExpandHeight(true)))
            {
                _log = "";
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            // draw faces
            if (_faces != null)
            {
                foreach (var face in _faces)
                {
                    GUI.Box(face.bounds, "");

                    // approximate mouth and eye sizes because face detection doesn't return size
                    if (face.hasLeftEyePosition)
                    {
                        var rect = new Rect(face.leftEyePosition.x, face.leftEyePosition.y,
                                            face.bounds.width / 5, face.bounds.width / 10);
                        rect.x -= rect.width / 2;
                        rect.y -= rect.height / 2;
                        GUI.Box(rect, "");
                    }

                    if (face.hasRightEyePosition)
                    {
                        var rect = new Rect(face.rightEyePosition.x, face.rightEyePosition.y,
                                            face.bounds.width / 5, face.bounds.width / 10);
                        rect.x -= rect.width / 2;
                        rect.y -= rect.height / 2;
                        GUI.Box(rect, "");
                    }

                    if (face.hasMouthPosition)
                    {
                        var rect = new Rect(face.mouthPosition.x, face.mouthPosition.y,
                                            face.bounds.width / 3, face.bounds.width / 6);
                        rect.x -= rect.width / 2;
                        rect.y -= rect.height / 2;
                        GUI.Box(rect, "");
                    }
                }
            }
        }

        if (_showingLog)
        {
            OnGUILog();
        }
    }
Пример #11
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        OnGUILog();
    }
Пример #12
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        // display the currently speaking text
        GUI.Label(new Rect(50, 50, Screen.width - 100, Screen.height / 4 - 60), speakingText, labelStyle);

        // ask for input
        inputText = GUI.TextField(new Rect(50, Screen.height / 4, (float)(Screen.width * 0.8 - 50), 80), inputText);

        // speak the input text
        if (GUI.Button(new Rect((float)(Screen.width * 0.8), Screen.height / 4, (float)(Screen.width * 0.2 - 50), 80), "Speak"))
        {
            SpeechXT.settings.pitchMultiplier = pitchValue;
            SpeechXT.settings.rate            = speedValue;
            SpeechXT.settings.volume          = volumeValue;
            SpeechXT.settings.voice           = AVSpeechSynthesisVoice.Voice(comboBoxList[selectedItemIndex].text);
            SpeechXT.Speak(inputText);
        }

        // combo box for selecting languages
        GUI.Label(new Rect(50, Screen.height / 4 + 100, 100, 50), "Language");
        selectedItemIndex = comboBoxControl.List(
            new Rect(150, Screen.height / 4 + 100, 100, 50), selectedItemIndex, comboBoxList, listStyle);


        GUILayout.BeginArea(new Rect(50, Screen.height / 4 + 200, Screen.width / 2 - 100, Screen.height / 4 * 3 - 250));

        // manually change pitch, speed, and volume
        pitchValue = GUILayout.HorizontalSlider(pitchValue, 0.5f, 2.0f);
        GUILayout.Label("Pitch: " + pitchValue, GUILayout.ExpandHeight(true));

        speedValue = GUILayout.HorizontalSlider(speedValue, 0.0f, 1.0f);
        GUILayout.Label("Speed: " + speedValue, GUILayout.ExpandHeight(true));

        volumeValue = GUILayout.HorizontalSlider(volumeValue, 0.0f, 1.0f);
        GUILayout.Label("Volume: " + volumeValue, GUILayout.ExpandHeight(true));

        GUILayout.EndArea();


        // predefined examples in different languages
        GUI.Label(new Rect(Screen.width / 4 * 3 - 50, Screen.height / 4 + 100, 100, 50), "Examples");

        GUILayout.BeginArea(new Rect(Screen.width / 2 + 50, Screen.height / 4 + 150, Screen.width / 4 - 60, Screen.height / 4 * 3 - 200));

        if (GUILayout.Button("American English", GUILayout.ExpandHeight(true)))
        {
            SpeechXT.settings.pitchMultiplier = 1f;
            SpeechXT.settings.rate            = 0.25f;
            SpeechXT.settings.volume          = 1f;
            SpeechXT.settings.voice           = AVSpeechSynthesisVoice.Voice("en-US");
            SpeechXT.Speak("Hello, I have Siri's voice.");
        }

        if (GUILayout.Button("Mexican Spanish", GUILayout.ExpandHeight(true)))
        {
            SpeechXT.settings.voice = AVSpeechSynthesisVoice.Voice("es-MX");
            SpeechXT.Speak("Buenos días");
        }

        GUILayout.EndArea();

        GUILayout.BeginArea(new Rect(Screen.width / 4 * 3 + 10, Screen.height / 4 + 150, Screen.width / 4 - 60, Screen.height / 4 * 3 - 200));

        if (GUILayout.Button("Aussie", GUILayout.ExpandHeight(true)))
        {
            SpeechXT.settings.voice = AVSpeechSynthesisVoice.Voice("en-AU");
            SpeechXT.Speak("Good day, mate.");
        }

        if (GUILayout.Button("French", GUILayout.ExpandHeight(true)))
        {
            SpeechXT.settings.voice = AVSpeechSynthesisVoice.Voice("fr-FR");
            SpeechXT.Speak("bonjour, mon amour.");
        }

        GUILayout.EndArea();
    }
Пример #13
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height / 2 - 50));

            GUILayout.Label("MUST first setup iCloud in iOS Developer Portal and Xcode.");

            GUILayout.BeginHorizontal();
            nameText = GUILayout.TextField(nameText, GUILayout.ExpandWidth(true), GUILayout.Height(100));
            if (GUILayout.Button("Set Name", GUILayout.ExpandHeight(true)))
            {
                SetName();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            scoreText = GUILayout.TextField(scoreText, GUILayout.ExpandWidth(true), GUILayout.Height(100));
            if (GUILayout.Button("Set High Score", GUILayout.ExpandHeight(true)))
            {
                SetHighScore();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            moneyText = GUILayout.TextField(moneyText, GUILayout.ExpandWidth(true), GUILayout.Height(100));
            if (GUILayout.Button("Set Money", GUILayout.ExpandHeight(true)))
            {
                SetMoney();
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Manual Sync", GUILayout.ExpandHeight(true)))
            {
                // don't really need to do this manually
                Log("Manually syncing.");
                iCloudPrefs.Synchronize();
            }

            if (GUILayout.Button("Delete All", GUILayout.ExpandHeight(true)))
            {
                Log("Deleting all iCloudPrefs data.");
                iCloudPrefs.DeleteAll();
            }

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Copy name into clipboard", GUILayout.ExpandHeight(true)))
            {
                UIPasteboard pasteboard = UIPasteboard.GeneralPasteboard();
                pasteboard.String = nameText;
                Log("Copied name into clipboard.");
            }
            if (GUILayout.Button("Copy clipboard to name", GUILayout.ExpandHeight(true)))
            {
                UIPasteboard pasteboard = UIPasteboard.GeneralPasteboard();
                nameText = pasteboard.String;
                Log("Copied clipboard to name.");
            }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }

        OnGUILog();
    }