private void CloseCodeEditor() { YamlEditorController.SetEnabled("YAML Editor is open", true); YamlEditorHeight = new GridLength(100, GridUnitType.Star); CodeEditorController.SetEnabled("Code Editor is open", false); CodeEditorHeight = new GridLength(0, GridUnitType.Star); }
private void DoEditScript() { YamlEditorController.ExpandCodeBlock(); _selectedBlock = YamlHelper.ExtractBlock(YamlEditorController.SelectedText); if (_selectedBlock == null) { return; } BlockFormat = "(unchanged)"; YamlEditorController.SetEnabled("YAML Editor is open", false); YamlEditorHeight = new GridLength(50); CodeEditorHeight = new GridLength(100, GridUnitType.Star); CodeEditorController.Text = _selectedBlock.Content; CodeEditorController.SetEnabled("Code Editor is open", true); Dispatcher.BeginInvoke(DispatcherPriority.Background, () => YamlEditorController.Data.ScrollToLine(YamlEditorController.Data.TextArea.Caret.Line)); }
public void Setup() { Util.FindIfNotSet(this, ref inputControl); Util.FindIfNotSet(this, ref behaviorSystem); // This has a canvas on it, which is why it's not just a nested prefab. browserInstance = Instantiate(browserPrefab); codeBrowser = browserInstance.GetComponentInChildren <CodeBrowserWrapper>(); Debug.Assert(codeBrowser != null, "CodeBrowser component not found in browser prefab"); codeEditor = browserInstance.GetComponentInChildren <CodeEditorController>(); codeEditor.onRecompiled += () => { editableCardUi?.OnCardCodeChanged(); }; // Turn the browser off after it has had 5 seconds to "warm up" Invoke("DelayedCloseBrowser", 5f); saveButton.onClick.AddListener(SaveOrRun); zoomInButton.onClick.AddListener(codeEditor.ZoomIn); zoomOutButton.onClick.AddListener(codeEditor.ZoomOut); gameObject.SetActive(false); }