Beispiel #1
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] objs)
        {
            var obj = objs.FirstOrDefault() as ChangeDatabaseCommand;

            if (obj != null)
            {
                var databaseService = InvertApplication.Container.Resolve <DatabaseService>();
                foreach (var item in databaseService.Configurations.Values)
                {
                    var item1 = item;
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = item.Title,
                        Group   = "Databases",
                        Checked = databaseService.CurrentConfiguration == item,
                        Command = new LambdaCommand("Change Database", () =>
                        {
                            Signal <IChangeDatabase>(cd => cd.ChangeDatabase(item1));
                        })
                    });
                }

                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Manage",
                    Group   = "Manage",
                    Command = new LambdaCommand("Manage Databases", () => EnableWizard = true),
                });
            }
        }
Beispiel #2
0
    public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
    {
        if (obj is CreateGraphMenuCommand)
        {
            var config = WorkspaceService.CurrentConfiguration;
            foreach (var item in config.GraphTypes)
            {
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = item.Title ?? item.GraphType.Name,
                    Command = new CreateGraphCommand()
                    {
                        GraphType = item.GraphType,
                        Name      = "New" + item.GraphType.Name
                    }
                });
            }
        }
        var diagram = obj.FirstOrDefault() as DiagramViewModel;

        if (diagram != null)
        {
            ui.AddCommand(new ContextMenuItem()
            {
                Title   = "Delete This Graph",
                Group   = "Z",
                Command = new LambdaFileSyncCommand("Delete Graph", () =>
                {
                    Container.Resolve <IRepository>().Remove(diagram.DataObject as IDataRecord);
                })
            });
        }
    }
Beispiel #3
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            var typedItem = obj.FirstOrDefault() as TypedItemViewModel;

            if (typedItem != null)
            {
                foreach (var item in TypesInfo)
                {
                    var item1 = item;
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = item1.Name,
                        Group   = item.Group,
                        Command = new LambdaCommand("Change Type", () =>
                        {
                            typedItem.RelatedType = item1.Name;
                        })
                    });
                }
            }
            var nodeItem = obj.FirstOrDefault() as ItemViewModel;

            if (nodeItem != null)
            {
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Delete",
                    Command = new DeleteCommand()
                    {
                        Title = "Delete Item",
                        Item  = new[] { nodeItem.DataObject as IDataRecord }
                    }
                });
            }
        }
Beispiel #4
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            var item = obj.OfType <GraphItemViewModel>().FirstOrDefault();

            if (item == null)
            {
                return;
            }

            foreach (var flag in FlagByName.Values)
            {
                var flag1 = flag;
                if (flag.For.GetType().IsAssignableFrom(item.DataObject.GetType()) || flag.For == item.DataObject.GetType())
                {
                    var value = flag.GetValue(item.DataObject as IDiagramNodeItem);
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = flag.FlagName,
                        Checked = value,
                        Group   = "Flags",
                        Command = new LambdaCommand("Set Flag", () =>
                        {
                            flag1.SetValue(item.DataObject as IDiagramNodeItem, !value);
                        })
                    });
                }
            }
        }
        private void DrawClone(Clone clone)
        {
            var actions = new List <ContextMenuItem>();

            if (clone.path != ProjectPath)
            {
                actions.Add(new ContextMenuItem("Open in Unity", () => OpenInUnity(clone)));
            }

            actions.Add(new ContextMenuItem("Build", () => Build(clone)));


            if (!clone.clonedProjectSettings)
            {
                actions.Add(new ContextMenuItem("-"));
                actions.Add(new ContextMenuItem("Synchronize Project Settings", () => SyncProjectSettings(clone)));
            }

            if (!clone.isMaster)
            {
                actions.Add(new ContextMenuItem("-"));
                if (File.Exists(clone.path))
                {
                    actions.Add(new ContextMenuItem("Delete Clone", () => Delete(clone)));
                }
                else
                {
                    actions.Add(new ContextMenuItem("Create Clone", () => GenerateClone(clone)));
                }
            }

            GUILayout.Label(new DirectoryInfo(clone.path).Name, EditorStyles.label);
            ContextMenuUI.DrawContextMenu(actions.ToArray(), () => OpenInUnity(clone));
        }
Beispiel #6
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            var exportUI = obj.OfType <ExportUICommand>().FirstOrDefault();

            if (exportUI != null)
            {
                var ws = InvertApplication.Container.Resolve <WorkspaceService>();
                if (ws != null && ws.CurrentWorkspace != null)
                {
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = "Export Database",
                        Group   = "Export",
                        Command = new ExportDatabaseCommand()
                        {
                            Database = Container.Resolve <DatabaseService>().CurrentConfiguration
                        },
                    });
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = "Export Workspace",
                        Group   = "Export",
                        Command = new ExportWorkspaceCommand()
                        {
                            Workspace = ws.CurrentWorkspace
                        },
                    });
                    // ui.AddSeparator();
                    if (ws.CurrentWorkspace.CurrentGraph != null)
                    {
                        ui.AddCommand(new ContextMenuItem()
                        {
                            Title   = "Export Current Graph",
                            Group   = "Export",
                            Command = new ExportGraphCommand()
                            {
                                Graph = ws.CurrentWorkspace.CurrentGraph
                            },
                        });
                    }
                }
            }

            var diagram = obj.OfType <DiagramViewModel>().FirstOrDefault();

            if (diagram == null)
            {
                return;
            }
            //var graph = diagram.GraphData;
            //ui.AddCommand(new ContextMenuItem()
            //{
            //    Title = "Export this graph",
            //    Command = new LambdaCommand("Export Graph", () =>
            //    {

            //    })
            //});
        }
Beispiel #7
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            var node = obj.FirstOrDefault() as DiagramNodeViewModel;

            if (node != null)
            {
                var config         = InvertGraphEditor.Container.Resolve <IGraphConfiguration>();
                var fileGenerators = InvertGraphEditor.GetAllFileGenerators(config, new[] { node.DataObject as IDataRecord }, true).ToArray();
                foreach (var file in fileGenerators)
                {
                    var file1 = file;
                    if (File.Exists(file1.SystemPath))
                    {
                        ui.AddCommand(new ContextMenuItem()
                        {
                            Title   = "Open " + (file.AssetPath.Replace("/", "\\")),
                            Group   = "Open",
                            Command = new LambdaCommand("Open File", () =>
                            {
                                InvertGraphEditor.Platform.OpenScriptFile(file1.AssetPath);
                            })
                        });
                    }
                }

                foreach (var file in fileGenerators)
                {
                    var file1     = file;
                    var outputGen = file1.Generators.FirstOrDefault();
                    if (outputGen == null)
                    {
                        continue;
                    }
                    var templateClassGen = outputGen as ITemplateClassGenerator;
                    if (templateClassGen != null && typeof(IOnDemandTemplate).IsAssignableFrom(templateClassGen.TemplateType))
                    {
                        ui.AddCommand(new ContextMenuItem()
                        {
                            Title   = "Create Editable " + Path.GetFileName(file.AssetPath),
                            Group   = "Open",
                            Command = new LambdaCommand("Create Editable File", () =>
                            {
                                GenerateFile(new FileInfo(file1.SystemPath), file1);
                                AssetDatabase.Refresh();
                                InvertGraphEditor.Platform.OpenScriptFile(file1.AssetPath);
                            })
                        });
                    }
                }
            }
        }
Beispiel #8
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            if (WorkspaceService.Workspaces.Count() >= 8)
            {
                var selectProject = obj.FirstOrDefault() as SelectWorkspaceCommand;
                if (selectProject != null)
                {
                    foreach (var item in WorkspaceService.Workspaces)
                    {
                        ui.AddCommand(new ContextMenuItem()
                        {
                            Title   = item.Name,
                            Group   = "Workspaces",
                            Checked = item == WorkspaceService.CurrentWorkspace,
                            Command = new OpenWorkspaceCommand()
                            {
                                Workspace = item
                            }
                        });
                    }
                    //if (WorkspaceService.Configurations != null)
                    //{
                    //    ui.AddSeparator();
                    //    foreach (var item in WorkspaceService.Configurations)
                    //    {
                    //        var title = item.Value.Title ?? item.Key.Name;
                    //        ui.AddCommand(new ContextMenuItem()
                    //        {
                    //            Title = string.Format("Create New {0} Workspace", title),
                    //            Command = new CreateWorkspaceCommand()
                    //            {
                    //                Name = string.Format("New {0} Workspace", title),
                    //                Title = string.Format("New {0} Workspace", title),
                    //                WorkspaceType = item.Key,
                    //            }
                    //        });
                    //    }
                    //}

                    ui.AddCommand(new ContextMenuItem()
                    {
                        Command = new LambdaCommand("Manage Workspaces", () => EnableWizard = true),
                        Group   = "Manage",
                        Title   = "Manage"
                    });
                }
            }
        }
Beispiel #9
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            if (obj.FirstOrDefault() is CreateGraphMenuCommand)
            {
                var config = WorkspaceService.CurrentConfiguration;
                foreach (var item in config.GraphTypes)
                {
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = item.Title ?? item.GraphType.Name,
                        Command = new CreateGraphCommand()
                        {
                            GraphType = item.GraphType,
                            Name      = "New" + item.GraphType.Name
                        }
                    });
                }
            }

            var diagram = obj.FirstOrDefault() as DiagramViewModel;

            if (diagram != null)
            {
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Delete This Graph",
                    Group   = "Z",
                    Command = new LambdaFileSyncCommand("Delete Graph", () =>
                    {
                        bool result =
                            InvertGraphEditor.Platform.MessageBox(
                                "Delete Graph",
                                "This will DELETE this graph and and all nodes within it. This can't be undo.",
                                "Delete",
                                "Cancel"
                                );
                        if (!result)
                        {
                            return;
                        }

                        Container.Resolve <IRepository>().Remove(diagram.DataObject as IDataRecord);
                    })
                });
            }
        }
Beispiel #10
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            var actionVM = obj.FirstOrDefault() as SequenceItemNodeViewModel;

            if (actionVM != null)
            {
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Breakpoint",
                    Group   = "Debug",
                    Checked = actionVM.SequenceNode.BreakPoint != null,
                    Command = new ToggleBreakpointCommand()
                    {
                        Action = actionVM.SequenceNode,
                    }
                });
            }
        }
Beispiel #11
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            var diagram = obj.FirstOrDefault() as DiagramViewModel;
            var node    = obj.FirstOrDefault() as DiagramNodeViewModel;

            if (node != null)
            {
                //ui.AddCommand(new ContextMenuItem()
                //{
                //    Title = "Pickup",
                //    Group="CopyPaste",
                //    Command = new PickupCommand(),

                //});
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Copy",
                    Group   = "CopyPaste",
                    Command = new PickupCommand(),
                });
            }
            if (diagram != null)
            {
                if (CopiedNodes.Count > 0)
                {
                    //ui.AddCommand(new ContextMenuItem()
                    //{
                    //    Title = "Drop",
                    //    Group = "CopyPaste",
                    //    Command = new DropCommand()
                    //});
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = "Paste",
                        Group   = "CopyPaste",
                        Command = new PasteCommand()
                        {
                            Position = evt.MouseDownPosition
                        }
                    });
                }
            }
        }
Beispiel #12
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            GraphItemViewModel switchableItemViewModel =
                obj
                .OfType <DiagramNodeViewModel>()
                .FirstOrDefault(commandVm => commandVm.GraphItemObject is ISwitchableClassOrStructNodeSystem);
            ISwitchableClassOrStructNodeSystem switchableItem = null;

            if (switchableItemViewModel != null)
            {
                switchableItem =
                    (ISwitchableClassOrStructNodeSystem)((DiagramNodeViewModel)switchableItemViewModel).GraphItemObject;
            }
            else
            {
                switchableItemViewModel =
                    obj
                    .OfType <TypedItemViewModel>()
                    .FirstOrDefault(commandVm => commandVm.MemberInfo is ISwitchableClassOrStructNodeSystem);
                if (switchableItemViewModel != null)
                {
                    switchableItem =
                        (ISwitchableClassOrStructNodeSystem)((TypedItemViewModel)switchableItemViewModel).MemberInfo;
                }
            }

            if (switchableItemViewModel != null && switchableItem != null)
            {
                ui.AddCommand(new ContextMenuItem
                {
                    Title   = "Is Struct",
                    Checked = switchableItem.IsStruct,
                    Command = new SetNodeIsStructCommand
                    {
                        Item          = switchableItem,
                        ItemViewModel = switchableItemViewModel,
                        IsStruct      = !switchableItem.IsStruct
                    }
                });
            }
        }
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            var connector = obj.FirstOrDefault() as ConnectorViewModel;

            if (connector != null)
            {
                var connections =
                    InvertGraphEditor.CurrentDiagramViewModel.GraphItems.OfType <ConnectionViewModel>()
                    .Where(p => p.ConnectorA == connector || p.ConnectorB == connector).ToArray();

                foreach (var connection in connections)
                {
                    ConnectionViewModel connection1 = connection;
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = string.Format("Remove {0}", connection1.Name),
                        Group   = "Remove",
                        Command = new LambdaCommand("Remove Connection", () => { connection1.Remove(connection1); })
                    });
                }
            }
        }
Beispiel #14
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            var handlerVM = obj.FirstOrDefault() as HandlerNodeViewModel;

            if (handlerVM != null)
            {
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Change Event",
                    Group   = "Events",
                    Command =
                        new ChangeHandlerEventCommand()
                    {
                        Node = handlerVM.HandlerNode
                    }
                });
            }
            var sequenceVM = obj.FirstOrDefault() as SequenceItemNodeViewModel;

            if (sequenceVM == null)
            {
                return;
            }
            var handlerNode = sequenceVM.SequenceNode.Graph.CurrentFilter as ISequenceNode;

            if (handlerNode != null)
            {
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Set As Start Action",
                    Group   = " Start",
                    Command = new LambdaCommand("Set Start", () =>
                    {
                        handlerNode.StartNode = sequenceVM.SequenceNode;
                    })
                });
            }
        }
Beispiel #15
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            var cVM = obj.FirstOrDefault() as ComponentNodeViewModel;

            if (cVM == null)
            {
                return;
            }

            var component = cVM.ComponentNode;

            if (Selection.gameObjects != null && Selection.gameObjects.Length > 0)
            {
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Add To Selection",
                    Command = new AddComponentToSelectionCommand()
                    {
                        ComponentName = component.Name,
                        ComponentType = InvertApplication.FindRuntimeType(component.FullName)
                    }
                });
            }
        }
Beispiel #16
0
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] objs)
        {
            var diagramNodeItem = objs.FirstOrDefault() as ItemViewModel;

            if (diagramNodeItem != null)
            {
                var item = diagramNodeItem.DataObject as IDiagramNodeItem;
                if (item != null)
                {
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = "Move Up",
                        Command = new MoveItemUpCommand()
                        {
                            Item = item
                        }
                    });
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = "Move Down",
                        Command = new MoveItemDownCommand()
                        {
                            Item = item
                        }
                    });
                }
            }
            var diagramNode = objs.FirstOrDefault() as DiagramNodeViewModel;

            if (diagramNode != null)
            {
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Rename",
                    Group   = "Node",
                    Command = new RenameCommand()
                    {
                        ViewModel = diagramNode
                    }
                });
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Hide",
                    Group   = "Node",
                    Command = new HideCommand()
                    {
                        Node   = objs.OfType <DiagramNodeViewModel>().Select(p => p.GraphItemObject).ToArray(),
                        Filter = diagramNode.DiagramViewModel.GraphData.CurrentFilter
                    }
                });
                ui.AddCommand(new ContextMenuItem()
                {
                    Title   = "Delete",
                    Group   = "Careful",
                    Command = new DeleteCommand()
                    {
                        Item = objs.OfType <DiagramNodeViewModel>().Select(p => p.GraphItemObject).ToArray()
                    }
                });
                if (diagramNode.IsExternal)
                {
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Title   = "Pull",
                        Group   = "Node",
                        Command = new PullNodeCommand()
                        {
                            Node = objs.OfType <DiagramNodeViewModel>().Select(p => p.GraphItemObject).ToArray(),
                        }
                    });
                }
            }

            var diagram = objs.FirstOrDefault() as DiagramViewModel;

            if (diagram != null)
            {
                var filter = diagram.GraphData.CurrentFilter;
                foreach (var nodeType in FilterExtensions.AllowedFilterNodes[filter.GetType()].OrderBy(p => p.FullName))
                {
                    if (nodeType.IsAbstract)
                    {
                        continue;
                    }
                    var config = Container.GetNodeConfig(nodeType);
                    if (config.AllowAddingInMenu)
                    {
                        ui.AddCommand(new ContextMenuItem()
                        {
                            Title   = "Create " + Container.GetNodeConfig(nodeType).Name,
                            Group   = "Create",
                            Command = new CreateNodeCommand()
                            {
                                NodeType  = nodeType,
                                GraphData = diagram.GraphData,
                                Position  = diagram.LastMouseEvent.MouseDownPosition
                            }
                        });
                    }
                }

                if (filter.AllowExternalNodes)
                {
                    foreach (var item in filter.GetAllowedDiagramItems().OfType <GenericNode>().OrderBy(p => p.Name))
                    {
                        ui.AddCommand(new ContextMenuItem()
                        {
                            Title   = "Show/" + item.Config.Name + "/" + item.Name,
                            Group   = "Show",
                            Command = new ShowCommand()
                            {
                                Node = item, Filter = filter, Position = evt.MousePosition
                            }
                        });
                    }
                }
            }
        }
        public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
        {
            if (WorkspaceService.Workspaces.Count() >= 8)
            {
                var selectProject = obj.FirstOrDefault() as SelectWorkspaceCommand;
                if (selectProject != null)
                {
                    foreach (var item in WorkspaceService.Workspaces)
                    {
                        ui.AddCommand(new ContextMenuItem()
                        {
                            Title = item.Name,
                            Group = "Workspaces",
                            Checked = item == WorkspaceService.CurrentWorkspace,
                            Command = new OpenWorkspaceCommand()
                            {
                                Workspace = item
                            }
                        });
                    }
                    //if (WorkspaceService.Configurations != null)
                    //{
                    //    ui.AddSeparator();
                    //    foreach (var item in WorkspaceService.Configurations)
                    //    {
                    //        var title = item.Value.Title ?? item.Key.Name;
                    //        ui.AddCommand(new ContextMenuItem()
                    //        {
                    //            Title = string.Format("Create New {0} Workspace", title),
                    //            Command = new CreateWorkspaceCommand()
                    //            {
                    //                Name = string.Format("New {0} Workspace", title),
                    //                Title = string.Format("New {0} Workspace", title),
                    //                WorkspaceType = item.Key,
                    //            }
                    //        });
                    //    }
                    //}
         
                    ui.AddCommand(new ContextMenuItem()
                    {
                        Command = new LambdaCommand("Manage Workspaces", () => EnableWizard = true),
                        Group = "Manage",
                        Title = "Manage"
                    });



                }
            }
           
        }
 public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] objs)
 {
     var obj = objs.FirstOrDefault() as ChangeDatabaseCommand;
     if (obj != null)
     {
         var databaseService = InvertApplication.Container.Resolve<DatabaseService>();
         foreach (var item in databaseService.Configurations.Values)
         {
             var item1 = item;
             ui.AddCommand(new ContextMenuItem()
             {
                 Title = item.Title,
                 Group = "Databases",
                 Checked = databaseService.CurrentConfiguration == item,
                 Command = new LambdaCommand("Change Database", () =>
                 {
                     Signal<IChangeDatabase>(cd => cd.ChangeDatabase(item1));
                 })
             });
         }
      
         ui.AddCommand(new ContextMenuItem()
         {
             Title = "Manage",
             Group="Manage",
             Command = new LambdaCommand("Manage Databases", () => EnableWizard = true),
             
         });
     }
 }
Beispiel #19
0
 public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
 {
 }
 public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
 {
     //  throw new NotImplementedException();
 }
 public void QueryContextMenu(ContextMenuUI ui, MouseEvent evt, params object[] obj)
 {
   //  throw new NotImplementedException();
 }