示例#1
0
        public override void Draw()
        {
            ImGui.Columns(2, "cols", true);
            //strings vs infocards
            if (ImGuiExt.ToggleButton("Strings", showStrings))
            {
                showStrings = true;
            }
            ImGui.SameLine();
            if (ImGuiExt.ToggleButton("Infocards", !showStrings))
            {
                showStrings = false;
            }
            ImGui.SameLine();
            ImGui.PushItemWidth(140);
            ImGui.InputInt("##id", ref id, 0, 0);
            ImGui.PopItemWidth();
            ImGui.SameLine();
            int gotoItem = -1;

            if (ImGui.Button("Go"))
            {
                if (showStrings)
                {
                    for (int i = 0; i < stringsIds.Length; i++)
                    {
                        if (id == stringsIds[i])
                        {
                            gotoItem      = i;
                            currentString = i;
                            txt.SetText(manager.GetStringResource(stringsIds[i]));
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < infocardsIds.Length; i++)
                    {
                        if (id == infocardsIds[i])
                        {
                            gotoItem        = i;
                            currentInfocard = i;
                            if (display == null)
                            {
                                display = new InfocardControl(win, RDLParse.Parse(manager.GetXmlResource(infocardsIds[currentInfocard]), win.Fonts), 100);
                            }
                            else
                            {
                                display.SetInfocard(RDLParse.Parse(manager.GetXmlResource(infocardsIds[currentInfocard]), win.Fonts));
                            }
                        }
                    }
                }
            }
            ImGui.Separator();
            //list
            ImGui.BeginChild("##list");
            if (showStrings)
            {
                if (gotoItem == -1)
                {
                    stringClipper.Begin(stringsIds.Length);
                    while (stringClipper.Step())
                    {
                        for (int i = stringClipper.DisplayStart; i < stringClipper.DisplayEnd; i++)
                        {
                            if (ImGui.Selectable(stringsIds[i] + "##" + i, currentString == i))
                            {
                                currentString = i;
                                txt.SetText(manager.GetStringResource(stringsIds[i]));
                            }
                        }
                    }
                    stringClipper.End();
                }
                else
                {
                    for (int i = 0; i < stringsIds.Length; i++)
                    {
                        ImGui.Selectable(stringsIds[i] + "##" + i, currentString == i);
                        if (currentString == i)
                        {
                            ImGui.SetScrollHere();
                        }
                    }
                }
            }
            else
            {
                if (gotoItem == -1)
                {
                    infocardClipper.Begin(infocardsIds.Length);
                    while (infocardClipper.Step())
                    {
                        for (int i = infocardClipper.DisplayStart; i < infocardClipper.DisplayEnd; i++)
                        {
                            if (ImGui.Selectable(infocardsIds[i] + "##" + i, currentInfocard == i))
                            {
                                currentInfocard = i;
                                if (display == null)
                                {
                                    display = new InfocardControl(win, RDLParse.Parse(manager.GetXmlResource(infocardsIds[currentInfocard]), win.Fonts), 100);
                                }
                                else
                                {
                                    display.SetInfocard(RDLParse.Parse(manager.GetXmlResource(infocardsIds[currentInfocard]), win.Fonts));
                                }
                            }
                        }
                    }
                    infocardClipper.End();
                }
                else
                {
                    for (int i = 0; i < infocardsIds.Length; i++)
                    {
                        ImGui.Selectable(infocardsIds[i] + "##" + i, currentInfocard == i);
                        if (currentInfocard == i)
                        {
                            ImGui.SetScrollHere();
                        }
                    }
                }
            }
            ImGui.EndChild();
            ImGui.NextColumn();
            //Display
            if (showStrings)
            {
                if (currentString != -1)
                {
                    ImGui.Text(stringsIds[currentString].ToString());
                    txt.InputTextMultiline("##txt", new Vector2(-1, ImGui.GetWindowHeight() - 70), ImGuiInputTextFlags.ReadOnly);
                }
            }
            else
            {
                if (currentInfocard != -1)
                {
                    ImGui.Text(infocardsIds[currentInfocard].ToString());
                    ImGui.BeginChild("##display");
                    display.Draw(ImGui.GetWindowWidth() - 15);
                    ImGui.EndChild();
                }
            }
        }
 public override void Draw()
 {
     SearchDialog();
     InfocardXmlDialog();
     //strings vs infocards
     if (ImGuiExt.ToggleButton("Strings", showStrings))
     {
         showStrings = true;
         DisplayInfoString();
     }
     ImGui.SameLine();
     if (ImGuiExt.ToggleButton("Infocards", !showStrings))
     {
         showStrings = false;
         DisplayInfoXml();
     }
     ImGui.SameLine();
     ImGui.PushItemWidth(140);
     ImGui.InputInt("##id", ref id, 0, 0);
     ImGui.PopItemWidth();
     ImGui.SameLine();
     if (ImGui.Button("Go"))
     {
         if (showStrings)
         {
             GotoString();
         }
         else
         {
             GotoInfocard();
         }
     }
     ImGui.SameLine();
     if (ImGui.Button("Search..."))
     {
         if (showStrings)
         {
             SearchStrings();
         }
         else
         {
             SearchInfocards();
         }
     }
     ImGui.Separator();
     ImGui.Columns(2, "cols", true);
     //list
     ImGui.BeginChild("##list");
     if (showStrings)
     {
         if (gotoItem == -1)
         {
             stringClipper.Begin(stringsIds.Length);
             while (stringClipper.Step())
             {
                 for (int i = stringClipper.DisplayStart; i < stringClipper.DisplayEnd; i++)
                 {
                     if (ImGui.Selectable(stringsIds[i] + "##" + i, currentString == i))
                     {
                         currentString = i;
                         DisplayInfoString();
                     }
                 }
             }
             stringClipper.End();
         }
         else
         {
             for (int i = 0; i < stringsIds.Length; i++)
             {
                 ImGui.Selectable(stringsIds[i] + "##" + i, currentString == i);
                 if (currentString == i)
                 {
                     ImGui.SetScrollHereY();
                 }
             }
             gotoItem = -1;
         }
     }
     else
     {
         if (gotoItem == -1)
         {
             infocardClipper.Begin(infocardsIds.Length);
             while (infocardClipper.Step())
             {
                 for (int i = infocardClipper.DisplayStart; i < infocardClipper.DisplayEnd; i++)
                 {
                     if (ImGui.Selectable(infocardsIds[i] + "##" + i, currentInfocard == i))
                     {
                         currentInfocard = i;
                         currentXml      = manager.GetXmlResource(infocardsIds[currentInfocard]);
                         DisplayInfoXml();
                     }
                 }
             }
             infocardClipper.End();
         }
         else
         {
             for (int i = 0; i < infocardsIds.Length; i++)
             {
                 ImGui.Selectable(infocardsIds[i] + "##" + i, currentInfocard == i);
                 if (currentInfocard == i)
                 {
                     ImGui.SetScrollHereY();
                 }
             }
             gotoItem = -1;
         }
     }
     ImGui.EndChild();
     ImGui.NextColumn();
     //Display
     if (showStrings)
     {
         if (currentString != -1)
         {
             ImGui.Text(stringsIds[currentString].ToString());
             ImGui.SameLine();
             if (ImGui.Button("Copy Text"))
             {
                 win.SetClipboardText(manager.GetStringResource(stringsIds[currentString]));
             }
             ImGui.BeginChild("##display");
             display.Draw(ImGui.GetWindowWidth() - 15);
             ImGui.EndChild();
         }
     }
     else
     {
         if (currentInfocard != -1)
         {
             ImGui.AlignTextToFramePadding();
             ImGui.Text(infocardsIds[currentInfocard].ToString());
             ImGui.SameLine();
             if (ImGui.Button("View Xml"))
             {
                 doOpenXml = true;
             }
             ImGui.SameLine();
             if (ImGui.Button("Copy Text"))
             {
                 win.SetClipboardText(display.InfocardText);
             }
             ImGui.BeginChild("##display");
             display.Draw(ImGui.GetWindowWidth() - 15);
             ImGui.EndChild();
         }
     }
 }