コード例 #1
0
ファイル: UMakeEditor.cs プロジェクト: kaznowski/umake
        public override void OnInspectorGUI()
        {
            using (Horizontal.Do())
            {
                EditorGUI.BeginChangeCheck();
                string buildPath = EditorGUILayout.TextField("Build Path", UMake.BuildPathPref);
                if (EditorGUI.EndChangeCheck())
                {
                    UMake.BuildPathPref = buildPath;
                }

                if (string.IsNullOrEmpty(buildPath))
                {
                    Rect position = GUILayoutUtility.GetLastRect().Right(-EditorGUIUtility.labelWidth);
                    EditorGUI.LabelField(position, "Pick folder on build.", EditorStyles.centeredGreyMiniLabel);
                }

                if (GUILayout.Button("Change", GUILayout.Width(64.0f)))
                {
                    string path = EditorUtility.OpenFolderPanel("Build Path", UMake.BuildPathPref, "Builds");
                    if (!string.IsNullOrEmpty(path))
                    {
                        UMake.BuildPathPref = path;
                    }
                }
            }

            base.OnInspectorGUI();
        }
コード例 #2
0
        public override void OnInspectorGUI(UMakeBuildActionEditor editor)
        {
            base.OnInspectorGUI(editor);

            using (BoxGroup.Do("Shared Settings"))
            {
                using (Horizontal.Do())
                {
                    steamSdkPath.Value = EditorGUILayout.TextField("Steam SDK Folder", steamSdkPath.Value);
                    if (GUILayout.Button("Change", GUILayout.Width(64.0f)))
                    {
                        string path = EditorUtility.OpenFolderPanel("Steam SDK Folder Path", steamSdkPath.Value, "");
                        if (!string.IsNullOrEmpty(path))
                        {
                            steamSdkPath.Value = path;
                        }
                    }
                }

                steamUsername.Value = EditorGUILayout.TextField("Steam Username", steamUsername.Value);
                steamPassword.Value = EditorGUILayout.PasswordField("Steam Password", steamPassword.Value);
            }

            GUILayout.FlexibleSpace();
        }
コード例 #3
0
        /// <summary>
        /// Draws a delayed search field like those of Project window.
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public static string DelayedSearchField(string search)
        {
            using (Horizontal.Do())
            {
                search = EditorGUILayout.DelayedTextField(search, Styles.SearchTextField);

                GUIStyle buttonStyle = Styles.SearchCancelButtonEmpty;
                if (!string.IsNullOrEmpty(search))
                {
                    buttonStyle = Styles.SearchCancelButton;
                }

                if (GUILayout.Button(GUIContent.none, buttonStyle))
                {
                    search = "";
                }
            }

            return(search);
        }
コード例 #4
0
        /// <summary>
        /// This is a debug method that draws all Unity icons
        /// together with its name, so you can later use them.
        /// </summary>
        public static void DrawAllIcons()
        {
            if (unityIcons == null)
            {
                unityIcons = Resources.FindObjectsOfTypeAll <Texture>();
                System.Array.Sort(unityIcons, ObjectNameComparer.Instance);
            }

            searchField = SearchField(searchField);

            string searchLower = searchField.ToLower(CultureInfo.InvariantCulture);

            EditorGUILayout.Space();

            using (ScrollView.Do(ref scroll))
            {
                foreach (Texture texture in unityIcons)
                {
                    if (texture == null || texture.name == "")
                    {
                        continue;
                    }

                    if (!AssetDatabase.GetAssetPath(texture).StartsWith("Library/"))
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(searchField) ||
                        texture.name.ToLower(CultureInfo.InvariantCulture).Contains(searchLower))
                    {
                        using (Horizontal.Do())
                        {
                            EditorGUILayout.TextField(texture.name, EditorStyles.label);
                            GUILayout.Label(new GUIContent(texture));
                        }
                    }
                }
            }
        }
コード例 #5
0
ファイル: UMakeTargetEditor.cs プロジェクト: kaznowski/umake
        private BuildAction ShowActions()
        {
            BuildAction action;

            using (Horizontal.Do())
            {
                action = BuildAction.None;

                if (GUILayout.Button("Open Folder", EditorStyles.miniButton))
                {
                    action = BuildAction.OpenFolder;
                }

                GUILayout.FlexibleSpace();

                GUILayout.Label("Execute", EditorStyles.centeredGreyMiniLabel);
                GUI.enabled = CanBuild;

                if (GUILayout.Button("Pre Actions", EditorStyles.miniButtonLeft))
                {
                    action = BuildAction.PreActions;
                }

                if (GUILayout.Button("Build", EditorStyles.miniButtonMid, GUILayout.Width(64.0f)))
                {
                    action = BuildAction.Build;
                }

                if (GUILayout.Button("Post Actions", EditorStyles.miniButtonRight))
                {
                    action = BuildAction.PostActions;
                }

                GUI.enabled = true;
            }

            return(action);
        }
コード例 #6
0
        /// <summary>
        /// This is a debug method that draws all Unity styles found in GUI.skin.customStyles
        /// together with its name, so you can later use some specific style.
        /// </summary>
        public static void DrawAllStyles()
        {
            searchField = SearchField(searchField);

            string searchLower = searchField.ToLower(CultureInfo.InvariantCulture);

            EditorGUILayout.Space();

            using (ScrollView.Do(ref scroll))
            {
                foreach (GUIStyle style in GUI.skin.customStyles)
                {
                    if (string.IsNullOrEmpty(searchField) ||
                        style.name.ToLower(CultureInfo.InvariantCulture).Contains(searchLower))
                    {
                        using (Horizontal.Do())
                        {
                            EditorGUILayout.TextField(style.name, EditorStyles.label);
                            GUILayout.Label(style.name, style);
                        }
                    }
                }
            }
        }