Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
                    });
                }
            });
        }
Ejemplo n.º 4
0
        /// <inheritdoc />
        protected override void DrawCustomInspector()
        {
            base.DrawCustomInspector();

            SOFlowEditorUtilities.DrawTertiaryLayer(() =>
            {
                if (SOFlowEditorUtilities.DrawColourButton("Capture Child Fadables",
                                                           SOFlowEditorSettings
                                                           .AcceptContextColour))
                {
                    _target.CaptureChildFadables();
                }
            });

            SOFlowEditorUtilities.DrawLayeredProperties(serializedObject);
        }
Ejemplo n.º 5
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");
                    });
                }
            });
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Draws the list items.
        /// </summary>
        private void DrawListItems()
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

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

            GUILayout.FlexibleSpace();

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

            for (int i = 0; i < _items.Count; i++)
            {
                SOFlowEditorUtilities.DrawTertiaryLayer(() =>
                {
                    SOFlowEditorUtilities.DrawItemField($"Entry {i + 1}", _items[i]);
                });
            }
        }
Ejemplo n.º 7
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);
                    });
                }
            });
        }