Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        protected override void UpdateOverride()
        {
            base.UpdateOverride();
            if (!RuntimeEditorApplication.IsPointerOverWindow(this))
            {
                return;
            }

            if (InputController._GetKeyDown(SelectAllKey))
            {
                if (InputController._GetKey(ModifierKey))
                {
                    if (RuntimeEditorApplication.IsActiveWindow(this))
                    {
                        m_treeView.SelectedItems = m_treeView.Items;
                    }
                }
            }

            if (RuntimeTools.SpawnPrefab == null)
            {
                return;
            }

            m_treeView.ExternalItemDrag(InputController._MousePosition);

            if (InputController._GetMouseButtonUp(0))
            {
                m_isSpawningPrefab = true;
                GameObject prefabInstance = RuntimeTools.SpawnPrefab.InstantiatePrefab(Vector3.zero, Quaternion.identity);
                prefabInstance.SetActive(true);

                ExposeToEditor exposeToEditor = prefabInstance.GetComponent <ExposeToEditor>();
                if (exposeToEditor == null)
                {
                    exposeToEditor = prefabInstance.AddComponent <ExposeToEditor>();
                }

                exposeToEditor.SetName(RuntimeTools.SpawnPrefab.name);
                RuntimeUndo.BeginRecord();
                RuntimeUndo.RecordSelection();
                RuntimeUndo.BeginRegisterCreateObject(prefabInstance);
                RuntimeUndo.EndRecord();

                bool isEnabled = RuntimeUndo.Enabled;
                RuntimeUndo.Enabled = false;
                RuntimeSelection.activeGameObject = prefabInstance;
                RuntimeUndo.Enabled = isEnabled;

                RuntimeUndo.BeginRecord();
                RuntimeUndo.RegisterCreatedObject(prefabInstance);
                RuntimeUndo.RecordSelection();
                RuntimeUndo.EndRecord();

                RuntimeTools.SpawnPrefab = null;
            }
        }
 public override void Drag(object[] dragObjects, PointerEventData pointerEventData)
 {
     base.Drag(dragObjects, pointerEventData);
     m_listBox.ExternalItemDrag(pointerEventData.position);
     if (!CanCreatePrefab((ProjectItem)m_listBox.DropTarget, dragObjects))
     {
         m_listBox.ClearTarget();
     }
     Editor.DragDrop.SetCursor(KnownCursor.DropAllowed);
 }
Exemplo n.º 4
0
 public override void Drag(object[] dragObjects, PointerEventData pointerEventData)
 {
     base.Drag(dragObjects, pointerEventData);
     m_treeView.ExternalItemDrag(pointerEventData.position);
     if (CanDrop((ProjectItem)m_treeView.DropTarget, dragObjects))
     {
         Editor.DragDrop.SetCursor(KnownCursor.DropAllowed);
     }
     else
     {
         Editor.DragDrop.SetCursor(KnownCursor.DropNowAllowed);
         m_treeView.ClearTarget();
     }
 }
Exemplo n.º 5
0
 protected virtual void OnDrag(PointerEventData pointerEventData)
 {
     object[] dragObjects = Editor.DragDrop.DragObjects;
     m_treeView.ExternalItemDrag(pointerEventData.position);
     m_lastDropAction = m_treeView.DropAction;
     if (CanDrop(dragObjects))
     {
         Editor.DragDrop.SetCursor(KnownCursor.DropAllowed);
     }
     else
     {
         Editor.DragDrop.SetCursor(KnownCursor.DropNotAllowed);
         m_treeView.ClearTarget();
     }
 }
Exemplo n.º 6
0
        public override void Drag(object[] dragObjects, PointerEventData pointerEventData)
        {
            base.Drag(dragObjects, pointerEventData);
            m_treeView.ExternalItemDrag(pointerEventData.position);

            bool canCreatePrefab = CanCreatePrefab((ProjectItem)m_treeView.DropTarget, dragObjects);
            bool canDrop = CanDrop((ProjectItem)m_treeView.DropTarget, dragObjects);
            if (!canCreatePrefab && !canDrop)
            {
                m_treeView.ClearTarget();

                Editor.DragDrop.SetCursor(KnownCursor.DropNotAllowed);
            }
            else
            {
                Editor.DragDrop.SetCursor(KnownCursor.DropAllowed);
            }
        }
        protected virtual void OnDrag(PointerEventData pointerEventData)
        {
            m_treeView.ExternalItemDrag(pointerEventData.position);
            object[] dragObjects     = Editor.DragDrop.DragObjects;
            bool     canCreatePrefab = CanCreatePrefab((ProjectItem)m_treeView.DropTarget, dragObjects);
            bool     canDrop         = CanDrop((ProjectItem)m_treeView.DropTarget, dragObjects);

            if (!canCreatePrefab && !canDrop)
            {
                m_treeView.ClearTarget();

                Editor.DragDrop.SetCursor(KnownCursor.DropNotAllowed);
            }
            else
            {
                Editor.DragDrop.SetCursor(KnownCursor.DropAllowed);
            }
        }
Exemplo n.º 8
0
        protected virtual void OnDrag(PointerEventData pointerEventData)
        {
            object[] dragObjects = Editor.DragDrop.DragObjects;
            m_listBox.ExternalItemDrag(pointerEventData.position);
            if (!CanCreatePrefab((ProjectItem)m_listBox.DropTarget, dragObjects))
            {
                m_listBox.ClearTarget();

                Editor.DragDrop.SetCursor(KnownCursor.DropNotAllowed);
            }
            else
            {
                ProjectItem dropTarget = (ProjectItem)m_listBox.DropTarget;
                if (dropTarget != null && !dropTarget.IsFolder)
                {
                    m_listBox.ClearTarget();
                }

                Editor.DragDrop.SetCursor(KnownCursor.DropAllowed);
            }
        }