示例#1
0
        void DrawCustomXcode()
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.LabelField(new GUIContent("Xcode Location", "Change this if your Xcode install is not in the standard place"));
            EditorGUI.indentLevel--;
            EditorGUILayout.BeginVertical(_style.IndentedBox());

            if (Application.platform != RuntimePlatform.OSXEditor)
            {
                EditorGUILayout.LabelField("You can only set a custom Xcode location on OS X");
            }
            else
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(XcodeFinder.XcodeLocation);

                if (GUILayout.Button("Select", GUILayout.Width(100)))
                {
                    var xcodePath = EditorUtility.OpenFilePanel("Choose Xcode Location", "/Applications", "app");

                    if (!string.IsNullOrEmpty(xcodePath))
                    {
                        if (!XcodeFinder.SetXcodeLocation(xcodePath))
                        {
                            EditorUtility.DisplayDialog("Invalid Xcode Location", xcodePath + " does not appear to be a valid Xcode install", "OK");
                        }
                    }
                }

                GUI.enabled = XcodeFinder.UsingCustomLocation;

                if (GUILayout.Button("Use default", GUILayout.Width(100)))
                {
                    XcodeFinder.ClearCustomXcodeLocation();
                }

                GUI.enabled = true;
                EditorGUILayout.EndHorizontal();

                if (!XcodeFinder.IsFound)
                {
                    EditorGUILayout.HelpBox("Xcode not found. Please set a valid location.", MessageType.Error);
                }
            }

            GUILayout.Space(4);
            EditorGUILayout.EndVertical();
        }
示例#2
0
        void OnGUI()
        {
            if (Application.platform != RuntimePlatform.OSXEditor)
            {
                EditorGUILayout.LabelField("Can only browse frameworks on OS X.");
                EditorGUILayout.LabelField("Please enter framework names manually.");
                ManualEntry();
                return;
            }

            if (!_xcodeFinder.IsFound)
            {
                EditorGUILayout.LabelField("Xcode not found. Please set the Xcode location");

                if (GUILayout.Button("Find Xcode"))
                {
                    var xcodePath = EditorUtility.OpenFilePanel("Choose Xcode Location", "/Applications", "app");

                    if (!string.IsNullOrEmpty(xcodePath))
                    {
                        if (XcodeFinder.SetXcodeLocation(xcodePath))
                        {
                            _xcodeFinder = new XcodeSDKFinder(_platform);
                        }
                        else
                        {
                            EditorUtility.DisplayDialog("Invalid Xcode Location", xcodePath + " does not appear to be a valid Xcode install", "OK");
                        }
                    }
                }

                EditorGUILayout.HelpBox("You can change the location under settings", MessageType.Info);
                GUILayout.Space(20);
                EditorGUILayout.LabelField("Alternatively, add the framework names manually below.");
                ManualEntry();
                return;
            }

            if (_content == null)
            {
                _content = _xcodeFinder.FrameworkNames;
                _filteredList.Clear();
                _filteredList.AddRange(_content);
            }

            DrawSearchBox();
            _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition);

            foreach (string framework in _filteredList)
            {
                if (GUILayout.Button(framework, EditorStyles.label))
                {
                    AddFramework(framework);
                }
            }

            EditorGUILayout.EndScrollView();

            if (Event.current.type == EventType.KeyDown)
            {
                if (Event.current.keyCode == KeyCode.Escape)
                {
                    Close();
                }
            }
        }