private void GenerateBlackBoard() { var blackBoard = new Blackboard(_graphView); blackBoard.Add(new BlackboardSection { title = "Exposed Properties" }); blackBoard.addItemRequested = _blackBoard => { _graphView.AddPropertyToBlackBoard(new ExposedProperty()); }; blackBoard.editTextRequested = (blackBoard1, element, newValue) => { //Dialogue graph view Blackboard text property then cast var oldPropertyName = ((BlackboardField)element).text; if (_graphView.ExposedProperties.Any(x => x.PropertyName == newValue)) { EditorUtility.DisplayDialog("Error", "This property name already exits, Please chose another one!", "OK"); return; } var propertyIndex = _graphView.ExposedProperties.FindIndex(x => x.PropertyName == oldPropertyName); _graphView.ExposedProperties[propertyIndex].PropertyName = newValue; ((BlackboardField)element).text = newValue; }; blackBoard.SetPosition(new Rect(10, 30, 200, 300)); _graphView.Add(blackBoard); _graphView.Blackboard = blackBoard; }
private void GenerateMiniMap() { var miniMap = new MiniMap { anchored = true }; miniMap.SetPosition(new Rect(10, 30, 200, 140)); graphView.Add(miniMap); }
private void GenerateMiniMap() { var miniMap = new MiniMap { anchored = true }; var cords = _graphView.contentViewContainer.WorldToLocal(new Vector2(this.maxSize.x - 10, 30)); miniMap.SetPosition(new Rect(cords.x, cords.y, 200, 140)); _graphView.Add(miniMap); }
/// <summary> /// Generates Minimap /// </summary> private void GenerateMiniMap() { MiniMap minimap = new MiniMap { anchored = true }; //Set Minimap to Corner right with an offset of 10 px Vector2 coords = _graphView.contentViewContainer.WorldToLocal(new Vector2(maxSize.x - 10, 30)); minimap.SetPosition(new Rect(coords.x, coords.y, 200, 140)); _graphView.Add(minimap); }
private void LinkNodes(Port output, Port input) { var tempEdge = new Edge { output = output, input = input }; tempEdge.input.Connect(tempEdge); tempEdge.output.Connect(tempEdge); _targetGraphView.Add(tempEdge); }
private void LinkNodesTogether(Port output, Port input) { Edge tempEdge = new Edge { output = output, input = input, }; tempEdge.input.Connect(tempEdge); tempEdge.output.Connect(tempEdge); graphView.Add(tempEdge); }
private static void LinkNodes(DialogueGraphView graphView, Port output, Port input) { var tempEdge = new Edge { output = output, input = input }; tempEdge.input.Connect(tempEdge); tempEdge.output.Connect(tempEdge); graphView.Add(tempEdge); }
private void GenerateBlackBoard() { var blackboard = new Blackboard(graphView); blackboard.scrollable = true; blackboard.Add(graphView.typeEnum); blackboard.Add(new BlackboardSection { title = "Exposed properties" }); blackboard.addItemRequested = _blackboard => { graphView.AddPropertyToBlackboard(); }; blackboard.editTextRequested = (bb, element, newValue) => { var oldPropertyName = ((BlackboardField)element).text; if (newValue == null) { return; } graphView.CheckPropertyNameAvailability(ref newValue); var propertyIndex = graphView.exposedProperties.FindIndex(x => x.PropertyName == oldPropertyName); graphView.exposedProperties[propertyIndex].PropertyName = newValue; ((BlackboardField)element).text = newValue; }; blackboard.SetPosition(new Rect(10, 180, 240, 300)); graphView.Add(blackboard); graphView.blackboard = blackboard; graphView.AddPropertyToBlackboard(); }
// Connecting nodes together private void LinkNodesTogether(Port outputPort, Port inputPort) { // Creating new node edge Edge tempEdge = new Edge() { output = outputPort, input = inputPort }; // Connecting input/output edges tempEdge.input.Connect(tempEdge); tempEdge.output.Connect(tempEdge); graphView.Add(tempEdge); }
private static void ConnectDialogueNodes(DialogueGraphView graphView, GraphItem graphItem) { var nodes = graphView.nodes.ToList().Cast <BaseNode>(); foreach (var edge in graphItem.NodeLinks) { var baseNode = nodes.SingleOrDefault(x => x.nodeGuid == edge.baseNodeGuid); var targetNode = nodes.SingleOrDefault(x => x.nodeGuid == edge.targetNodeGuid); var baseNodePort = baseNode.GetOutputPort(edge.outputPortName); var targetNodePort = targetNode.GetInputPort(edge.inputPortName); var createdEdge = LinkNodesTogether(baseNodePort, targetNodePort); graphView.Add(createdEdge); } }