Ejemplo n.º 1
0
        void OnGUI()
        {
            if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode)
            {
                GUILayout.Label("Not available in Play mode!", EditorStyles.boldLabel);
                return;
            }

            GUILayout.Label(HelpMSG_00, EditorStyles.boldLabel);
            GUILayout.Space(4);
            EditorGUILayout.HelpBox(HelpMSG_01, MessageType.Info);
            CustomEditorGUI.DrawSeperator();
            origin = EditorGUILayout.ObjectField(new GUIContent("Source", "Root of Sources"), origin, typeof(GameObject), allowSceneObjects: true) as GameObject;
            CustomEditorGUI.DrawSeperator();

            if (bFoldoutComponentList = EditorGUILayout.Foldout(bFoldoutComponentList,
                                                                string.Format("The remaining components({0})", FilteredComponent.Count)))
            {
                var enumerator = FilterableComponent.GetEnumerator();
                EditorGUI.indentLevel++;
                while (enumerator.MoveNext())
                {
                    var current = enumerator.Current;
                    using (new EditorGUI.DisabledGroupScope(!current.Value))
                    {
                        bool bFiltered = FilteredComponent.Contains(current.Key);
                        EditorGUI.BeginChangeCheck();
                        bool bToggle = EditorGUILayout.ToggleLeft(current.Key.ToString(), bFiltered);
                        if (EditorGUI.EndChangeCheck())
                        {
                            if (bToggle && !bFiltered)
                            {
                                FilteredComponent.Add(current.Key);
                            }
                            else if (bFiltered)
                            {
                                FilteredComponent.Remove(current.Key);
                            }
                        }
                    }
                }
                EditorGUI.indentLevel--;
            }

            if (isForNavMesh)
            {
                EditorGUI.indentLevel += 2;
                layerMask              = CustomEditorGUI.LayerMaskField("LayerMask", layerMask);
                EditorGUI.indentLevel -= 2;
            }

            if (isRemovableState)
            {
                bRemoveAll = EditorGUILayout.ToggleLeft("Remove All(except for Nav Mesh)", bRemoveAll);
            }

            using (new EditorGUI.DisabledGroupScope(!origin))
            {
                if (GUILayout.Button("Bake!", GUILayout.Height(30)))
                {
                    Bake();
                }
            }
            if (CustomEditorGUI.DestroyOBJBtn(baked, "Baked", GUILayout.Height(30)))
            {
                baked = null;
            }
        }