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) } }); } }
private static Transform SyncKernel(MVVMNode node, GameObject uFrameMVVMKernel) { var servicesContainer = uFrameMVVMKernel.transform.FindChild("Services"); if (servicesContainer == null) { servicesContainer = new GameObject("Services").transform; servicesContainer.SetParent(uFrameMVVMKernel.transform); } var systemLoadersContainer = uFrameMVVMKernel.transform.FindChild("SystemLoaders"); if (systemLoadersContainer == null) { systemLoadersContainer = new GameObject("SystemLoaders").transform; systemLoadersContainer.SetParent(uFrameMVVMKernel.transform); } var sceneLoaderContainer = uFrameMVVMKernel.transform.FindChild("SceneLoaders"); if (sceneLoaderContainer == null) { sceneLoaderContainer = new GameObject("SceneLoaders").transform; sceneLoaderContainer.SetParent(uFrameMVVMKernel.transform); } //var servicesNodes = InvertApplication.Container.Resolve<WorkspaceService>().CurrentWorkspace.Graphs // .SelectMany(g => g.AllGraphItems.OfType<ServiceNode>()); var servicesNodes = InvertApplication.Container.Resolve <WorkspaceService>() .Workspaces.SelectMany(w => w.Graphs) .SelectMany(g => g.AllGraphItems.OfType <ServiceNode>()); foreach (var serviceNode in servicesNodes) { //var type = InvertApplication.FindType(serviceNode.FullName); var type = InvertApplication.FindRuntimeType(serviceNode.FullName); if (type != null && servicesContainer.GetComponent(type) == null) { servicesContainer.gameObject.AddComponent(type); } } //var systemNodes = InvertApplication.Container.Resolve<WorkspaceService>().CurrentWorkspace.Graphs // .SelectMany(g => g.AllGraphItems.OfType<SubSystemNode>()); var systemNodes = InvertApplication.Container.Resolve <WorkspaceService>() .Workspaces.SelectMany(w => w.Graphs) .SelectMany(g => g.AllGraphItems.OfType <SubSystemNode>()); foreach (var systemNode in systemNodes) { //var type = InvertApplication.FindType(string.Format("{0}Loader", systemNode.FullName)); var type = InvertApplication.FindRuntimeType(string.Format("{0}Loader", systemNode.FullName)); if (type != null && systemLoadersContainer.GetComponent(type) == null) { systemLoadersContainer.gameObject.AddComponent(type); } } //var sceneNodes = node.Graph.AllGraphItems.OfType<SceneTypeNode>(); var sceneNodes = InvertApplication.Container.Resolve <WorkspaceService>() .Workspaces.SelectMany(w => w.Graphs) .SelectMany(g => g.AllGraphItems.OfType <SceneTypeNode>()); foreach (var sceneNode in sceneNodes) { //var type = InvertApplication.FindType(string.Format("{0}Loader", sceneNode.FullName)); var type = InvertApplication.FindRuntimeType(string.Format("{0}Loader", sceneNode.FullName)); if (type != null && sceneLoaderContainer.GetComponent(type) == null) { sceneLoaderContainer.gameObject.AddComponent(type); } } EditorUtility.SetDirty(uFrameMVVMKernel); return(servicesContainer); }