Ejemplo n.º 1
0
        int DrawRemoveEngineInfos(EngineInfo[] engines)
        {
            if (_sortingOption != SORTING_OPTIONS.NONE)
            {
                SortRemoveEngines(engines);
            }

            string title = avgTitle.FastConcat(minTitle).FastConcat(maxTitle);

            EditorGUILayout.LabelField("Engine Name", title, EditorStyles.boldLabel);

            int enginesDrawn = 0;

            for (int i = 0; i < engines.Length; i++)
            {
                EngineInfo engineInfo = engines[i];
                if (engineInfo.engineName.ToLower().Contains(_systemNameSearchTerm.ToLower()) &&
                    !engineInfo.minRemoveDuration.Equals(0) && !engineInfo.maxRemoveDuration.Equals(0))
                {
                    ProfilerEditorLayout.BeginHorizontal();
                    {
                        var avg = string.Format("{0:0.000}", engineInfo.averageRemoveDuration).PadRight(15);
                        var min = string.Format("{0:0.000}", engineInfo.minRemoveDuration).PadRight(15);
                        var max = string.Format("{0:0.000}", engineInfo.maxRemoveDuration);

                        string output = avg.FastConcat(min).FastConcat(max);

                        EditorGUILayout.LabelField(engineInfo.engineName, output, GetEngineStyle());
                    }
                    ProfilerEditorLayout.EndHorizontal();

                    enginesDrawn += 1;
                }
            }
            return(enginesDrawn);
        }
Ejemplo n.º 2
0
        void DrawEngineList(EngineProfilerBehaviour engineProfilerBehaviour, EngineInfo[] engines)
        {
            ProfilerEditorLayout.BeginVerticalBox();
            {
                ProfilerEditorLayout.BeginHorizontal();
                {
                    if (GUILayout.Button("Reset Durations", GUILayout.Width(120), GUILayout.Height(14)))
                    {
                        engineProfilerBehaviour.ResetDurations();
                    }
                }
                ProfilerEditorLayout.EndHorizontal();

                _sortingOption = (SORTING_OPTIONS)EditorGUILayout.EnumPopup("Sort By:", _sortingOption);

                _hideEmptyEngines = EditorGUILayout.Toggle("Hide empty systems", _hideEmptyEngines);
                EditorGUILayout.Space();

                ProfilerEditorLayout.BeginHorizontal();
                {
                    _systemNameSearchTerm = EditorGUILayout.TextField("Search", _systemNameSearchTerm);

                    const string clearButtonControlName = "Clear Button";
                    GUI.SetNextControlName(clearButtonControlName);
                    if (GUILayout.Button("x", GUILayout.Width(19), GUILayout.Height(14)))
                    {
                        _systemNameSearchTerm = string.Empty;
                        GUI.FocusControl(clearButtonControlName);
                    }
                }
                ProfilerEditorLayout.EndHorizontal();

                _showAddEngines = EditorGUILayout.Foldout(_showAddEngines, "Engines Add");
                if (_showAddEngines && ShouldShowSystems(engines))
                {
                    ProfilerEditorLayout.BeginVerticalBox();
                    {
                        var systemsDrawn = DrawAddEngineInfos(engines);
                        if (systemsDrawn == 0)
                        {
                            EditorGUILayout.LabelField(string.Empty);
                        }
                    }
                    ProfilerEditorLayout.EndVertical();
                }

                _showRemoveEngines = EditorGUILayout.Foldout(_showRemoveEngines, "Engines Remove");
                if (_showRemoveEngines && ShouldShowSystems(engines))
                {
                    ProfilerEditorLayout.BeginVerticalBox();
                    {
                        var systemsDrawn = DrawRemoveEngineInfos(engines);
                        if (systemsDrawn == 0)
                        {
                            EditorGUILayout.LabelField(string.Empty);
                        }
                    }
                    ProfilerEditorLayout.EndVertical();
                }
            }
            ProfilerEditorLayout.EndVertical();
        }