Пример #1
0
        //...
        static bool OnLogMessageReceived(Logger.Message msg)
        {
            if (msg.tag == "Editor")
            {
                return(false);
            }
            var graph = Graph.GetElementGraph(msg.context);

            if (graph == null)
            {
                return(false);
            }

            if (!graphsMap.ContainsKey(graph))
            {
                graphsMap[graph] = new List <Logger.Message>();
            }
            graphsMap[graph].Add(msg);
            messages.Add(msg);

            if (current != null)
            {
                current.RefreshTitle();
                willRepaint = true;
                return(true);
            }

            return(false);
        }
Пример #2
0
        //...
        static void ProccessMessage(Logger.Message msg)
        {
            var graph = Graph.GetElementGraph(msg.context);

            if (graph != null)
            {
                var unityContext = graph.agent != null? (Object)graph.agent.gameObject : (Object)graph;
                Selection.activeObject = unityContext;
                EditorGUIUtility.PingObject(unityContext);
                var editor = GraphEditor.current;
                if (editor == null || GraphEditor.currentGraph != graph)
                {
                    editor = GraphEditor.OpenWindow(graph);
                }
                if (msg.context is Node)
                {
                    var node = (Node)msg.context;
                    EditorApplication.delayCall += () => GraphEditor.FocusNode(node);
                }
                if (msg.context is Connection)
                {
                    var connection = (Connection)msg.context;
                    EditorApplication.delayCall += () => GraphEditor.FocusConnection(connection);
                }
                if (msg.context is Task)
                {
                    var task   = (Task)msg.context;
                    var parent = graph.GetTaskParent(task);
                    if (parent != null)
                    {
                        EditorApplication.delayCall += () => GraphEditor.FocusNode(parent);
                    }
                }
            }
        }
Пример #3
0
 //Listen to Logs and return true if handled
 bool OnLogMessageReceived(Logger.Message msg)
 {
     if (msg.tag == "Editor")
     {
         ShowNotification(new GUIContent(msg.text));
         return(true);
     }
     return(false);
 }
Пример #4
0
        //helper method
        public static GUIContent GetFormatedGUIContentForMessage(Logger.Message msg)
        {
            if (!msg.IsValid())
            {
                return(null);
            }
            var tagText = string.Format("<b>({0} {1})</b>", msg.tag, msg.type.ToString());
            var map     = styleMap[msg.type];

            return(new GUIContent(string.Format("<color=#{0}>{1}: {2}</color>", map.hex, tagText, msg.text), map.icon));
        }
Пример #5
0
        //...
        static void ProccessMessage(Logger.Message msg)
        {
            Object unityContext = null;

            var graph = Graph.GetElementGraph(msg.context);

            if (graph != null)
            {
                unityContext = graph.agent != null ? (Object)graph.agent.gameObject : (Object)graph;
            }
            else
            {
                unityContext = msg.context as Object;
            }

            if (unityContext != null)
            {
                Selection.activeObject = unityContext;
                EditorGUIUtility.PingObject(unityContext);
            }

            //cease here if no graph
            if (graph == null)
            {
                return;
            }

            var editor = GraphEditor.current;

            if (editor == null || GraphEditor.currentGraph != graph)
            {
                editor = GraphEditor.OpenWindow(graph);
            }

            IGraphElement element = null;

            if (msg.context is IGraphElement)
            {
                element = (IGraphElement)msg.context;
            }
            if (msg.context is Task)
            {
                element = graph.GetTaskParentElement((Task)msg.context);
            }
            if (msg.context is BBParameter)
            {
                element = graph.GetParameterParentElement((BBParameter)msg.context);
            }

            EditorApplication.delayCall += () => GraphEditor.FocusElement(element, true);
        }
Пример #6
0
        //...
        static bool OnLogMessageReceived(Logger.Message msg)
        {
            if (msg.tag == "Editor")
            {
                return(false);
            }

            if (ParadoxNotion.Services.Threader.isMainThread)
            {
                if (!Prefs.logEventsInfo && msg.tag == LogTag.EVENT)
                {
                    return(true);
                }

                if (!Prefs.logVariablesInfo && msg.tag == LogTag.VARIABLE)
                {
                    return(true);
                }
            }

            var graph = Graph.GetElementGraph(msg.context);

            if (graph == null)
            {
                return(false);
            }

            if (!graphsMap.ContainsKey(graph))
            {
                graphsMap[graph] = new List <Logger.Message>();
            }

            graphsMap[graph].Add(msg);
            messages.Add(msg);

            if (current != null)
            {
                current.RefreshTitle();
                return(true);
            }

            return(false);
        }