Ejemplo n.º 1
0
 public EditPreset ToEdit(ConfigPreset EditablePreset)
 {
     OriginalName = EditablePreset.ConfigurationName;
     InputName    = OriginalName;
     InEdit       = EditablePreset;
     return(this);
 }
Ejemplo n.º 2
0
        public ConfigPreset Clone()
        {
            ConfigPreset Clone = new ConfigPreset();

            Clone.isDefault         = false;
            Clone.ConfigurationName = ConfigurationName + "(Copy)";
            Clone.FolderPresets     = new List <FolderConfig>(FolderPresets);
            return(Clone);
        }
Ejemplo n.º 3
0
        //-----------------------------------------------TaB GUI'S--------------------------------------------------------------------------------------
        private void ShowConfigGUI()
        {
            if (LocalConfigPresets.Count > 0)
            {
                EnableRename = true;
            }
            else
            {
                EnableRename = false;
            }

            //----------------------------------------//Header\\----------------------------------------------------------------------------------------
            #region Header
            EditorGUILayout.BeginHorizontal();            //------------------------------------This is a Horizontal Group.
            //Chequeo cuantos presets estan disponibles y los muestro, si no hay nada aún, Muestro "Empty".
            ConfirmIfAviablePresetsExist();
            PresetSelected = EditorGUILayout.Popup(PresetSelected, AviablePresets);
            if (GUILayout.Button("Add"))
            {
                var item = new ConfigPreset();
                item.isDefault = false;
                //string name = item.ConfigurationName;
                LocalConfigPresets.Add(item);
                if (LocalConfigPresets.Count - 1 >= 0)
                {
                    PresetSelected = LocalConfigPresets.Count - 1;
                }
                else
                {
                    PresetSelected = 0;
                }
                var editWindow = GetWindow <EditPreset>().ToEdit(item);
                HasBeenModified = true;
                editWindow.Show();
            }
            if (GUILayout.Button("Duplicate"))
            {
                LocalConfigPresets.Add(LocalConfigPresets[PresetSelected].Clone());
            }

            EditorGUI.BeginDisabledGroup(LocalConfigPresets[PresetSelected].isDefault);
            if (GUILayout.Button("Edit"))
            {
                var editWindow = GetWindow <EditPreset>();
                editWindow.ToEdit(LocalConfigPresets[PresetSelected]);
                HasBeenModified = true;
                editWindow.Show();
            }
            if (GUILayout.Button("Delete"))
            {
                LocalConfigPresets.Remove(LocalConfigPresets[PresetSelected]);
                if (LocalConfigPresets.Count - 1 >= 0)
                {
                    PresetSelected = LocalConfigPresets.Count - 1;
                }
                else
                {
                    PresetSelected = 0;
                }
                HasBeenModified = true;
                ConfirmIfAviablePresetsExist();
            }
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndHorizontal();            //--------------------------------------Here ends a Horizontal Group.
            #endregion
            //-------------------------------------------//Body\\-----------------------------------------------------------------------------------------
            #region Body
            GUILayout.Space(3);
            HorizontalLine(Color.grey);
            HorizontalLine(Color.grey);
            GUILayout.Space(3);

            ConfigScrollPos = EditorGUILayout.BeginScrollView(ConfigScrollPos, false, false, new GUILayoutOption[] { GUILayout.Height(150) });
            if (LocalConfigPresets.Count > 0)
            {
                WritableConfigPresetsAviable = true;
                LocalFolderPresets           = LocalConfigPresets[PresetSelected].GetFolderPresets();
                foreach (var item in LocalConfigPresets[PresetSelected].GetFolderPresets())
                {
                    ShowFolderConfigSet(item);
                }
                if (FoldersToClear.Count > 0)
                {
                    ClearFolderList();
                }
            }
            else
            {
                WritableConfigPresetsAviable = false;
            }
            EditorGUILayout.EndScrollView();

            GUILayout.Space(3);
            HorizontalLine(Color.grey);
            HorizontalLine(Color.grey);
            GUILayout.Space(3);
            #endregion
            //-------------------------------------------//Bottom\\---------------------------------------------------------------------------------------
            #region Bottom
            EditorGUI.BeginDisabledGroup(!WritableConfigPresetsAviable);

            EditorGUILayout.PrefixLabel("Add New Folders", new GUIStyle()
            {
                fontStyle = FontStyle.Bold
            });
            EditorGUILayout.BeginHorizontal();            //------------------------------------This is a Horizontal Group.
            //---------------------------------------Creo un nuevo Preset de Carpeta---------------------------
            //EditorGUILayout.LabelField("New Folder name: ", GUILayout.Width(75));

            if (GUILayout.Button("Create New Folder"))
            {
                if (LocalConfigPresets.Count > 0)
                {
                    List <string> NewAviableExtentionList = new List <string> {
                        ".mat"
                    };                                                                                                                 //Guardamos la Lista de extensiones.
                    LocalConfigPresets[PresetSelected].AddFolderPreset(newFolderName, newFolderTypeSelected, NewAviableExtentionList); //Guardamos el preset de la carpeta.
                    LocalFolderPresets    = LocalConfigPresets[PresetSelected].GetFolderPresets();
                    newFolderName         = DefaultFolderName;                                                                         //Reseteamos la previsualizacion del nombre.
                    newFolderTypeSelected = 0;                                                                                         //Reseteamos la previsualizacion del tipo.

                    foreach (var preset in LocalConfigPresets)
                    {
                        foreach (var folder in preset.FolderPresets)
                        {
                            MonoBehaviour.print("Presets Creados -->" + " Preset: " + preset.ConfigurationName + "Carpeta: " + folder.FolderName);
                        }
                    }
                }
                HasBeenModified = true;
            }
            newFolderName = EditorGUILayout.TextField(newFolderName);
            if (FolderTypeOptions == null)
            {
                FolderTypeOptions = new string[] { "Empty" }
            }
            ;
            if (FolderTypeOptions != null)
            {
                newFolderTypeSelected = EditorGUILayout.Popup(newFolderTypeSelected, FolderTypeOptions);
            }

            EditorGUILayout.EndHorizontal();            //--------------------------------------Here ends a Horizontal Group.
            EditorGUI.EndDisabledGroup();
            #endregion
        }