コード例 #1
0
        /// <summary>
        ///     Draws the given game event entry.
        /// </summary>
        /// <param name="gameEvent"></param>
        /// <param name="instanceID"></param>
        private void DrawGameEventEntry(GameEvent gameEvent, int instanceID)
        {
            SOFlowEditorUtilities.DrawSecondaryLayer(() =>
            {
                EditorGUILayout.ObjectField(gameEvent, typeof(GameEvent), true,
                                            GUILayout.Width(_entryWidth));

                if (SOFlowEditorUtilities.DrawColourButton("Raise",
                                                           SOFlowEditorSettings
                                                           .AcceptContextColour))
                {
                    gameEvent.Raise();
                }

                if (SOFlowEditorUtilities.DrawColourButton("Clear Log",
                                                           SOFlowEditorSettings
                                                           .DeclineContextColour))
                {
                    gameEvent.EventStack.Clear();
                }

                SOFlowEditorUtilities.DrawTertiaryLayer(() =>
                {
                    DrawGameEventEntrySearchBar(instanceID);
                });
            }, GUILayout.MaxWidth(_entryWidth));

            DrawLogEntry(gameEvent, instanceID);
        }
コード例 #2
0
        /// <inheritdoc />
        protected override void DrawCustomInspector()
        {
            base.DrawCustomInspector();

            SOFlowEditorUtilities.DrawPrimaryLayer(() =>
            {
                if (SOFlowEditorUtilities.DrawColourButton("Raise",
                                                           SOFlowEditorSettings
                                                           .AcceptContextColour))
                {
                    _target.Raise();
                }

                if (SOFlowEditorUtilities.DrawColourButton("Search In Scene",
                                                           SOFlowEditorSettings
                                                           .TertiaryLayerColour))
                {
                    SearchEventInScene();
                }

                if (SOFlowEditorUtilities.DrawColourButton("Add To Scene",
                                                           SOFlowEditorSettings
                                                           .TertiaryLayerColour))
                {
                    GameEvent.AddGameEventToScene(_target);
                }
            });

            SOFlowEditorUtilities.DrawSecondaryLayer(DrawEventListeners);
            SOFlowEditorUtilities.DrawTertiaryLayer(DrawEventStack);
            SOFlowEditorUtilities.DrawTertiaryLayer(DrawErrorMessage);
        }
コード例 #3
0
 /// <summary>
 ///     Draws the event data.
 /// </summary>
 private void DrawEventData()
 {
     SOFlowEditorUtilities.DrawSecondaryLayer(() =>
     {
         serializedObject.DrawProperty(nameof(_target.RespondInEditor));
         serializedObject.DrawProperty(nameof(_target.OnComparisonSuccess));
         serializedObject.DrawProperty(nameof(_target.OnComparisonFail));
     });
 }
コード例 #4
0
        /// <inheritdoc />
        protected override void DrawCustomInspector()
        {
            base.DrawCustomInspector();

            SOFlowEditorUtilities.DrawPrimaryLayer(() =>
            {
                DrawDefaultInspector();
                SOFlowEditorUtilities.DrawSecondaryLayer(DrawListItems);
            });
        }
コード例 #5
0
        protected override void DrawCustomInspector()
        {
            base.DrawCustomInspector();

            SOFlowEditorUtilities.DrawLayeredProperties(serializedObject);

            SOFlowEditorUtilities.DrawTertiaryLayer(() =>
            {
                SOFlowEditorUtilities.DrawNonSerializableFields(target);
            });

            SOFlowEditorUtilities.DrawSecondaryLayer(() =>
            {
                IEnumerable pool = _target.GetPool();

                foreach (object objectSet in pool)
                {
                    EditorGUILayout.BeginHorizontal();

                    EditorGUILayout.LabelField("ID", SOFlowStyles.BoldCenterLabel);

                    EditorGUILayout.LabelField($"Pool Count - {_target.CurrentPoolSize}",
                                               SOFlowStyles.BoldCenterLabel);

                    EditorGUILayout.EndHorizontal();

                    PropertyInfo key   = objectSet.GetType().GetProperty("Key");
                    PropertyInfo value = objectSet.GetType().GetProperty("Value");

                    PropertyInfo valueCount = value
                                              .GetValue(objectSet).GetType()
                                              .GetProperty("Count");

                    SOFlowEditorUtilities
                    .DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour,
                                               () =>
                    {
                        EditorGUILayout
                        .LabelField(key.GetValue(objectSet).ToString(),
                                    SOFlowStyles
                                    .CenteredLabel);

                        EditorGUILayout
                        .LabelField(valueCount.GetValue(value.GetValue(objectSet)).ToString(),
                                    SOFlowStyles
                                    .CenteredLabel);
                    });
                }
            });
        }
コード例 #6
0
        /// <summary>
        ///     Draws the provided velocity fields.
        /// </summary>
        /// <param name="axis"></param>
        private void DrawVelocityFields(string axis)
        {
            SOFlowEditorUtilities.DrawSecondaryLayer(() =>
            {
                serializedObject.DrawProperty($"Use{axis}Velocity");

                BoolField axisField;

                switch (axis)
                {
                case "Forward":
                    axisField = _target.UseForwardVelocity;

                    break;

                case "Horizontal":
                    axisField = _target.UseHorizontalVelocity;

                    break;

                case "Vertical":
                    axisField = _target.UseVerticalVelocity;

                    break;

                default:
                    axisField = _target.UseForwardVelocity;

                    break;
                }

                if (axisField)
                {
                    SOFlowEditorUtilities.DrawTertiaryLayer(() =>
                    {
                        serializedObject
                        .DrawProperty($"{axis}Velocity");

                        serializedObject
                        .DrawProperty($"Invert{axis}Velocity");
                    });
                }
            });
        }
コード例 #7
0
        /// <summary>
        ///     Draws the fader inspector.
        /// </summary>
        private void DrawFaderInspector()
        {
            SOFlowEditorUtilities.DrawSecondaryLayer(() =>
            {
                SOFlowEditorUtilities
                .DrawListComponentProperty(serializedObject,
                                           serializedObject
                                           .FindProperty("FadeTargets"),
                                           SOFlowEditorSettings
                                           .TertiaryLayerColour);
            });

            serializedObject.DrawProperty("UnfadedColour");
            serializedObject.DrawProperty("FadedColour");
            serializedObject.DrawProperty("FadeCurve");

            if (!_target.OnlyFade)
            {
                serializedObject.DrawProperty("UnfadeCurve");
            }

            serializedObject.DrawProperty("OnlyFade");
            serializedObject.DrawProperty("FadeTime");

            if (!_target.OnlyFade)
            {
                serializedObject.DrawProperty("UnfadeTime");
                serializedObject.DrawProperty("WaitBetweenFades");
            }

            serializedObject.DrawProperty("OnFadeStart");

            if (!_target.OnlyFade)
            {
                serializedObject.DrawProperty("OnFadeWait");
            }

            serializedObject.DrawProperty("OnFadeComplete");
        }
コード例 #8
0
        /// <inheritdoc />
        protected override void DrawCustomInspector()
        {
            base.DrawCustomInspector();

            SOFlowEditorUtilities.DrawPrimaryLayer(() =>
            {
                SOFlowEditorUtilities
                .DrawHorizontalColourLayer(SOFlowEditorSettings.SecondaryLayerColour,
                                           () =>
                {
                    EditorGUILayout
                    .LabelField("Total Pool Objects",
                                SOFlowStyles
                                .Label);

                    EditorGUILayout
                    .LabelField(_target.PoolObjectCount.ToString(),
                                SOFlowStyles
                                .BoldLeftLabel);
                });

                SOFlowEditorUtilities.DrawSecondaryLayer(() =>
                {
                    foreach (
                        IPoolObjectRoot
                        poolObject
                        in _target
                        .PoolObjects)
                    {
                        EditorGUILayout
                        .ObjectField(poolObject.GetObjectInstance(),
                                     typeof
                                     (Object
                                     ),
                                     false);
                    }
                });
            });
        }
コード例 #9
0
        /// <summary>
        ///     Draws the test evaluation results.
        /// </summary>
        private void DrawEvaluationArea()
        {
            SOFlowEditorUtilities.DrawSecondaryLayer(() =>
            {
                _target.LiveEvaluation =
                    EditorGUILayout.Toggle("Live Evaluation",
                                           _target.LiveEvaluation);

                if (_target.LiveEvaluation)
                {
                    EditorGUILayout.BeginVertical(SOFlowStyles.HelpBox);

                    EditorGUILayout
                    .LabelField(_target.Evaluate().ToString(CultureInfo.InvariantCulture),
                                EditorStyles.toolbarButton);

                    EditorGUILayout.EndVertical();
                }
                else
                {
                    SOFlowEditorUtilities.DrawTertiaryLayer(() =>
                    {
                        if (GUILayout
                            .Button("Evaluate"))
                        {
                            _target.Evaluate();
                        }

                        EditorGUILayout
                        .LabelField(_target.EvaluatedValue.Value.ToString(CultureInfo.InvariantCulture),
                                    EditorStyles
                                    .toolbarButton);
                    });
                }
            });
        }
コード例 #10
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));
        }
コード例 #11
0
        /// <summary>
        ///     Draws the log entry for the given game event.
        /// </summary>
        /// <param name="gameEvent"></param>
        /// <param name="instanceID"></param>
        private void DrawLogEntry(GameEvent gameEvent, int instanceID)
        {
            Vector2 scrollPosition;

            if (!_eventEntriesScrollPosition.TryGetValue(instanceID, out scrollPosition))
            {
                scrollPosition = Vector2.zero;
                _eventEntriesScrollPosition.Add(instanceID, scrollPosition);
            }

            Color originalGUIColor = GUI.backgroundColor;

            GUI.backgroundColor = SOFlowEditorSettings.TertiaryLayerColour;

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, true, false, GUI.skin.horizontalScrollbar,
                                                             GUIStyle.none, SOFlowStyles.HelpBox,
                                                             GUILayout.Height(EditorGUIUtility.singleLineHeight * 7f),
                                                             GUILayout.Width(position.width - _entryWidth - 40f));

            GUI.backgroundColor = originalGUIColor;

            EditorGUILayout.BeginHorizontal();

            for (int i = gameEvent.EventStack.Count - 1; i >= 0; i--)
            {
                int skippedEntries = 0;

                SOFlowEditorUtilities.DrawSecondaryLayer(() =>
                {
                    EditorGUILayout.LabelField($"Log Entry {i + 1}",
                                               SOFlowStyles.CenterTextHelpBox);

                    EditorGUILayout.BeginHorizontal();

                    for (int j = 0,
                         condition = gameEvent.EventStack[i].Listener.Count;
                         j < condition;
                         j++)
                    {
                        string searchQuery;

                        _eventEntrySearchQuery.TryGetValue(instanceID,
                                                           out searchQuery);

                        GameEventLog log      = gameEvent.EventStack[i];
                        GameObject gameObject = log.Listener[j].GetGameObject();

                        if (string.IsNullOrEmpty(searchQuery) ||
                            gameObject == null ||
                            gameObject.name.ToLower()
                            .Contains(searchQuery.ToLower()))
                        {
                            SOFlowEditorUtilities
                            .DrawColourLayer(log.IsError[j] ? SOFlowEditorSettings.DeclineContextColour : SOFlowEditorSettings.AcceptContextColour,
                                             () =>
                                             DrawEventLog(log, j));
                        }
                        else
                        {
                            skippedEntries++;
                        }
                    }

                    EditorGUILayout.EndHorizontal();
                },
                                                         GUILayout.MaxWidth(_entryWidth *
                                                                            (gameEvent.EventStack[i].Listener.Count -
                                                                             skippedEntries)));
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndScrollView();

            _eventEntriesScrollPosition[instanceID] = scrollPosition;
        }
コード例 #12
0
 /// <summary>
 ///     Draws the comparison fields.
 /// </summary>
 private void DrawComparisonFields()
 {
     SOFlowEditorUtilities.DrawSecondaryLayer(DrawTypes);
 }