Ejemplo n.º 1
0
 protected override void PerformDrop()
 {
     if (ObjectPlacementPathTileConnectionSettingsChangeValidation.Validate(true))
     {
         List <GameObject> validUnityPrefabsInvolvedInDropOperation = PrefabValidator.GetValidPrefabsFromEntityCollection(DragAndDrop.objectReferences, false);
         if (validUnityPrefabsInvolvedInDropOperation.Count != 0)
         {
             PerformDropUsingFirstPrefabInValidUnityPrefabCollection(validUnityPrefabsInvolvedInDropOperation);
         }
     }
 }
        protected override void PerformDrop()
        {
            if (_dropDestination == DropDestination.Element)
            {
                if (_destinationDecorPaintBrushElement == null)
                {
                    return;
                }

                List <GameObject> validUnityPrefabsInvolvedInDropOperation = PrefabValidator.GetValidPrefabsFromEntityCollection(DragAndDrop.objectReferences, false);
                if (validUnityPrefabsInvolvedInDropOperation.Count != 0)
                {
                    PerformDropUsingFirstPrefabInValidUnityPrefabCollection(validUnityPrefabsInvolvedInDropOperation);
                }
            }
            else
            {
                if (_destinationBrush == null)
                {
                    return;
                }

                List <GameObject> validUnityPrefabs = PrefabValidator.GetValidPrefabsFromEntityCollection(DragAndDrop.objectReferences, false);
                if (validUnityPrefabs.Count != 0)
                {
                    UndoEx.RecordForToolAction(_destinationBrush);
                    foreach (GameObject unityPrefab in validUnityPrefabs)
                    {
                        DecorPaintObjectPlacementBrushElement newElement = _destinationBrush.CreateNewElement();

                        PrefabCategory categoryWhichContainsPrefab = PrefabCategoryDatabase.Get().GetPrefabCategoryWhichContainsPrefab(unityPrefab);
                        if (categoryWhichContainsPrefab != null)
                        {
                            newElement.Prefab = categoryWhichContainsPrefab.GetPrefabByUnityPrefab(unityPrefab);
                        }
                        else
                        {
                            Prefab prefab = PrefabFactory.Create(unityPrefab);
                            UndoEx.RecordForToolAction(_destinationBrush.DestinationCategoryForElementPrefabs);
                            PrefabWithPrefabCategoryAssociationQueue.Instance.Enqueue(PrefabWithPrefabCategoryAssociationFactory.Create(prefab, _destinationBrush.DestinationCategoryForElementPrefabs));
                            newElement.Prefab = prefab;
                        }
                    }
                }
            }

            Octave3DWorldBuilder.ActiveInstance.RepaintAllEditorWindows();
        }
Ejemplo n.º 3
0
        private void ExtractAllValidDroppedPrefabs()
        {
            List <GameObject> validUnityPrefabs = PrefabValidator.GetValidPrefabsFromEntityCollection(DragAndDrop.objectReferences, false);

            _validDroppedPrefabs = PrefabFactory.Create(validUnityPrefabs);
        }