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); } } }
public LogNode LogNode(string text) { LogNode node = new LogNode(text, current); current.children.Add(node); return(node); }
public void Exit() { if (stopped <= 0) { current = current.parent; } }
public void Enter(string text) { if (stopped <= 0) { current = Node(text); } }
private void Print(LogNode node, int depth) { Log.Message(new string(' ', depth) + node.text); foreach (LogNode child in node.children) { Print(child, depth + 1); } }
public LogNode Node(string text) { if (stopped > 0) { return(current); } LogNode logNode = new LogNode(text, current); current.children.Add(logNode); return(logNode); }
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); } } }
public LogNode(string text, LogNode parent = null) { this.text = text; this.parent = parent; }
public void LogExit() { current = current.parent; }
public void LogEnter(string text) { current = LogNode(text); }