예제 #1
0
        private static void ConsoleActivityChanged(string text, int instanceID)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            {
                var index = text.IndexOf(uNodeException.KEY_REFERENCE);
                if (index > 0)
                {
                    string str = null;
                    for (int i = index + uNodeException.KEY_REFERENCE.Length; i < text.Length; i++)
                    {
                        if (str == null || char.IsNumber(text[i]))
                        {
                            str += text[i];
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (int.TryParse(str, out var id))
                    {
                        var reference = EditorUtility.InstanceIDToObject(id);
                        if (reference is INode <uNodeRoot> )
                        {
                            if (reference is NodeComponent)
                            {
                                uNodeEditor.HighlightNode(reference as NodeComponent);
                            }
                            else
                            {
                                uNodeEditor.ChangeTarget(reference as INode <uNodeRoot>);
                            }
                            return;
                        }
                    }
                    return;
                }
            }
            List <ActivityData> datas = new List <ActivityData>();

            foreach (var info in uNodeEditor.SavedData.scriptInformations)
            {
                string path  = info.path.Replace("\\", "/");
                int    index = text.IndexOf("at " + path + ":");
                if (index < 0)
                {
                    try {
                        path  = path.Remove(0, System.IO.Directory.GetCurrentDirectory().Length + 1);
                        index = text.IndexOf("at " + path + ":");
                    } catch {}
                }
                if (index >= 0)
                {
                    datas.Add(new ActivityData(index, path, info));
                }
            }
            // datas.Sort((x, y) => CompareUtility.Compare(x.number, y.number));
            uNodeEditor.EditorScriptInfo scriptInfo = null;
            int line = 0;

            foreach (var data in datas.OrderByDescending(x => x.number))
            {
                string num = "";
                for (int i = data.number + data.path.Length + 4; i < text.Length; i++)
                {
                    var c = text[i];
                    if (char.IsNumber(c))
                    {
                        num += c;
                    }
                    else
                    {
                        break;
                    }
                }
                if (int.TryParse(num, out line))
                {
                    line--;
                    scriptInfo = data.info;
                }
            }
            if (scriptInfo != null && uNodeEditor.HighlightNode(scriptInfo, line))
            {
                return;
            }
            var uObj = EditorUtility.InstanceIDToObject(instanceID);

            if (uObj is INode <uNodeRoot> )
            {
                if (uObj is NodeComponent)
                {
                    uNodeEditor.HighlightNode(uObj as NodeComponent);
                }
                else
                {
                    uNodeEditor.ChangeTarget(uObj as INode <uNodeRoot>);
                }
            }
        }
예제 #2
0
 public ActivityData(int number, string path, uNodeEditor.EditorScriptInfo info)
 {
     this.number = number;
     this.path   = path;
     this.info   = info;
 }