예제 #1
0
        void DrawIgnoreShaderUI()
        {
            envSettingsInfo = CheckEnvSettingsStore(envSettingsInfo);
            if (null == envSettingsInfo)
            {
                return;
            }
            if (null == envSettingsInfo.m_ignoreShaders)
            {
                envSettingsInfo.m_ignoreShaders = new List <Shader>();
            }

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Set Ignore Shaders, count:" + envSettingsInfo.m_ignoreShaders.Count);
            }
            EditorGUILayout.EndHorizontal();

            for (int i = 0; i < envSettingsInfo.m_ignoreShaders.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(string.Format("Ignore {0}:", (i + 1)), GUILayout.Width(80));

                EditorGUI.BeginChangeCheck(); {
                    envSettingsInfo.m_ignoreShaders[i] = (Shader)EditorGUILayout.ObjectField(envSettingsInfo.m_ignoreShaders[i], typeof(Shader), false);

                    if (GUILayout.Button("¡ª", GUILayout.Width(30)))
                    {
                        //delete in loop
                        envSettingsInfo.m_ignoreShaders.RemoveAt(i);
                        i--;
                    }
                }
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(envSettingsInfo);
                    AssetDatabase.SaveAssets();
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginVertical(blackStyle);
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUI.BeginChangeCheck(); {
                    if (GUILayout.Button(new GUIContent("Add Shader")))
                    {
                        envSettingsInfo.m_ignoreShaders.Add(null);
                    }
                }
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(envSettingsInfo);
                    AssetDatabase.SaveAssets();
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
        }
예제 #2
0
        public static SCEnvSettings CheckEnvSettingsStore(SCEnvSettings envsettings)
        {
            if (envsettings == null)
            {
                string filename = GetSettingsStorePath();
                envsettings = AssetDatabase.LoadAssetAtPath <SCEnvSettings>(filename);
                if (envsettings != null)
                {
                    return(envsettings);
                }
            }
            // Check if scriptable object exists
            string path = GetSettingsStorePath();

            if (!File.Exists(path))
            {
                string dir = Path.GetDirectoryName(path);
                Directory.CreateDirectory(dir);
                envsettings = ScriptableObject.CreateInstance <SCEnvSettings>();
                AssetDatabase.CreateAsset(envsettings, path);
                AssetDatabase.SaveAssets();
            }
            return(envsettings);
        }
예제 #3
0
        void DrawPrafabScanUI()
        {
            envSettingsInfo = CheckEnvSettingsStore(envSettingsInfo);
            if (null == envSettingsInfo)
            {
                return;
            }
            if (null == envSettingsInfo.m_prefabFolders)
            {
                envSettingsInfo.m_prefabFolders = new List <string>();
            }

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Set Prefab Scan Folders:");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUI.BeginChangeCheck();
                {
                    envSettingsInfo.m_sceneAsset = EditorGUILayout.ObjectField(envSettingsInfo.m_sceneAsset, typeof(SceneAsset), true);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(envSettingsInfo);
                    AssetDatabase.SaveAssets();
                }
            }
            EditorGUILayout.EndHorizontal();


            for (int i = 0; i < envSettingsInfo.m_prefabFolders.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();

                EditorGUI.BeginChangeCheck();
                {
                    EditorGUILayout.TextField(string.Format("Scan Folder {0}:", (i + 1)), envSettingsInfo.m_prefabFolders[i]);
                    if (GUILayout.Button("¡ª", GUILayout.Width(30)))
                    {
                        //delete in loop
                        envSettingsInfo.m_prefabFolders.RemoveAt(i);
                        i--;
                    }
                    if (GUILayout.Button("Setting", GUILayout.Width(80)))
                    {
                        envSettingsInfo.m_prefabFolders[i] = EditorUtility.OpenFolderPanel("prefab folder", "", "");
                    }
                }
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(envSettingsInfo);
                    AssetDatabase.SaveAssets();
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginVertical(blackStyle);
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUI.BeginChangeCheck();
                {
                    if (GUILayout.Button(new GUIContent("Add Folder")))
                    {
                        envSettingsInfo.m_prefabFolders.Add("");
                    }
                }
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(envSettingsInfo);
                    AssetDatabase.SaveAssets();
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
        }