private void DisplaySettings(IEnumerable <SerializedSetting> settingsData)
        {
            var renderedSettings = new List <SerializedSetting>();

            foreach (var serializedSetting in settingsData)
            {
                if (!renderedSettings.Contains(serializedSetting))
                {
                    var domainPrefix = DomainBuilderHelper.GetDomainPrefix(serializedSetting.Name, serializedSetting.ShortName);
                    var domainTitle  = DomainBuilderHelper.GetDomainTitle(domainPrefix);

                    EditorGUILayout.Space();
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField(DomainBuilderHelper.ToTitleCase(domainTitle), EditorStyles.boldLabel);

                    var inDomainSettings = settingsData.Where(x =>
                    {
                        var inDomain  = DomainBuilderHelper.InDomain(rootDomain: domainPrefix, other: DomainBuilderHelper.GetDomainPrefix(x.Name, x.ShortName));
                        var displayed = renderedSettings.Contains(x);

                        return(inDomain && !displayed);
                    });

                    foreach (var inDomainSetting in inDomainSettings)
                    {
                        DisplaySetting(inDomainSetting);

                        renderedSettings.Add(inDomainSetting);
                    }
                }
            }
        }
Example #2
0
        private void DisplayStatusIndicators(List <SerializedStatusIndicator> serializedStatusIndicators)
        {
            var comparisonDelegate = new Comparison <SerializedStatusIndicator>((x, y) => x.Name.CompareTo(y.Name));

            serializedStatusIndicators.Sort(comparisonDelegate);

            m_searchText = EditorGUILayout.TextField(new GUIContent("Search bar: "), m_searchText);
            EditorGUILayout.Space();

            var indicatorsFiltered = FilterStatusIndicators(serializedStatusIndicators, m_searchText);
            var renderedIndicators = new List <SerializedStatusIndicator>();

            foreach (var serializedIndicators in indicatorsFiltered)
            {
                if (!renderedIndicators.Contains(serializedIndicators))
                {
                    var domainPrefix = DomainBuilderHelper.GetDomainPrefix(serializedIndicators.Name, serializedIndicators.ShortName);
                    var domainTitle  = DomainBuilderHelper.GetDomainTitle(domainPrefix);

                    EditorGUILayout.Space();
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField(DomainBuilderHelper.ToTitleCase(domainTitle), EditorStyles.boldLabel);

                    var inDomainIndicators = indicatorsFiltered.Where(x =>
                    {
                        var inDomain  = DomainBuilderHelper.InDomain(rootDomain: domainPrefix, other: DomainBuilderHelper.GetDomainPrefix(x.Name, x.ShortName));
                        var displayed = renderedIndicators.Contains(x);

                        return(inDomain && !displayed);
                    });

                    foreach (var inDomainIndicator in inDomainIndicators)
                    {
                        EditorGUILayout.LabelField(
                            inDomainIndicator.ShortName,
                            inDomainIndicator.Value,
                            EditorStyles.wordWrappedLabel);

                        renderedIndicators.Add(inDomainIndicator);
                    }
                }
            }

            EditorGUILayout.Space();
        }