public void RenameConfiguration(ObjectPlacementPathTileConnectionConfiguration configuration, string newName)
 {
     if (ContainsConfiguration(configuration))
     {
         _configurations.RenameEntity(configuration, newName);
     }
 }
Example #2
0
        private static ObjectPlacementPathTileConnectionConfiguration CreateNewConfigurationWithUniqueName(string configurationName, List <string> existingConfigurationNames)
        {
            ObjectPlacementPathTileConnectionConfiguration newConfiguration = Octave3DWorldBuilder.ActiveInstance.CreateScriptableObject <ObjectPlacementPathTileConnectionConfiguration>();

            newConfiguration.Name = UniqueEntityNameGenerator.GenerateUniqueName(configurationName, existingConfigurationNames);

            return(newConfiguration);
        }
 public void RemoveAndDestroyConfiguration(ObjectPlacementPathTileConnectionConfiguration configuration)
 {
     if (ContainsConfiguration(configuration))
     {
         _configurations.RemoveEntity(configuration);
         UndoEx.DestroyObjectImmediate(configuration);
     }
 }
        public void SetActiveConfiguration(ObjectPlacementPathTileConnectionConfiguration newActiveConfiguration)
        {
            if (newActiveConfiguration == null || !ContainsConfiguration(newActiveConfiguration))
            {
                return;
            }

            _configurations.MarkEntity(newActiveConfiguration);
        }
Example #5
0
 private void RenderCreateNewConfigurationButton()
 {
     if (GUILayout.Button(GetContentForCreateNewConfigurationButton(), GUILayout.Width(EditorGUILayoutEx.PreferedActionButtonWidth)))
     {
         UndoEx.RecordForToolAction(_database);
         ObjectPlacementPathTileConnectionConfiguration newConfig = _database.CreateConfiguration(ViewData.NameForNewConfiguration);
         newConfig.ExtractConfigurationDataFromSettings(PathObjectPlacement.Get().PathSettings.TileConnectionSettings);
     }
 }
        private void RenderActiveConfigurationNameChangeField()
        {
            ObjectPlacementPathTileConnectionConfiguration activeConfiguration = ObjectPlacementPathTileConnectionConfigurationDatabase.Get().ActiveConfiguration;
            string newString = EditorGUILayoutEx.DelayedTextField(GetContentForActiveConfigurationNameChangeField(), activeConfiguration.Name);

            if (newString != activeConfiguration.Name)
            {
                UndoEx.RecordForToolAction(activeConfiguration);
                activeConfiguration.Name = newString;
            }
        }
        public ObjectPlacementPathTileConnectionConfiguration CreateConfiguration(string configurationName)
        {
            if (!string.IsNullOrEmpty(configurationName))
            {
                ObjectPlacementPathTileConnectionConfiguration newConfiguration = ObjectPlacementPathTileConnectionConfigurationFactory.Create(configurationName, GetAllConfigurationNames());
                _configurations.AddEntity(newConfiguration);

                if (NumberOfConfigurations == 1)
                {
                    SetActiveConfiguration(newConfiguration);
                }

                return(newConfiguration);
            }

            return(null);
        }
        private void RenderActiveConfigurationSelectionPopup()
        {
            ObjectPlacementPathTileConnectionConfigurationDatabase configurationDatabase = ObjectPlacementPathTileConnectionConfigurationDatabase.Get();
            string newString = EditorGUILayoutEx.Popup(GetContentForActiveConfigurationSelectionPopup(), configurationDatabase.ActiveConfiguration.Name, configurationDatabase.GetAllConfigurationNames());

            if (newString != configurationDatabase.ActiveConfiguration.Name)
            {
                ObjectPlacementPathTileConnectionConfiguration newActiveConfiguration = configurationDatabase.GetConfigurationByName(newString);
                if (newActiveConfiguration != null)
                {
                    UndoEx.RecordForToolAction(configurationDatabase);
                    PathObjectPlacement.Get().PathSettings.TileConnectionSettings.RecordAllTileConnectionTypeSettingsForUndo();
                    configurationDatabase.SetActiveConfiguration(newActiveConfiguration);
                    newActiveConfiguration.ApplyConfigurationDataToSettings(PathObjectPlacement.Get().PathSettings.TileConnectionSettings);
                }
            }
        }
 public bool ContainsConfiguration(ObjectPlacementPathTileConnectionConfiguration configuration)
 {
     return(_configurations.ContainsEntity(configuration));
 }