示例#1
0
        /// <summary>Is registered from HQ.</summary>
        /// <param name="guid"></param>
        /// <param name="selectionRect"></param>
        internal static void    OnProjectElementGUI(string guid, Rect selectionRect)
        {
            if (Event.current.type == EventType.Repaint)
            {
                if (ProjectCopyAssets.GUIDs.Contains(guid) == true)
                {
                    selectionRect.x      -= 1F;
                    selectionRect.width   = 1F;
                    selectionRect.y      += 1F;
                    selectionRect.height -= 2F;

                    if (ProjectCopyAssets.cut == true)
                    {
                        EditorGUI.DrawRect(selectionRect, ProjectCopyAssets.CutColor);
                    }
                    else
                    {
                        EditorGUI.DrawRect(selectionRect, ProjectCopyAssets.CopyColor);
                    }
                }
            }
            else if (Event.current.type == EventType.ValidateCommand)
            {
                if (ProjectCopyAssets.skipEvent == false)
                {
                    ProjectCopyAssets.skipEvent = true;

                    if (Event.current.commandName == "Copy")
                    {
                        if (ProjectCopyAssets.ValidateCopyCutAssets() == true)
                        {
                            ProjectCopyAssets.CopyAssets(null);
                            Event.current.Use();
                        }
                    }
                    else if (Event.current.commandName == "Cut")
                    {
                        if (ProjectCopyAssets.ValidateCopyCutAssets() == true)
                        {
                            ProjectCopyAssets.CutAssets(null);
                            Event.current.Use();
                        }
                    }
                    else if (Event.current.commandName == "Paste")
                    {
                        if (ProjectCopyAssets.ValidatePasteAssets() == true)
                        {
                            ProjectCopyAssets.PasteAssets(null);
                            Event.current.Use();
                        }
                    }
                }
            }
            else
            {
                ProjectCopyAssets.skipEvent = false;
            }
        }