//Layout members private void OnGUI() { if (_settings == null) { if (GUILayout.Button("请创建配置文件")) { FileInfo fi = new FileInfo(_settingsAssetPath); if (!fi.Directory.Exists) { fi.Directory.Create(); } _settings = CreateInstance <ETProjectBrowserSettings>(); AssetDatabase.CreateAsset(_settings, _settingsAssetPath); } return; } if (string.IsNullOrEmpty(_settings.ListenFolderPath)) { GUILayout.BeginHorizontal(); GUILayout.Label("请至少指定一个ET Project目录"); GUILayout.EndHorizontal(); return; } else { GUILayout.BeginHorizontal(); _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos); int _ = 0; int min = Mathf.RoundToInt(_scrollPos.y / 20); int max = min + 20; DrawTreeNodes(_root, ref _, min, max); EditorGUILayout.EndScrollView(); GUILayout.EndHorizontal(); } }
private void OnEnable() { _settings = AssetDatabase.LoadAssetAtPath <ETProjectBrowserSettings>(_settingsAssetPath); _selectedPaths = new List <string>(10); StartListening(); _texture = Resources.Load <Texture2D>("background"); }