private void GenerateToolbar() { var toolbar = new Toolbar(); var fileNameTextField = new TextField("File Name:"); fileNameTextField.SetValueWithoutNotify(_fileName); fileNameTextField.MarkDirtyRepaint(); fileNameTextField.RegisterValueChangedCallback(evt => _fileName = evt.newValue); toolbar.Add(fileNameTextField); toolbar.Add(new Button(() => RequestDataOperation(true)) { text = "Save Data" }); toolbar.Add(new Button(() => RequestDataOperation(false)) { text = "Load Data" }); toolbar.Add(new Button(() => _graphView.CreateNewDialogueNode("Dialogue Node")) { text = "New Node", }); rootVisualElement.Add(toolbar); }
public bool OnSelectEntry(SearchTreeEntry SearchTreeEntry, SearchWindowContext context) { //Editor window-based mouse position var mousePosition = _window.rootVisualElement.ChangeCoordinatesTo(_window.rootVisualElement.parent, context.screenMousePosition - _window.position.position); var graphMousePosition = _graphView.contentViewContainer.WorldToLocal(mousePosition); switch (SearchTreeEntry.userData) { case DialogueNode dialogueNode: _graphView.CreateNewDialogueNode("Dialogue Node", graphMousePosition, _CharacterSprite, "Character Name"); return(true); case Group group: var rect = new Rect(graphMousePosition, _graphView.DefaultCommentBlockSize); _graphView.CreateCommentBlock(rect); return(true); } return(false); }
private void GenerateToolbar() { var toolbar = new Toolbar(); UpdateTitle(); toolbar.Add(new Button(() => Save()) { text = "Save Data" }); toolbar.Add(new Button(() => CreateNew()) { text = "New narrative" }); toolbar.Add(new Button(() => _graphView.CreateNewDialogueNode("Dialogue Node")) { text = "New Node", }); rootVisualElement.Add(toolbar); }