Example #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();
        }
    }
Example #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();
    }