private DragAndDropVisualMode HandleDragDropBetween(DragAndDropData data) { DragAndDropVisualMode visualMode = DragAndDropVisualMode.Move; var parent = (data.args.parentItem as GraphCollectionTreeItem); if (parent != null) { if (data.args.performDrop) { var collection = BatchBuildConfig.GetConfig().GraphCollections; collection.Remove(data.draggedNode.Collection); if (data.args.insertAtIndex < collection.Count) { collection.Insert(data.args.insertAtIndex, data.draggedNode.Collection); } else { collection.Add(data.draggedNode.Collection); } BatchBuildConfig.SetConfigDirty(); ReloadAndSelect(); } } return(visualMode); }
private DragAndDropVisualMode HandleDragDropUpon(DragAndDropData data) { DragAndDropVisualMode visualMode = DragAndDropVisualMode.Copy; var parent = (data.args.parentItem as GraphCollectionTreeItem); if (parent != null) { if (data.args.performDrop) { if (data.FromDetailTree) { var guids = data.detailDraggedNodes.Select(n => n.GraphGuid).ToList(); parent.Collection.AddGraphRange(guids); } else { parent.Collection.AddGraphRange(data.graphGuids); } m_controller.UpdateSelectedGraphCollection(parent.Collection); SetSelection(new int[] { parent.id }); BatchBuildConfig.SetConfigDirty(); } } return(visualMode); }
private void MenuAction_RemoveCollection(object context) { var item = context as BuildTargetTreeItem; BatchBuildConfig.GetConfig().BuildTargets.Remove(item.Target); BatchBuildConfig.SetConfigDirty(); Reload(); }
private void MenuAction_RemoveCollection(object context) { var item = context as GraphCollectionDetailTreeItem; m_controller.CurrentCollection.RemoveGraph(item.GraphGuid); BatchBuildConfig.SetConfigDirty(); Reload(); }
private void MenuAction_RemoveCollection(object context) { var item = context as GraphCollectionTreeItem; BatchBuildConfig.GetConfig().GraphCollections.Remove(item.Collection); m_controller.UpdateSelectedGraphCollection(null); BatchBuildConfig.SetConfigDirty(); ReloadAndSelect(); }
private void MenuAction_AddTarget(BuildTarget t) { var targets = BatchBuildConfig.GetConfig().BuildTargets; if (!targets.Contains(t)) { targets.Add(t); } BatchBuildConfig.SetConfigDirty(); Reload(); }
private DragAndDropVisualMode HandleDragDropBetween(DragAndDropData data) { DragAndDropVisualMode visualMode = DragAndDropVisualMode.Rejected; var parent = (data.args.parentItem as GraphCollectionDetailTreeItem); if (parent != null && (data.DraggedNode || data.DraggedGraphs)) { visualMode = DragAndDropVisualMode.Move; if (data.args.performDrop) { var collection = m_controller.CurrentCollection; List <string> guids = null; if (data.DraggedNode) { guids = data.draggedNodes.Select(n => n.GraphGuid).ToList(); } else { guids = data.graphGuids; } collection.RemoveGraphRange(guids); if (data.args.insertAtIndex < collection.GraphGUIDs.Count) { collection.InsertGraphRange(data.args.insertAtIndex, guids); } else { collection.AddGraphRange(guids); } BatchBuildConfig.SetConfigDirty(); Reload(); } } return(visualMode); }
static public GraphCollection CreateNewGraphCollection(string suggestedName) { string nameCandidate = suggestedName; var collection = BatchBuildConfig.GetConfig().GraphCollections; int i = 0; while (true) { if (collection.Find(c => c.Name.ToLower() == nameCandidate.ToLower()) == null) { var newCollection = new GraphCollection(nameCandidate); collection.Add(newCollection); BatchBuildConfig.SetConfigDirty(); return(newCollection); } nameCandidate = string.Format("{0} {1}", suggestedName, ++i); } }
private DragAndDropVisualMode HandleDragDropOutsideItems(DragAndDropData data) { DragAndDropVisualMode visualMode = DragAndDropVisualMode.Copy; if (data.args.performDrop) { var guid = data.graphGuids [0]; var graphName = Path.GetFileNameWithoutExtension(AssetDatabase.GUIDToAssetPath(guid)); var c = BatchBuildConfig.CreateNewGraphCollection(graphName); c.AddGraphRange(data.graphGuids); m_controller.UpdateSelectedGraphCollection(c); m_controller.Refresh(); BatchBuildConfig.SetConfigDirty(); } return(visualMode); }
private DragAndDropVisualMode HandleDragDropOutsideItems(DragAndDropData data) { DragAndDropVisualMode visualMode = DragAndDropVisualMode.Rejected; if (data.DraggedGraphs && m_controller.CurrentCollection != null) { visualMode = DragAndDropVisualMode.Copy; if (data.args.performDrop) { var collection = m_controller.CurrentCollection; collection.AddGraphRange(data.graphGuids); BatchBuildConfig.SetConfigDirty(); Reload(); } } return(visualMode); }
private DragAndDropVisualMode HandleDragDropBetween(DragAndDropData data) { DragAndDropVisualMode visualMode = DragAndDropVisualMode.Rejected; var parent = (data.args.parentItem as BuildTargetTreeItem); if (parent != null && data.DraggedNode) { visualMode = DragAndDropVisualMode.Move; if (data.args.performDrop) { var targets = BatchBuildConfig.GetConfig().BuildTargets; var movingTargets = data.draggedNodes.Select(n => n.Target).ToList(); foreach (var t in movingTargets) { targets.Remove(t); } if (data.args.insertAtIndex < targets.Count) { targets.InsertRange(data.args.insertAtIndex, movingTargets); } else { targets.AddRange(movingTargets); } BatchBuildConfig.SetConfigDirty(); Reload(); } } return(visualMode); }