Esempio n. 1
0
    void OnGUI()
    {
        GUI.Label(new Rect(10, Screen.height - 40, 200, 30), "U3DXT Kitchen Sink");

        int i = 0;

        for (int j = 0; j < 2; j++)
        {
            GUILayout.BeginArea(new Rect((j == 0) ? 50 : (Screen.width / 2), 50, (Screen.width - 100) / 2, Screen.height - 100));
            GUILayout.BeginVertical();

            for (; i < _scenes.Count / (2 - j); i++)
            {
                var scene = _scenes[i];

                if (GUILayout.Button(scene.name, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
                {
                    if (Application.CanStreamedLevelBeLoaded(scene.fileName))
                    {
                        Application.LoadLevel(scene.fileName);
                    }
                    else
                    {
                        GUIXT.ShowAlert("U3DXT Kitchen Sink", "The required module is not enabled.", "OK", new string[] {});
                    }
                }
            }

            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
    }
Esempio n. 2
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();
    }
Esempio n. 3
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();
    }