private void OnEnable() { if (string.IsNullOrEmpty(RootPath)) { RootPath = AssetHelper.GetScriptPath(); } rootVisualElement.AddUxml(Uxml); rootVisualElement.AddStyleSheet(Stylesheet); _sampleList = rootVisualElement.Query <ListView>("sample-list"); _sampleList.makeItem = () => new Label(); _sampleList.bindItem = (element, index) => (element as Label).text = _items[index].Name; _sampleList.onSelectionChanged += SelectionChanged; _sampleList.itemsSource = _items; _sampleList.selectionType = SelectionType.Single; _codeView = rootVisualElement.Query("code-sample"); _codeText = rootVisualElement.Query <TextField>("code-text"); _codeText.isReadOnly = true; _uxmlView = rootVisualElement.Query("uxml-sample"); _uxmlText = rootVisualElement.Query <TextField>("uxml-text"); _uxmlText.isReadOnly = true; _uxmlCodeText = rootVisualElement.Query <TextField>("uxml-code-text"); _uxmlCodeText.isReadOnly = true; }
void OnEnable() { _applicationPath = Application.dataPath; _rootPath = new DirectoryInfo(_applicationPath).Parent.FullName; _state = GenerationState.Waiting; _templatesFolder = AssetHelper.GetScriptPath() + "/Templates"; LoadTemplates(); LoadGenerator(_settingsFilePreference.Value); }