コード例 #1
0
        public static Type ConstructableTypePopup <T>(Rect position, Type currentType, GUIStyle style = null)
        {
            Type[]   subclasses    = EditorReflector.FindConstructableSubClassesWithNull(typeof(T));
            string[] subclassNames = EditorReflector.FindConstructableSubClassNamesWithNull(typeof(T));
            int      currentIndex  = Array.IndexOf(subclasses, currentType);

            return(subclasses[EditorGUI.Popup(position, currentIndex, subclassNames, style ?? EditorStyles.popup)]);
        }
コード例 #2
0
        public static Type ConstructableTypePopup <T>(Rect position, Type currentType, Func <string, string> formatLabels, GUIStyle style = null)
        {
            Type[]   subclasses    = EditorReflector.FindConstructableSubClassesWithNull(typeof(T));
            string[] subclassNames = EditorReflector.FindConstructableSubClassNamesWithNull(typeof(T));
            for (int i = 0; i < subclassNames.Length; i++)
            {
                subclassNames[i] = formatLabels(subclassNames[i]);
            }
            int currentIndex = Array.IndexOf(subclasses, currentType);

            return(subclasses[EditorGUI.Popup(position, currentIndex, subclassNames, style ?? EditorStyles.popup)]);
        }