Ejemplo n.º 1
0
 public static System.Type SearchBar(params System.Type[] types)
 {
     if (SceneModeUtility.s_NoneButtonContent == null)
     {
         SceneModeUtility.s_NoneButtonContent      = EditorGUIUtility.IconContent("sv_icon_none");
         SceneModeUtility.s_NoneButtonContent.text = "None";
     }
     if (SceneModeUtility.s_FocusType != null && ((UnityEngine.Object)SceneModeUtility.s_HierarchyWindow == (UnityEngine.Object)null || SceneModeUtility.s_HierarchyWindow.m_SearchFilter != "t:" + SceneModeUtility.s_FocusType.Name))
     {
         SceneModeUtility.s_FocusType = (System.Type)null;
     }
     GUILayout.Label("Scene Filter:");
     EditorGUILayout.BeginHorizontal();
     if (SceneModeUtility.TypeButton(EditorGUIUtility.TempContent("All", (Texture)AssetPreview.GetMiniTypeThumbnail(typeof(GameObject))), SceneModeUtility.s_FocusType == null, SceneModeUtility.styles.typeButton))
     {
         SceneModeUtility.SearchForType((System.Type)null);
     }
     for (int index = 0; index < types.Length; ++index)
     {
         System.Type type      = types[index];
         Texture2D   texture2D = type != typeof(Renderer) ? (type != typeof(Terrain) ? AssetPreview.GetMiniTypeThumbnail(type) : EditorGUIUtility.IconContent("Terrain Icon").image as Texture2D) : EditorGUIUtility.IconContent("MeshRenderer Icon").image as Texture2D;
         if (SceneModeUtility.TypeButton(EditorGUIUtility.TempContent(ObjectNames.NicifyVariableName(type.Name) + "s", (Texture)texture2D), type == SceneModeUtility.s_FocusType, SceneModeUtility.styles.typeButton))
         {
             SceneModeUtility.SearchForType(type);
         }
     }
     GUILayout.FlexibleSpace();
     EditorGUILayout.EndHorizontal();
     return(SceneModeUtility.s_FocusType);
 }
Ejemplo n.º 2
0
        public static Type SearchBar(params Type[] types)
        {
            if (SceneModeUtility.s_NoneButtonContent == null)
            {
                SceneModeUtility.s_NoneButtonContent      = EditorGUIUtility.IconContent("sv_icon_none");
                SceneModeUtility.s_NoneButtonContent.text = "None";
            }
            if (SceneModeUtility.s_FocusType != null && (SceneModeUtility.s_HierarchyWindow == null || SceneModeUtility.s_HierarchyWindow.m_SearchFilter != "t:" + SceneModeUtility.s_FocusType.Name))
            {
                SceneModeUtility.s_FocusType = null;
            }
            GUILayout.Label("Scene Filter:", new GUILayoutOption[0]);
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUIContent label = EditorGUIUtility.TempContent("All", AssetPreview.GetMiniTypeThumbnail(typeof(GameObject)));

            if (SceneModeUtility.TypeButton(label, SceneModeUtility.s_FocusType == null, SceneModeUtility.styles.typeButton))
            {
                SceneModeUtility.SearchForType(null);
            }
            for (int i = 0; i < types.Length; i++)
            {
                Type      type = types[i];
                Texture2D i2;
                if (type == typeof(Renderer))
                {
                    i2 = (EditorGUIUtility.IconContent("MeshRenderer Icon").image as Texture2D);
                }
                else
                {
                    if (type == typeof(Terrain))
                    {
                        i2 = (EditorGUIUtility.IconContent("Terrain Icon").image as Texture2D);
                    }
                    else
                    {
                        i2 = AssetPreview.GetMiniTypeThumbnail(type);
                    }
                }
                string     t      = ObjectNames.NicifyVariableName(type.Name) + "s";
                GUIContent label2 = EditorGUIUtility.TempContent(t, i2);
                if (SceneModeUtility.TypeButton(label2, type == SceneModeUtility.s_FocusType, SceneModeUtility.styles.typeButton))
                {
                    SceneModeUtility.SearchForType(type);
                }
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            return(SceneModeUtility.s_FocusType);
        }