void Awake() { CodeBrowserWrapper codeBrowserWrapper = null; Util.FindIfNotSet(this, ref codeBrowserWrapper); Util.FindIfNotSet(this, ref voosEngine); Util.FindIfNotSet(this, ref cursorManager); Util.FindIfNotSet(this, ref behaviorSystem); browser = codeBrowserWrapper.GetCodeBrowser(); isEditorReady = false; InitializeJsEditor(); }
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); }