FindAssetsOfType() private static method

private static FindAssetsOfType ( string classNames ) : List
classNames string
return List
コード例 #1
0
        public static void Show(Rect buttonRect, string[] classNames, int initialSelectedInstanceID)
        {
            GenericMenu genericMenu = new GenericMenu();
            List <UnityEngine.Object> assetsOfType = AssetSelectionPopupMenu.FindAssetsOfType(classNames);

            if (assetsOfType.Any <UnityEngine.Object>())
            {
                assetsOfType.Sort((Comparison <UnityEngine.Object>)((result1, result2) => EditorUtility.NaturalCompare(result1.name, result2.name)));
                using (List <UnityEngine.Object> .Enumerator enumerator = assetsOfType.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        UnityEngine.Object current = enumerator.Current;
                        GUIContent         content = new GUIContent(current.name);
                        bool on = current.GetInstanceID() == initialSelectedInstanceID;
                        genericMenu.AddItem(content, on, new GenericMenu.MenuFunction2(AssetSelectionPopupMenu.SelectCallback), (object)current);
                    }
                }
            }
            else
            {
                genericMenu.AddDisabledItem(new GUIContent("No Audio Mixers found in this project"));
            }
            genericMenu.DropDown(buttonRect);
        }
コード例 #2
0
        public static void Show(Rect buttonRect, string[] classNames, int initialSelectedInstanceID)
        {
            GenericMenu genericMenu        = new GenericMenu();
            List <UnityEngine.Object> list = AssetSelectionPopupMenu.FindAssetsOfType(classNames);

            if (list.Any <UnityEngine.Object>())
            {
                list.Sort((UnityEngine.Object result1, UnityEngine.Object result2) => EditorUtility.NaturalCompare(result1.name, result2.name));
                foreach (UnityEngine.Object current in list)
                {
                    GUIContent  gUIContent = new GUIContent(current.name);
                    bool        flag       = current.GetInstanceID() == initialSelectedInstanceID;
                    GenericMenu arg_8E_0   = genericMenu;
                    GUIContent  arg_8E_1   = gUIContent;
                    bool        arg_8E_2   = flag;
                    if (AssetSelectionPopupMenu.< > f__mg$cache0 == null)
                    {
                        AssetSelectionPopupMenu.< > f__mg$cache0 = new GenericMenu.MenuFunction2(AssetSelectionPopupMenu.SelectCallback);
                    }
                    arg_8E_0.AddItem(arg_8E_1, arg_8E_2, AssetSelectionPopupMenu.< > f__mg$cache0, current);
                }
            }
            else
            {
                genericMenu.AddDisabledItem(new GUIContent("No Audio Mixers found in this project"));
            }
            genericMenu.DropDown(buttonRect);
        }
コード例 #3
0
        public static void Show(Rect buttonRect, string[] classNames, int initialSelectedInstanceID)
        {
            GenericMenu genericMenu        = new GenericMenu();
            List <UnityEngine.Object> list = AssetSelectionPopupMenu.FindAssetsOfType(classNames);

            if (list.Any <UnityEngine.Object>())
            {
                list.Sort((UnityEngine.Object result1, UnityEngine.Object result2) => EditorUtility.NaturalCompare(result1.name, result2.name));
                foreach (UnityEngine.Object current in list)
                {
                    GUIContent content = new GUIContent(current.name);
                    bool       on      = current.GetInstanceID() == initialSelectedInstanceID;
                    genericMenu.AddItem(content, on, new GenericMenu.MenuFunction2(AssetSelectionPopupMenu.SelectCallback), current);
                }
            }
            else
            {
                genericMenu.AddDisabledItem(new GUIContent("No Audio Mixers found in this project"));
            }
            genericMenu.DropDown(buttonRect);
        }