Esempio n. 1
0
        /// <summary>
        ///     Draws the currently viewed error message.
        /// </summary>
        private void DrawErrorMessage()
        {
            GUILayout.FlexibleSpace();
            EditorGUILayout.LabelField("Error Log", SOFlowStyles.CenterTextHelpBox);
            GUILayout.FlexibleSpace();

            SOFlowEditorUtilities.DrawScrollViewColourLayer(SOFlowEditorSettings.DeclineContextColour, ref _errorScrollPosition,
                                                            () =>
            {
                EditorGUILayout.TextArea(_currentErrorMessage,
                                         SOFlowStyles.Label);
            });

            GUILayout.FlexibleSpace();
            EditorGUILayout.LabelField("<<< Open Scripts In IDE >>>", SOFlowStyles.CenterTextHelpBox);
            GUILayout.FlexibleSpace();

            foreach (GameEventErrorData errorData in _currentErrorData)
            {
                if (SOFlowEditorUtilities.DrawColourButton($"{errorData.ErrorMethod} >> {errorData.ErrorLine}",
                                                           SOFlowEditorSettings.SecondaryLayerColour))
                {
                    InternalEditorUtility.OpenFileAtLineExternal(errorData.ErrorFile, errorData.ErrorLine);
                }
            }
        }
Esempio n. 2
0
        private void OnGUI()
        {
            SOFlowEditorUtilities.DrawPrimaryLayer(() =>
            {
                DrawHeaderTab();

                SOFlowEditorUtilities
                .DrawScrollViewColourLayer(SOFlowEditorSettings.PrimaryLayerColour,
                                           ref _eventListScrollPosition,
                                           DrawGameEventList);
            });
        }
Esempio n. 3
0
        /// <summary>
        ///     Draws the list of event listeners.
        /// </summary>
        private void DrawEventListeners()
        {
            EditorGUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();
            EditorGUILayout.LabelField("Listeners", SOFlowStyles.BoldCenterLabel);
            GUILayout.FlexibleSpace();

            EditorGUILayout.LabelField($"Size: {_target.Listeners.Count}", SOFlowStyles.WordWrappedMiniLabel);

            EditorGUILayout.EndHorizontal();

            SOFlowEditorUtilities.DrawScrollViewColourLayer(SOFlowEditorSettings.SecondaryLayerColour,
                                                            ref _listenersScrollPosition,
                                                            () =>
            {
                for (int index = 0; index < _target.Listeners.Count; index++)
                {
                    IEventListener listener = _target.Listeners[index];

                    SOFlowEditorUtilities
                    .DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour,
                                               () =>
                    {
                        EditorGUILayout
                        .LabelField($"{index} | {listener.GetObjectType().Name}");

                        EditorGUILayout
                        .ObjectField(listener.GetGameObject(),
                                     typeof
                                     (GameObject
                                     ),
                                     true);
                    });
                }
            }, GUILayout.MaxHeight(_scrollHeight));
        }
Esempio n. 4
0
        /// <summary>
        ///     Draws the event stack.
        /// </summary>
        private void DrawEventStack()
        {
            EditorGUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();
            EditorGUILayout.LabelField("Event Stack", SOFlowStyles.BoldCenterLabel);
            GUILayout.FlexibleSpace();

            EditorGUILayout.LabelField($"Size: {_target.EventStack.Count}", SOFlowStyles.WordWrappedMiniLabel);

            EditorGUILayout.EndHorizontal();

            SOFlowEditorUtilities.DrawScrollViewColourLayer(SOFlowEditorSettings.TertiaryLayerColour, ref _logScrollPosition,
                                                            () =>
            {
                foreach (GameEventLog log in _target.EventStack)
                {
                    SOFlowEditorUtilities.DrawSecondaryLayer(() =>
                    {
                        for (int i = 0,
                             errorIndex
                                 = 0,
                             condition
                                 = log
                                   .Listener
                                   .Count;
                             i <
                             condition;
                             i++)
                        {
                            SOFlowEditorUtilities
                            .DrawHorizontalColourLayer(log.IsError[i] ? SOFlowEditorSettings.DeclineContextColour : SOFlowEditorSettings.SecondaryLayerColour,
                                                       () =>
                            {
                                EditorGUILayout
                                .LabelField($"[{log.LogTime:T}] {log.Listener[i].GetObjectType().Name}");

                                EditorGUILayout
                                .ObjectField(log
                                             .Listener
                                             [i]
                                             .GetGameObject(),
                                             typeof
                                             (GameObject
                                             ),
                                             true);

                                if
                                (log
                                 .IsError
                                 [i]
                                )
                                {
                                    if
                                    (SOFlowEditorUtilities
                                     .DrawColourButton("Log",
                                                       SOFlowEditorSettings
                                                       .TertiaryLayerColour)
                                    )
                                    {
                                        _currentErrorMessage
                                            = $"{log.ErrorMessages[errorIndex]}\n\n{log.StackTraces[errorIndex]}";

                                        _currentErrorData
                                            = log
                                              .ErrorData
                                              [errorIndex];
                                    }
                                }
                            });

                            if (log
                                .IsError
                                [i]
                                )
                            {
                                errorIndex
                                ++;
                            }
                        }
                    });
                }
            }, GUILayout.MaxHeight(_scrollHeight));
        }