Esempio n. 1
0
        /// <inheritdoc />
        public override void OnBodyGUI()
        {
            SOFlowEditorUtilities.AdjustTextContrast(GetTint());

            serializedObject.Update();

            BranchNode branch = (BranchNode)target;

            NodePort entryPort   = GetDynamicPort("Entry", true, Node.ConnectionType.Multiple);
            NodePort defaultPort = GetDynamicPort("Default", false);

            SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour,
                                                            () =>
            {
                NodeEditorGUILayout.PortField(entryPort);
            });

            SOFlowEditorUtilities.RestoreTextContrast();

            NodeEditorGUILayout.DynamicPortList(nameof(branch.Conditions), typeof(Node), serializedObject,
                                                NodePort.IO.Output, Node.ConnectionType.Override);

            SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour,
                                                            () =>
            {
                NodeEditorGUILayout.PortField(defaultPort);
            });

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 2
0
        /// <summary>
        ///     Draws the header tab.
        /// </summary>
        private void DrawHeaderTab()
        {
            SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.PrimaryLayerColour,
                                                            () =>
            {
                if (SOFlowEditorUtilities.DrawColourButton("Clear All Logs",
                                                           SOFlowEditorSettings
                                                           .DeclineContextColour)
                    )
                {
                    foreach (KeyValuePair <int, GameEvent> gameEvent in Events
                             )
                    {
                        gameEvent.Value.EventStack.Clear();
                    }
                }

                GUILayout.FlexibleSpace();

                EditorGUILayout.LabelField("Search:",
                                           SOFlowStyles.WordWrappedMiniLabel);

                _searchQuery = EditorGUILayout.TextField(_searchQuery);
            });
        }
Esempio n. 3
0
        /// <inheritdoc />
        public override void OnBodyGUI()
        {
            SOFlowEditorUtilities.AdjustTextContrast(GetTint());

            serializedObject.Update();

            EventNode eventNode = (EventNode)target;

            NodePort entryPort = GetDynamicPort("Entry", true, Node.ConnectionType.Multiple);
            NodePort exitPort  = GetDynamicPort("Exit", false);

            SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour,
                                                            () =>
            {
                NodeEditorGUILayout.PortField(entryPort,
                                              GUILayout.MinWidth(0f));

                NodeEditorGUILayout.PortField(exitPort,
                                              GUILayout.MinWidth(0f));
            });

            SOFlowEditorUtilities.RestoreTextContrast();

            NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(eventNode.Event)));

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 4
0
 /// <summary>
 ///     Draws the game event list.
 /// </summary>
 private void DrawGameEventList()
 {
     foreach (KeyValuePair <int, GameEvent> gameEvent in Events)
     {
         if (string.IsNullOrEmpty(_searchQuery) ||
             gameEvent.Value.name.ToLower().Contains(_searchQuery.ToLower()))
         {
             SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.SecondaryLayerColour,
                                                             () => DrawGameEventEntry(gameEvent.Value,
                                                                                      gameEvent.Key));
         }
     }
 }
Esempio n. 5
0
        /// <inheritdoc />
        public override void OnBodyGUI()
        {
            SOFlowEditorUtilities.AdjustTextContrast(GetTint());

            serializedObject.Update();

            DialogNode dialog = (DialogNode)target;

            NodePort entryPort = GetDynamicPort("Entry", true, Node.ConnectionType.Multiple);
            NodePort exitPort  = GetDynamicPort("Exit", false);

            if (dialog.Choices.Count == 0)
            {
                SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.SecondaryLayerColour,
                                                                () =>
                {
                    NodeEditorGUILayout.PortField(entryPort,
                                                  GUILayout.MinWidth(0f));

                    NodeEditorGUILayout.PortField(exitPort,
                                                  GUILayout.MinWidth(0f));
                });
            }
            else
            {
                SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.SecondaryLayerColour,
                                                                () =>
                {
                    NodeEditorGUILayout.PortField(entryPort);
                });
            }

            string value = dialog.Dialog.Value;

            if (value == null)
            {
                EditorGUILayout.LabelField("Data unassigned.");
            }
            else
            {
                dialog.Dialog.Value =
                    EditorGUILayout.TextArea(value, GUILayout.MinHeight(EditorGUIUtility.singleLineHeight * 3f));
            }

            SOFlowEditorUtilities.RestoreTextContrast();

            NodeEditorGUILayout.DynamicPortList(nameof(dialog.Choices), typeof(Node), serializedObject,
                                                NodePort.IO.Output, Node.ConnectionType.Override);

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 6
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);
                    });
                }
            });
        }
Esempio n. 7
0
        private void OnGUI()
        {
            SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.PrimaryLayerColour, DrawSearchBar);

            if (_layerSearchResults.Count > 0)
            {
                _searchResultsScrollValue = EditorGUILayout.BeginScrollView(_searchResultsScrollValue);

                foreach (GameObject result in _layerSearchResults)
                {
                    EditorGUILayout.ObjectField(result, typeof(GameObject), true);
                }

                EditorGUILayout.EndScrollView();
            }
        }
Esempio n. 8
0
        private void OnGUI()
        {
            SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.PrimaryLayerColour, DrawHeaderPanel);

            if (_selectedSceneSet > 0)
            {
                _sceneListScrollValue = EditorGUILayout.BeginScrollView(_sceneListScrollValue);

                foreach (SceneField scene in _sceneSets[_selectedSceneSet - 1].SetScenes)
                {
                    SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.SecondaryLayerColour,
                                                                    () => DrawSceneEntry(scene));
                }

                EditorGUILayout.EndScrollView();

                GUILayout.FlexibleSpace();

                SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.PrimaryLayerColour, DrawFooterPanel);
            }
        }
Esempio n. 9
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);
                    }
                });
            });
        }
Esempio n. 10
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. 11
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));
        }