void HandleCommandEvents(int treeViewKeyboardControlID)
        {
            if (GUIUtility.keyboardControl != treeViewKeyboardControlID)
            {
                return;
            }

            EventType eventType = Event.current.type;

            if (eventType == EventType.ExecuteCommand || eventType == EventType.ValidateCommand)
            {
                bool execute = eventType == EventType.ExecuteCommand;

                if (Event.current.commandName == EventCommandNames.Delete || Event.current.commandName == EventCommandNames.SoftDelete)
                {
                    Event.current.Use();
                    if (execute)
                    {
                        ProjectWindowUtil.DeleteAssets(m_TreeView.GetSelection().ToList(), true);
                    }
                }
                else if (Event.current.commandName == EventCommandNames.Duplicate)
                {
                    Event.current.Use();
                    if (execute)
                    {
                        ProjectWindowUtil.DuplicateAssets(m_TreeView.GetSelection());
                    }
                }
            }
        }
Пример #2
0
 private void HandleCommandEvents(int treeViewKeyboardControlID)
 {
     if (GUIUtility.keyboardControl == treeViewKeyboardControlID)
     {
         EventType type = Event.current.type;
         if (type == EventType.ExecuteCommand || type == EventType.ValidateCommand)
         {
             bool flag = type == EventType.ExecuteCommand;
             if (Event.current.commandName == "Delete" || Event.current.commandName == "SoftDelete")
             {
                 Event.current.Use();
                 if (flag)
                 {
                     ProjectWindowUtil.DeleteAssets(this.m_TreeView.GetSelection().ToList <int>(), true);
                 }
             }
             else if (Event.current.commandName == "Duplicate")
             {
                 Event.current.Use();
                 if (flag)
                 {
                     ProjectWindowUtil.DuplicateAssets(this.m_TreeView.GetSelection());
                 }
             }
         }
     }
 }
Пример #3
0
 internal static IEnumerable <UnityEngine.Object> DuplicateAssets(IEnumerable <int> instanceIDs)
 {
     return(ProjectWindowUtil.DuplicateAssets(from id in instanceIDs
                                              select EditorUtility.InstanceIDToObject(id)));
 }
Пример #4
0
 internal static void DuplicateSelectedAssets()
 {
     Selection.objects = ProjectWindowUtil.DuplicateAssets(Selection.objects).ToArray <UnityEngine.Object>();
 }