Пример #1
0
 public void PushContent(ClipBoardContent newContent)
 {
     //clipBoardContents.Add(newContent);
     clipBoardContents.Push(newContent);
 }
Пример #2
0
        void Update()
        {
#if UNITY_EDITOR
            if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.A))
            {
                WorkspaceManager.Instance.SetAllSelected();
            }
#else
            if (shouldMultiSelect && Input.GetKeyDown(KeyCode.A))
            {
                BlockDiagramManager.Instance.SetAllSelected();
            }
#endif

            if (Input.GetKeyDown(KeyCode.Delete))
            {
                WorkspaceManager.Instance.DeleteSelected();
            }
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                WorkspaceManager.Instance.SetAllUnselected();
            }

            if (Input.GetKeyDown(KeyCode.LeftControl))
            {
                shouldMultiSelect = true;
            }
            if (Input.GetKeyUp(KeyCode.LeftControl))
            {
                shouldMultiSelect = false;
            }

            if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift))
            {
                isShiftPressed = true;
            }
            if (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift))
            {
                isShiftPressed = false;
            }

            if (Input.GetKeyDown(KeyCode.LeftAlt))
            {
                isAltPressed = true;
            }
            if (Input.GetKeyUp(KeyCode.LeftAlt))
            {
                isAltPressed = false;
            }

            // Ctrl + C.
            if (Input.GetKeyDown(KeyCode.C))
            {
#if UNITY_EDITOR
                if (isShiftPressed)
#else
                if (shouldMultiSelect)
#endif
                {
                    List <GraphItem> selectedBlock = WorkspaceManager.Instance.GetCurrentSelectedBlockList;
                    List <GraphLine> selectedLine  = WorkspaceManager.Instance.GetCurrentSelectedLineList;

                    ClipBoardContent newContent = new ClipBoardContent(ClipboardType.Copy, selectedBlock, selectedLine);
                    ClipBoardManager.Instance.PushContent(newContent);
                }
            }

            // Ctrl + V.
            if (Input.GetKeyDown(KeyCode.V))
            {
#if UNITY_EDITOR
                if (isShiftPressed)
#else
                if (shouldMultiSelect)
#endif
                {
                    ClipBoardContent content = ClipBoardManager.Instance.PopContent();
                    WorkspaceManager.Instance.DuplicateBlocks(content.blocks);
                    WorkspaceManager.Instance.DuplicateLines(content.lines);
                }
            }

            // Ctrl + Z.
            if (Input.GetKeyDown(KeyCode.Z))
            {
#if UNITY_EDITOR
                if (isShiftPressed)
#else
                if (shouldMultiSelect)
#endif
                {
                }
            }
        }