Пример #1
0
        public void Draw(LogNode node, int depth, ref Rect rect)
        {
            string text = node.text;

            if (depth == 0)
            {
                text = node.children[0].text;
            }

            rect.x = depth * 15;
            if (node.children.Count > 0)
            {
                Widgets.Label(rect, node.expand ? "[-]" : "[+]");
                rect.x += 15;
            }

            rect.height = Text.CalcHeight(text, rect.width);
            Widgets.Label(rect, text);
            if (Widgets.ButtonInvisible(rect))
            {
                node.expand = !node.expand;
            }
            rect.y += (int)rect.height;

            if (node.expand)
            {
                foreach (LogNode child in node.children)
                {
                    Draw(child, depth + 1, ref rect);
                }
            }
        }
Пример #2
0
        public LogNode LogNode(string text)
        {
            LogNode node = new LogNode(text, current);

            current.children.Add(node);
            return(node);
        }
Пример #3
0
 public void Exit()
 {
     if (stopped <= 0)
     {
         current = current.parent;
     }
 }
Пример #4
0
 public void Enter(string text)
 {
     if (stopped <= 0)
     {
         current = Node(text);
     }
 }
Пример #5
0
 private void Print(LogNode node, int depth)
 {
     Log.Message(new string(' ', depth) + node.text);
     foreach (LogNode child in node.children)
     {
         Print(child, depth + 1);
     }
 }
Пример #6
0
        public LogNode Node(string text)
        {
            if (stopped > 0)
            {
                return(current);
            }
            LogNode logNode = new LogNode(text, current);

            current.children.Add(logNode);
            return(logNode);
        }
Пример #7
0
        public void Draw(LogNode node, int depth, ref Rect rect)
        {
            string text = node.text;

            if (depth == 0 && text == SyncLogger.RootNodeName)
            {
                text = node.children[0].text;
            }

            rect.x = depth * 15;
            if (node.children.Count > 0)
            {
                Widgets.Label(rect, node.expand ? "[-]" : "[+]");
                rect.x += 15;
            }

            // Taken from Verse.Text.CalcHeight, edited not to remove "XML tags"
            Text.tmpTextGUIContent.text = text;
            rect.height = Text.CurFontStyle.CalcHeight(Text.tmpTextGUIContent, rect.width);

            Widgets.Label(rect, text);
            if (Widgets.ButtonInvisible(rect))
            {
                node.expand = !node.expand;
            }

            rect.y += (int)rect.height;

            if (node.expand)
            {
                foreach (LogNode child in node.children)
                {
                    Draw(child, depth + 1, ref rect);
                }
            }
        }
Пример #8
0
 public LogNode(string text, LogNode parent = null)
 {
     this.text   = text;
     this.parent = parent;
 }
Пример #9
0
 public void LogExit()
 {
     current = current.parent;
 }
Пример #10
0
 public void LogEnter(string text)
 {
     current = LogNode(text);
 }