void OnGUI()
        {
            drawToolbar();
            _scrollViewPosition = EditorGUILayout.BeginScrollView(_scrollViewPosition);
            {
                drawHeader();
                drawPreferencesDrawers();
            }
            EditorGUILayout.EndScrollView();

            if (GUI.changed)
            {
                EntitasPreferences.SaveConfig(_config);
            }
        }
        void OnEnable()
        {
            _headerTexture      = EntitasEditorLayout.LoadTexture("l:EntitasHeader");
            _localVersion       = EntitasCheckForUpdates.GetLocalVersion();
            _config             = EntitasPreferences.LoadConfig();
            _preferencesDrawers = Assembly.GetAssembly(typeof(IEntitasPreferencesDrawer)).GetTypes()
                                  .Where(type => type.ImplementsInterface <IEntitasPreferencesDrawer>())
                                  .Select(type => (IEntitasPreferencesDrawer)Activator.CreateInstance(type))
                                  .OrderBy(drawer => drawer.priority)
                                  .ToArray();

            foreach (var drawer in _preferencesDrawers)
            {
                drawer.Initialize(_config);
            }
        }
        void OnGUI()
        {
            _scrollViewPosition = EditorGUILayout.BeginScrollView(_scrollViewPosition);
            {
                var offsetY = EntitasEditorLayout.DrawHeaderTexture(this, _headerTexture);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Version: " + _localVersion);
                GUILayout.Space(offsetY - 24);

                foreach (var drawer in _preferencesDrawers)
                {
                    drawer.Draw(_config);
                    EditorGUILayout.Space();
                }
            }
            EditorGUILayout.EndScrollView();

            if (GUI.changed)
            {
                EntitasPreferences.SaveConfig(_config);
            }
        }
        void OnGUI()
        {
            var config             = EntitasPreferences.LoadConfig();
            var types              = Assembly.GetAssembly(typeof(IEntitasPreferencesDrawer)).GetTypes();
            var preferencesDrawers = types
                                     .Where(type => type.GetInterfaces().Contains(typeof(IEntitasPreferencesDrawer)))
                                     .OrderBy(type => type.FullName)
                                     .Select(type => (IEntitasPreferencesDrawer)Activator.CreateInstance(type))
                                     .ToArray();

            _scrollViewPosition = EditorGUILayout.BeginScrollView(_scrollViewPosition);
            foreach (var drawer in preferencesDrawers)
            {
                drawer.Draw(config);
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndScrollView();

            if (GUI.changed)
            {
                EntitasPreferences.SaveConfig(config);
            }
        }
Ejemplo n.º 5
0
        void OnEnable()
        {
            var guid = AssetDatabase.FindAssets("l:Entitas-Header")[0];

            if (guid != null)
            {
                var path = AssetDatabase.GUIDToAssetPath(guid);
                _headerTexture = AssetDatabase.LoadAssetAtPath <Texture2D>(path);
            }

            _localVersion = EntitasCheckForUpdates.GetLocalVersion();

            _config             = EntitasPreferences.LoadConfig();
            _preferencesDrawers = Assembly.GetAssembly(typeof(IEntitasPreferencesDrawer)).GetTypes()
                                  .Where(type => type.GetInterfaces().Contains(typeof(IEntitasPreferencesDrawer)))
                                  .OrderBy(type => type.FullName)
                                  .Select(type => (IEntitasPreferencesDrawer)Activator.CreateInstance(type))
                                  .ToArray();

            foreach (var drawer in _preferencesDrawers)
            {
                drawer.Initialize(_config);
            }
        }