Пример #1
0
        public override void OnInspectorGUI()
        {
            var debugSystemsBehaviour = (DebugSystemsBehaviour)target;
            var systems = debugSystemsBehaviour.systems;
            if (_systemsMonitor == null) {
                _systemsMonitor = new SystemsMonitorEditor(SYSTEM_MONITOR_DATA_LENGTH);
                _systemMonitorData = new Queue<float>(new float[SYSTEM_MONITOR_DATA_LENGTH]);
                if (EditorApplication.update != Repaint) {
                    EditorApplication.update += Repaint;
                }
            }

            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.LabelField(systems.name, EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Initialize Systems", systems.initializeSystemsCount.ToString());
            EditorGUILayout.LabelField("Execute Systems", systems.executeSystemsCount.ToString());
            EditorGUILayout.LabelField("Total Systems", systems.totalSystemsCount.ToString());
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.BeginHorizontal();
            systems.paused = EditorGUILayout.Toggle("Step manually", systems.paused);
            EditorGUI.BeginDisabledGroup(!systems.paused);
            if (GUILayout.Button("Step", GUILayout.Width(100))) {
                systems.Step();
                addDuration((float)systems.totalDuration);
                _systemsMonitor.Draw(_systemMonitorData.ToArray(), 80f);
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField("Execution duration", EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Total", systems.totalDuration.ToString());
            EditorGUILayout.Space();

            if (!EditorApplication.isPaused && !systems.paused) {
                addDuration((float)systems.totalDuration);
            }
            _systemsMonitor.Draw(_systemMonitorData.ToArray(), 80f);

            EditorGUILayout.BeginHorizontal();
            systems.avgResetInterval = (AvgResetInterval)EditorGUILayout.EnumPopup("Reset Ø", systems.avgResetInterval);
            if (GUILayout.Button("Reset Ø now", GUILayout.Width(88), GUILayout.Height(14))) {
                systems.Reset();
            }
            EditorGUILayout.EndHorizontal();

            systems.threshold = EditorGUILayout.Slider("Threshold", systems.threshold, 0f, 100f);
            EditorGUILayout.Space();

            drawSystemInfos(systems.systemInfos, false);

            EditorGUILayout.EndVertical();

            EditorUtility.SetDirty(target);
        }
        public override void OnInspectorGUI()
        {
            var debugSystemsBehaviour = (DebugSystemsBehaviour)target;
            var systems = debugSystemsBehaviour.systems;

            if (_systemsMonitor == null)
            {
                _systemsMonitor    = new SystemsMonitorEditor(systemMonitorDataLength);
                _systemMonitorData = new Queue <float>(new float[systemMonitorDataLength]);
                if (EditorApplication.update != Repaint)
                {
                    EditorApplication.update += Repaint;
                }
            }

            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.LabelField(systems.name, EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Initialize Systems", systems.initializeSystemsCount.ToString());
            EditorGUILayout.LabelField("Execute Systems", systems.executeSystemsCount.ToString());
            EditorGUILayout.LabelField("Total Systems", systems.totalSystemsCount.ToString());
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.BeginHorizontal();
            systems.paused = EditorGUILayout.Toggle("Step manually", systems.paused);
            EditorGUI.BeginDisabledGroup(!systems.paused);
            if (GUILayout.Button("Step", GUILayout.Width(100)))
            {
                systems.Step();
                addDuration((float)systems.totalDuration);
                _systemsMonitor.Draw(_systemMonitorData.ToArray(), 80f);
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField("Execution duration", EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Total", systems.totalDuration.ToString());
            EditorGUILayout.Space();

            if (!EditorApplication.isPaused && !systems.paused)
            {
                addDuration((float)systems.totalDuration);
            }
            _systemsMonitor.Draw(_systemMonitorData.ToArray(), 80f);

            EditorGUILayout.BeginHorizontal();
            systems.avgResetInterval = (AvgResetInterval)EditorGUILayout.EnumPopup("Reset Ø", systems.avgResetInterval);
            if (GUILayout.Button("Reset Ø now", GUILayout.Width(88), GUILayout.Height(14)))
            {
                systems.Reset();
            }
            EditorGUILayout.EndHorizontal();

            systems.threshold = EditorGUILayout.Slider("Threshold", systems.threshold, 0f, 100f);
            EditorGUILayout.Space();

            drawSystemInfos(systems.systemInfos, false);

            EditorGUILayout.EndVertical();

            EditorUtility.SetDirty(target);
        }