Example #1
0
        public static void SubmitUI(JORManager manager)
        {
            ImGui.Begin("MAIN_WINDOW", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar);

            var windowX = 0;

            ImGui.SetWindowPos(new Vector2(windowX, 0), ImGuiCond.Once);
            var leftPaneWidth = 350;

            ImGui.SetWindowSize(new Vector2(leftPaneWidth, _window.Height));
            windowX += leftPaneWidth + 1;

            var statusTextColor = 0xFF0000FF;
            var statusText      = "Not Connected";

            if (manager.currentClient != null && manager.currentClient.IsConnected())
            {
                var datsize = manager.jhiClient.GetUnprocessedDataSize() + 1;
                statusTextColor = 0xFF00FF00;
                statusText      = $"Connected, buffer size {datsize - 1:X8}";
                if (datsize == 1)
                {
                    largestBufferUntil0 = 1;
                }
                else if (datsize > largestBufferUntil0)
                {
                    largestBufferUntil0 = datsize;
                }
                ImGui.ProgressBar((largestBufferUntil0 - (float)datsize) / (float)largestBufferUntil0);
            }

            DrawStyledTextInstance(statusText, statusTextColor);

            var jorServer = manager.jorServer;

            if (jorServer != null)
            {
                // Sort of a hack to do this here, but go through all nodes and make sure that their controls
                // have translation entries.
                EnsureTranslation(jorServer.Root.TreeRoot);

                if (ImGui.Button("Request JOR Root"))
                {
                    manager.jorServer.SendGetRootObjectRef();
                }

                ImGui.Checkbox("Use Translation", ref UseTranslation);
                if (ImGui.Button("Request Translation"))
                {
                    translationDictionary.CloudTranslate();
                }
                ImGui.InputText("Search", ref currentSearchString, 100);

                ImGui.BeginChild("JorTreeContainer");
                DrawTree(jorServer, jorServer.Root.TreeRoot);
                ImGui.EndChild();
                ImGui.End();

                ImGui.Begin("CONTROL_WINDOW", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar); // Init window
                ImGui.SetWindowPos(new Vector2(windowX, 0), ImGuiCond.Once);
                ImGui.SetWindowSize(new Vector2(_window.Width - windowX, _window.Height));

                var node = jorServer.CurrentNode;
                if (node != null && node.Status == JORNodeStatus.Valid)
                {
                    if (node.Controls.Any((control) => control.Type.StartsWith("RNG")))
                    {
                        if (ImGui.Button("ALL SLIDERS TO MAX"))
                        {
                            AllSlidersToMax(jorServer, node);
                        }
                    }

                    foreach (JORControl control in node.Controls)
                    {
                        DrawControlContainer(jorServer, control);
                    }
                }

                ImGui.End();
            }
        }