コード例 #1
0
        protected virtual void ExecuteCommands(Flowchart flowchart)
        {
            if (Event.current.type == EventType.ExecuteCommand)
            {
                switch (Event.current.commandName)
                {
                case "Copy":
                    Copy(flowchart);
                    Event.current.Use();
                    break;
                
                case "Cut":
                    Cut(flowchart);
                    Event.current.Use();
                    break;

                case "Paste":
                    Paste(flowchart, position.center - position.position);
                    Event.current.Use();
                    break;

                case "Delete":
                    DeleteBlocks(flowchart.SelectedBlocks);
                    Event.current.Use();
                    break;

                case "Duplicate":
                    Duplicate(flowchart);
                    Event.current.Use();
                    break;

                case "SelectAll":
                    Undo.RecordObject(flowchart, "Selection");
                    flowchart.ClearSelectedBlocks();
                    foreach (var block in flowchart.GetComponents<Block>())
                    {
                        flowchart.AddSelectedBlock(block);
                    }
                    Event.current.Use();
                    break;

                case "Find":
                    blockPopupSelection = 0;
                    EditorGUI.FocusTextInControl(searchFieldName);
                    Event.current.Use();
                    break;
                }
            }
        }
コード例 #2
0
 protected virtual void DeselectAll(Flowchart flowchart)
 {
     Undo.RecordObject(flowchart, "Deselect");
     flowchart.ClearSelectedCommands();
     flowchart.ClearSelectedBlocks();
     Selection.activeGameObject = flowchart.gameObject;
 }