protected override void UpdateOverride()
        {
            base.UpdateOverride();
            if (RuntimeEditorApplication.IsActiveWindow(this))
            {
                if (InputController._GetKeyDown(RemoveKey))
                {
                    if (m_treeView.SelectedItem != null)
                    {
                        ProjectItem projectItem = (ProjectItem)m_treeView.SelectedItem;
                        if (projectItem.Parent == null)
                        {
                            PopupWindow.Show("Unable to Remove", "Unable to remove root folder", "OK");
                        }
                        else
                        {
                            PopupWindow.Show("Remove Selected assets", "You can not undo this action", "Delete", args =>
                            {
                                m_treeView.RemoveSelectedItems();
                            }, "Cancel");
                        }
                    }
                }
            }


            if (RuntimeEditorApplication.IsPointerOverWindow(this))
            {
                if (m_dragProjectItem != null)
                {
                    m_treeView.ExternalItemDrag(InputController._MousePosition);
                }
            }
        }
Exemple #2
0
        public void DeleteSelectedItems()
        {
            if (m_treeView.SelectedItem != null)
            {
                ProjectItem[] projectItems = m_treeView.SelectedItems.OfType <ProjectItem>().ToArray();
                if (ItemsDeleting != null)
                {
                    ProjectTreeCancelEventArgs args = new ProjectTreeCancelEventArgs(projectItems);
                    ItemsDeleting(this, args);
                    if (args.Cancel)
                    {
                        return;
                    }
                }

                if (projectItems.Any(p => p.Parent == null))
                {
                    m_wm.MessageBox(
                        m_localization.GetString("ID_RTEditor_ProjectTreeView_UnableToRemove", "Unable to remove"),
                        m_localization.GetString("ID_RTEditor_ProjectTreeView_UnableToRemoveRootFolder", "Unable to remove root folder"));
                }
                else
                {
                    m_wm.Confirmation(
                        m_localization.GetString("ID_RTEditor_ProjectTreeView_DeleteSelectedAssets", "Delete selected assets"),
                        m_localization.GetString("ID_RTEditor_ProjectTreeView_YouCannotUndoThisAction", "You cannot undo this action"), (dialog, arg) =>
                    {
                        m_treeView.RemoveSelectedItems();
                    },
                        (dialog, arg) => { },
                        m_localization.GetString("ID_RTEditor_ProjectTreeView_Btn_Delete", "Delete"),
                        m_localization.GetString("ID_RTEditor_ProjectTreeView_Btn_Cancel", "Cancel"));
                }
            }
        }
        public void DeleteSelectedItems()
        {
            if (ItemsDeleting != null)
            {
                if (m_listBox.SelectedItems != null)
                {
                    ProjectTreeCancelEventArgs args = new ProjectTreeCancelEventArgs(m_listBox.SelectedItems.OfType <ProjectItem>().ToArray());
                    ItemsDeleting(this, args);
                    if (args.Cancel)
                    {
                        return;
                    }
                }
            }

            m_windowManager.Confirmation(
                m_localization.GetString("ID_RTEditor_ProjectFolderView_DeleteSelectedAssets", "Delete Selected Assets"),
                m_localization.GetString("ID_RTEditor_ProjectFolderView_YouCanNotUndoThisAction", "You cannot undo this action"),
                (sender, arg) =>
            {
                m_listBox.RemoveSelectedItems();
                bool wasEnabled          = Editor.Undo.Enabled;
                Editor.Undo.Enabled      = false;
                Editor.Selection.objects = null;
                Editor.Undo.Enabled      = wasEnabled;
            },
                (sender, arg) => { },
                m_localization.GetString("ID_RTEditor_ProjectFolderView_BtnDelete", "Delete"),
                m_localization.GetString("ID_RTEditor_ProjectFolderView_BtnCancel", "Cancel"));
        }
Exemple #4
0
 protected override void UpdateOverride()
 {
     base.UpdateOverride();
     if (Editor.ActiveWindow == this)
     {
         if (Editor.Input.GetKeyDown(RemoveKey))
         {
             if (m_treeView.SelectedItem != null)
             {
                 ProjectItem projectItem = (ProjectItem)m_treeView.SelectedItem;
                 if (projectItem.Parent == null)
                 {
                     PopupWindow.Show("Unable to Remove", "Unable to remove root folder", "OK");
                 }
                 else
                 {
                     PopupWindow.Show("Remove Selected assets", "You can not undo this action", "Delete", args =>
                     {
                         m_treeView.RemoveSelectedItems();
                     }, "Cancel");
                 }
             }
         }
     }
 }
Exemple #5
0
        private void OnRemoveLayer()
        {
            List <TerrainLayer> layers        = TerrainData.terrainLayers.ToList();
            TerrainLayer        selectedLayer = (TerrainLayer)m_layersList.SelectedItem;

            layers.Remove(selectedLayer);
            TerrainData.terrainLayers = layers.ToArray();
            m_layersList.RemoveSelectedItems();
        }
 protected override void UpdateOverride()
 {
     base.UpdateOverride();
     if (Editor.Input.GetKeyDown(RemoveKey) && Editor.ActiveWindow == this)
     {
         PopupWindow.Show("Delete Selected Assets", "You cannot undo this action", "Delete", arg =>
         {
             m_listBox.RemoveSelectedItems();
         },
                          "No");
     }
 }
Exemple #7
0
        private void OnDeleteButtonClick()
        {
            Sprite selectedBrush = SelectedBrush;

            m_source.UserBrushes.Remove(selectedBrush);
            m_brushesList.RemoveSelectedItems();

            Destroy(selectedBrush.texture);
            Destroy(selectedBrush);

            m_brushesList.SelectedIndex = 0;
        }
 public void DeleteSelectedAssets()
 {
     m_windowManager.Confirmation("Delete Selected Assets", "You cannot undo this action", (sender, arg) =>
     {
         m_listBox.RemoveSelectedItems();
         bool wasEnabled          = Editor.Undo.Enabled;
         Editor.Undo.Enabled      = false;
         Editor.Selection.objects = null;
         Editor.Undo.Enabled      = wasEnabled;
     },
                                  (sender, arg) => { },
                                  "Delete");
 }
Exemple #9
0
 public void DeleteSelectedFolders()
 {
     if (m_treeView.SelectedItem != null)
     {
         ProjectItem[] projectItems = m_treeView.SelectedItems.OfType <ProjectItem>().ToArray();
         if (projectItems.Any(p => p.Parent == null))
         {
             m_wm.MessageBox("Unable to Remove", "Unable to remove root folder");
         }
         else
         {
             m_wm.Confirmation("Delete Selected Assets", "You cannot undo this action", (dialog, arg) =>
             {
                 m_treeView.RemoveSelectedItems();
             },
                               (dialog, arg) => { },
                               "Delete", "Cancel");
         }
     }
 }
        private void OnRemoveTree()
        {
            TreePrototype[] oldTrees = TerrainData.treePrototypes.ToArray();

            List <TreePrototype> newTrees     = TerrainData.treePrototypes.ToList();
            TreePrototype        selectedTree = (TreePrototype)m_treeList.SelectedItem;

            newTrees.Remove(selectedTree);
            TerrainData.treePrototypes = newTrees.ToArray();
            m_treeList.RemoveSelectedItems();

            RecordState(oldTrees);

            UpdateVisualState();

            if (SelectedTreeChanged != null)
            {
                SelectedTreeChanged(this, EventArgs.Empty);
            }
        }
        private void OnRemoveDetail()
        {
            DetailPrototype[] oldDetails = TerrainData.detailPrototypes.ToArray();

            List <DetailPrototype> details        = TerrainData.detailPrototypes.ToList();
            DetailPrototype        selectedDetail = ((DetailPrototypeWrapper)m_detailsList.SelectedItem).Prototype;

            details.Remove(selectedDetail);
            TerrainData.detailPrototypes = details.ToArray();
            m_detailsList.RemoveSelectedItems();

            RecordState(oldDetails);

            UpdateVisualState();

            if (SelectedDetailChanged != null)
            {
                SelectedDetailChanged(this, EventArgs.Empty);
            }
        }
Exemple #12
0
        private void OnRemoveLayer()
        {
            float[,,] oldAlphamaps = GetAlphamaps();
            TerrainLayer[] oldLayers = TerrainData.terrainLayers.ToArray();

            List <TerrainLayer> layers        = TerrainData.terrainLayers.ToList();
            TerrainLayer        selectedLayer = (TerrainLayer)m_layersList.SelectedItem;

            layers.Remove(selectedLayer);
            TerrainData.terrainLayers = layers.ToArray();
            m_layersList.RemoveSelectedItems();

            RecordState(oldAlphamaps, oldLayers);

            UpdateVisualState();

            if (SelectedLayerChanged != null)
            {
                SelectedLayerChanged(this, EventArgs.Empty);
            }
        }