Пример #1
0
 public string GetEnumName()
 {
     return(_enumLibrary.GetEnumName(_enumIndex));
 }
Пример #2
0
        /// <summary>
        /// Description : Displau Color Models
        /// </summary>
        private void DisplayColorModels()
        {
            // Color MODEL
            EditorGUILayout.LabelField("COLOR MODEL", EditorStyles.boldLabel);

            _listCount = _colorsModels.arraySize;
            for (int i = 0; i < _listCount; i++)
            {
                SerializedProperty lColorModel   = _colorsModels.GetArrayElementAtIndex(i);
                SerializedProperty lColorLibrary = lColorModel.FindPropertyRelative("_colorLibrary");

                SerializedProperty lEnumIndex = lColorModel.FindPropertyRelative("_index");

                lColorModel.isExpanded = EditorGUILayout.Foldout(lColorModel.isExpanded, new GUIContent("Color Model " + i));
                if (lColorModel.isExpanded)
                {
                    EditorGUILayout.BeginHorizontal();
                    lColorLibrary.objectReferenceValue = (ColorLibrary)EditorGUILayout.ObjectField(lColorLibrary.objectReferenceValue, typeof(ColorLibrary), false);
                    EditorGUILayout.EndHorizontal();
                    if (lColorLibrary.objectReferenceValue != null)
                    {
                        ColorLibrary lColor = (ColorLibrary)lColorLibrary.objectReferenceValue;

                        if (lColor.GetKeyType() == 1)
                        {
                            EditorGUILayout.BeginHorizontal();
                            EditorGUILayout.LabelField("Enum Path");

                            string[] lEnumList = _manager.GetAllEnums().ToArray();

                            lEnumIndex.intValue = EditorGUILayout.Popup(lEnumIndex.intValue, lEnumList);

                            string lEnumName = _manager.GetEnumName(lEnumIndex.intValue);

                            _manager.GetColorModels()[i].SetEnum(lEnumName);

                            EditorGUILayout.EndHorizontal();

                            if (false == lColor.IsEnumEqual(_manager.GetEnumType(lEnumName)))
                            {
                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField("THE ENUM IS NOT THE RIGHT ONE, Are you sure to use this one ?", _warningInfos);
                                EditorGUILayout.EndHorizontal();
                            }
                        }
                    }
                    EditorGUILayout.BeginHorizontal();

                    if (GUILayout.Button("Delete"))
                    {
                        if (EditorUtility.DisplayDialog("Warning", "Are you sure to delete this enum?", "Yes", "No"))
                        {
                            lColorModel.isExpanded = false;
                            _colorsModels.DeleteArrayElementAtIndex(i);
                            break;
                        }
                    }

                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Space(5);
                }
            }
        }