Пример #1
0
        private void DrawFooter()
        {
            footer.Draw(position, isDirty);

            if (PlayModeTestRunner.IsRunning)
            {
                float positionY = position.height - (PROGRESS_BAR_HEIGHT + EditorUIConstants.LAYOUT_PADDING);

                if (isDirty)
                {
                    positionY -= UITestToolWindowFooter.HEIGHT + EditorUIConstants.LAYOUT_PADDING;
                }

                Rect r = new Rect(
                    new Vector2(0, positionY),
                    new Vector2(position.width, PROGRESS_BAR_HEIGHT));

                int maxSteps = currentPlayingTest.Node.Step;

                var currentStep = TestStep.GetCurrentStep(maxSteps);
                if (!PlayModeTestRunner.IsRunning || currentStep == null)
                {
                    GUI.enabled = false;
                    EditorGUI.ProgressBar(r, 0, "");
                    GUI.enabled = true;
                }
                else
                {
                    EditorGUI.ProgressBar(r, currentStep.Progress, currentStep.ToString());
                }
            }
        }
Пример #2
0
        void OnGUI()
        {
            if (!switchedByHotKey &&
                controller.IsRecording &&
                Event.current != null &&
                Event.current.type == EventType.KeyDown &&
                Event.current.alt &&
                (Event.current.command || Event.current.command) &&
                Event.current.keyCode == KeyCode.C)
            {
                controller.ChagneAssertation();

                Repaint();
            }

            if (controller.IsAssertationMode)
            {
                GUI.backgroundColor = new Color(199f / 255, 255f / 255, 213f / 255);
            }

            DrawHeader();

            if (EditorApplication.isPaused && controller.IsRecording)
            {
                GUILayout.Space(5);

                string text = string.Join("\n", new string[]
                {
                    "Can't record when editor pause enabled!",
                    "Use 'Pause mode' button instead."
                });

                EditorGUILayout.HelpBox(text, MessageType.Warning);
            }

            if (twoSectionDrawer.Draw(
                    position,
                    GUILayoutUtility.GetLastRect().max.y,
                    UITestToolWindowFooter.HEIGHT,
                    GUIStyle.none,
                    DrawListOfUserAction,
                    GUIStyle.none,
                    DrawBottomPanel))
            {
                Repaint();
            }

            footer.Draw(position);
        }
        void OnGUI()
        {
            EditorGUILayout.Space();
            if (Selection.gameObjects.Length == 0)
            {
                EditorGUILayout.LabelField("No game objects selected", EditorStyles.boldLabel);
            }
            if (Selection.gameObjects.Length > 1)
            {
                EditorGUILayout.LabelField("Multiple game objects selection not supported.", EditorStyles.boldLabel);
            }
            GameObject go = Selection.gameObjects.Length == 1 ? Selection.gameObjects[0] : null;

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
            if (go)
            {
                EditorGUILayout.LabelField("Selected object: ", go.name, EditorStyles.boldLabel);
                EditorGUILayout.Space();

                if (go != selectedGameObject)
                {
                    var newAction = userFlowModel.HandleGameObject(go);
                    selectedGameObject = go;
                    GenerateText(newAction);
                }

                DrawUserClickInfo();
            }
            if (GUILayout.Button("Update Assertations", GUILayout.ExpandWidth(true)))
            {
                selectedGameObject = null;
            }
            DrawPlayingSounds();
            EditorGUILayout.EndScrollView();
            GUILayout.Space(UITestToolWindowFooter.HEIGHT + 5);
            footer.Draw(position);
        }