Beispiel #1
0
        public static void Draw <TLeaf>(this HierarchicalTree <TLeaf> tree, bool drawSettings = true)
            where TLeaf : IHierarchicalTreeLeaf
        {
            if (!drawSettings || ImGui.CollapsingHeader($"Hierarchical Tree"))
            {
                var branchName = (DebugField <string>) "branchName";
                var branches   = (DebugField <Dictionary <string, HierarchicalTree <TLeaf> > >) "branches";
                var leaves     = (DebugField <HashSet <TreeLeaf <IHierarchicalTreeLeaf> > >) "leaves";

                DebugField.SetOwner(tree, branchName, branches, leaves);

                if (drawSettings)
                {
                    var settings = (DebugField <HierarchicalTreeSettingsData>)(tree, "settings");
                    if (!settings.AssertDrawable(branchName, branches, leaves))
                    {
                        return;
                    }

                    var folderRegex = (DebugField <Regex>) "folderRegex" + settings.Value;
                    if (drawSettings && folderRegex.AssertDrawable())
                    {
                        ImGui.Text($"Settings: {folderRegex.Value.ToString()}");
                        ImGui.Separator();
                    }
                }

                using (var branchNode = ImGuiUn.ScopeTreeNode(branchName.Value))
                {
                    if (!branchNode.IsOpen)
                    {
                        return;
                    }

                    if (branches.Value != null)
                    {
                        foreach (var branch in branches.Value.Values)
                        {
                            branch.Draw(false);
                        }
                    }

                    if (leaves.Value != null)
                    {
                        using (var leafNode = branches.Value != null ? ImGuiUn.ScopeTreeNode(leaves.Name) : null)
                        {
                            if (leafNode != null && !leafNode.IsOpen)
                            {
                                return;
                            }

                            foreach (var leaf in leaves.Value)
                            {
                                ImGui.Text($"- {leaf.Name}{leaf.Extension}{(leaf.LeafData.Size < 0 ? string.Empty : $" ({leaf.LeafData.Size.ToReadableSize()})")}");
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        protected void DrawStates()
        {
            if (stateMachine.AssertDrawable())
            {
                ImGui.TextColored(Color.green, $"Active state: {(stateMachine.Value.ActiveState == null ? "NONE" : stateMachine.Value.ActiveState.ToString())}");
                ImGui.TextColored(Color.cyan, $"-> Incoming state: {(stateMachine.Value.IncomingState == null ? "NONE" : stateMachine.Value.IncomingState.ToString())}");
                ImGui.Separator();
            }

            if (!states.AssertDrawable())
            {
                states.SetOwner(stateMachine.Value);
                return;
            }

            if (ImGui.CollapsingHeader("States:"))
            {
                using (new ScopeIndent())
                {
                    foreach (var state in states.Value)
                    {
                        ImGui.Text($"- {state.methodInfo.Name}");
                    }
                }
            }
        }
Beispiel #3
0
        protected void DrawConnections()
        {
            if (!connections.AssertDrawable())
            {
                connections.SetOwner(stateMachine.Value);
                return;
            }

            if (ImGui.CollapsingHeader("Connections:"))
            {
                using (new ScopeIndent())
                {
                    foreach (var connectionPair in connections.Value)
                    {
                        ImGui.Text($"- {connectionPair.Key.Name}");
                        using (new ScopeIndent())
                        {
                            foreach (var pair in connectionPair.Value)
                            {
                                ImGui.Text($"-> {pair.Key.ToString()} > {pair.Value.Name}");
                            }
                        }
                    }
                }
            }
        }