void OnGUI() { _scrollViewPosition = EditorGUILayout.BeginScrollView(_scrollViewPosition); { EditorLayout.DrawTexture(_headerTexture); var descriptionStyle = new GUIStyle(GUI.skin.label); descriptionStyle.wordWrap = true; for (int i = 0; i < _migrations.Length; i++) { var migration = _migrations[i]; _showMigration[i] = EditorLayout.DrawSectionHeaderToggle(migration.version, _showMigration[i]); if (_showMigration[i]) { EditorLayout.BeginSectionContent(); { EditorGUILayout.LabelField(migration.description, descriptionStyle); if (GUILayout.Button("Apply migration " + migration.version)) { migrate(migration, this); } } EditorLayout.EndSectionContent(); } } } EditorGUILayout.EndScrollView(); }
void drawHeader(Preferences preferences) { var rect = EditorLayout.DrawTexture(_headerTexture); // if (rect.Contains(Event.current.mousePosition) && Event.current.clickCount > 0) { // Application.OpenURL("https://github.com/sschmid/Entitas-CSharp/blob/develop/README.md"); // } var propertiesPath = Path.GetFileName(preferences.propertiesPath); var buttonWidth = 60 + propertiesPath.Length * 5; const int buttonHeight = 15; const int padding = 4; var buttonRect = new Rect( rect.width - buttonWidth - padding, rect.y + rect.height - buttonHeight - padding, buttonWidth, buttonHeight ); if (GUI.Button(buttonRect, "Edit " + propertiesPath, EditorStyles.miniButton)) { EditorWindow.focusedWindow.Close(); System.Diagnostics.Process.Start(preferences.propertiesPath); } }
void drawHeader(Preferences preferences) { var rect = EditorLayout.DrawTexture(_headerTexture); // if (rect.Contains(Event.current.mousePosition) && Event.current.clickCount > 0) { // Application.OpenURL("https://github.com/sschmid/Entitas-CSharp/blob/develop/README.md"); // } var propertiesPath = Path.GetFileName(preferences.propertiesPath); var buttonWidth = 60 + propertiesPath.Length * 5; const int buttonHeight = 15; const int padding = 4; var buttonRect = new Rect( rect.width - buttonWidth - padding, rect.y + rect.height - buttonHeight - padding, buttonWidth, buttonHeight ); var allPreferences = Preferences.FindAll("*.properties") .Select(Path.GetFileName) .ToArray(); if (allPreferences.Length > 1) { var r = new Rect( rect.width - 50 - padding, buttonRect.y, 50, buttonHeight ); if (GUI.Button(r, "Switch", EditorStyles.miniButton)) { var path = EditorPrefs.GetString(PreferencesWindow.PREFERENCES_KEY); var index = Array.IndexOf(allPreferences, path); if (index >= 0) { index += 1; if (index >= allPreferences.Length) { index = 0; } EditorPrefs.SetString(PreferencesWindow.PREFERENCES_KEY, allPreferences[index]); var window = EditorWindow.focusedWindow; window.Close(); EntitasPreferencesWindow.OpenPreferences(); } } buttonRect.x -= r.width + padding; } if (GUI.Button(buttonRect, "Edit " + propertiesPath, EditorStyles.miniButton)) { EditorWindow.focusedWindow.Close(); System.Diagnostics.Process.Start(preferences.propertiesPath); } }
void drawHeader(Preferences preferences) { EditorLayout.DrawTexture(_headerTexture); }