Beispiel #1
0
        void OnGUI()
        {
            GUILayout.Label("Class Name: ", UStyle.Font(GUI.skin.label, TextAnchor.MiddleLeft, 18, FontStyle.Bold));
            m_className = GUILayout.TextField(m_className, UStyle.Font(GUI.skin.textField, TextAnchor.MiddleLeft, 16));

            GUILayout.Space(5);

            GUILayout.Label("Save File Name: ", UStyle.Font(GUI.skin.label, TextAnchor.MiddleLeft, 18, FontStyle.Bold));
            m_saveFileName = GUILayout.TextField(m_saveFileName, UStyle.Font(GUI.skin.textField, TextAnchor.MiddleLeft, 16));

            GUILayout.Space(5);

            GUILayout.Label("Save Path: ", UStyle.Font(GUI.skin.label, TextAnchor.MiddleLeft, 18, FontStyle.Bold));

            GUILayout.BeginHorizontal();
            m_savePath = GUILayout.TextField(m_savePath, UStyle.Font(GUI.skin.textField, TextAnchor.MiddleLeft, 16));
            if (GUILayout.Button("Browse", UStyle.Font(GUI.skin.button, TextAnchor.MiddleCenter, 16), GUILayout.Width(80)))
            {
                m_savePath = EditorUtility.OpenFolderPanel("Browse Save *.asset Path", "", "");
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Create", UStyle.Font(GUI.skin.button, TextAnchor.MiddleCenter, 18), GUILayout.Height(80)))
            {
                CreateAsset();
            }
        }
Beispiel #2
0
        void OnGUI()
        {
            EditorGUILayout.BeginHorizontal("box");
            if (GUILayout.Button("Find", UStyle.Font(GUI.skin.button, TextAnchor.MiddleCenter, 18), GUILayout.Height(50)))
            {
                FindDirectory();
            }
            if (GUILayout.Button("Clean All", UStyle.Font(GUI.skin.button, TextAnchor.MiddleCenter, 18), GUILayout.Height(50)))
            {
                CleanAll();
            }
            if (GUILayout.Button("Export", UStyle.Font(GUI.skin.button, TextAnchor.MiddleCenter, 18), GUILayout.Height(50)))
            {
                Export();
                ShowNotification(new GUIContent("export succeed! -> Assets/MissComponent.txt"));
            }
            EditorGUILayout.EndHorizontal();

            if (m_infos != null)
            {
                m_scrollPosition = EditorGUILayout.BeginScrollView(m_scrollPosition);
                for (var i = 0; i < m_infos.Count; i++)
                {
                    var info = m_infos[i];
                    EditorGUILayout.BeginVertical("box");

                    EditorGUILayout.BeginHorizontal("box");
                    EditorGUILayout.LabelField(info.path, UStyle.Font(GUI.skin.label, TextAnchor.MiddleLeft, 14, FontStyle.Bold), GUILayout.Height(26));
                    if (GUILayout.Button("Goto", GUILayout.Width(45), GUILayout.Height(26)))
                    {
                        EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(info.path, typeof(GameObject)) as GameObject);
                    }

                    if (GUILayout.Button("Clean", GUILayout.Width(45), GUILayout.Height(26)))
                    {
                        CleanObject(info);
                        m_infos.RemoveAt(i);
                        break;
                    }
                    EditorGUILayout.EndHorizontal();

                    for (int k = 0; k < info.components.Count; k++)
                    {
                        var component = info.components[k];
                        EditorGUILayout.BeginHorizontal("box");
                        EditorGUILayout.LabelField(component.path);
                        EditorGUILayout.EndHorizontal();
                    }

                    EditorGUILayout.EndVertical();
                }

                EditorGUILayout.EndScrollView();
            }
        }