Beispiel #1
0
        public void OnGUI(SettingsScope scope, string query)
        {
            if (!PluginContainer.initialized)
            {
                return;
            }

            if (editor == null)
            {
                editor = accessor.CreateInitializedEditor();
            }

            LudiqGUI.BeginVertical(Styles.background);

            EditorGUI.BeginChangeCheck();

            using (Inspector.expandTooltip.Override(true))
            {
                foreach (var item in this[scope].Where(i => i.visible))
                {
                    EditorGUI.BeginChangeCheck();

                    LudiqGUI.Space(2);

                    if (!string.IsNullOrEmpty(query))
                    {
                        var haystack = Haystack(item);

                        var matchesSearch = SearchUtility.Matches(query, haystack);

                        using (LudiqGUI.color.Override(matchesSearch ? Color.white : Color.white.WithAlphaMultiplied(0.5f)))
                            using (LudiqGUIUtility.LabelHighlight(query))
                            {
                                editor.ChildInspector(item).DrawFieldLayout();
                            }
                    }
                    else
                    {
                        editor.ChildInspector(item).DrawFieldLayout();
                    }

                    LudiqGUI.Space(2);

                    if (EditorGUI.EndChangeCheck())
                    {
                        OnItemChange(item);
                    }
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                Save();
                InternalEditorUtility.RepaintAllViews();
            }

            LudiqGUI.EndVertical();
        }