private void DrawFileListTab() { if (!ImGui.BeginTabItem(LabelFileListTab)) { return; } using var raii = ImGuiRaii.DeferredEnd(ImGui.EndTabItem); ImGuiCustom.HoverTooltip(TooltipFilesTab); ImGui.SetNextItemWidth(-1); if (ImGui.BeginListBox(LabelFileListHeader, AutoFillSize)) { raii.Push(ImGui.EndListBox); UpdateFilenameList(); using var colorRaii = new ImGuiRaii.Color(); foreach (var(name, _, color, _) in _fullFilenameList !) { colorRaii.Push(ImGuiCol.Text, color); ImGui.Selectable(name.FullName); colorRaii.Pop(); } } else { _fullFilenameList = null; } }
private void DrawConflictTab() { if (!Mod.Cache.Conflicts.Any() || !ImGui.BeginTabItem(LabelConflictsTab)) { return; } using var raii = ImGuiRaii.DeferredEnd(ImGui.EndTabItem); ImGui.SetNextItemWidth(-1); if (!ImGui.BeginListBox(LabelConflictsHeader, AutoFillSize)) { return; } raii.Push(ImGui.EndListBox); using var indent = ImGuiRaii.PushIndent(0); foreach (var(mod, (files, manipulations)) in Mod.Cache.Conflicts) { if (ImGui.Selectable(mod.Data.Meta.Name)) { _selector.SelectModByDir(mod.Data.BasePath.Name); } ImGui.SameLine(); ImGui.Text($"(Priority {mod.Settings.Priority})"); indent.Push(15f); foreach (var file in files) { ImGui.Selectable(file); } foreach (var manip in manipulations) { ImGui.Text(manip.IdentifierString()); } indent.Pop(15f); } }
private unsafe void SubmitImGuiStuff() { ImGui.GetStyle().WindowRounding = 0; ImGui.SetNextWindowSize(new System.Numerics.Vector2(_nativeWindow.Width - 10, _nativeWindow.Height - 20), SetCondition.Always); ImGui.SetNextWindowPosCenter(SetCondition.Always); ImGui.BeginWindow("ImGUI.NET Sample Program", ref _mainWindowOpened, WindowFlags.NoResize | WindowFlags.NoTitleBar | WindowFlags.NoMove); ImGui.BeginMainMenuBar(); if (ImGui.BeginMenu("Help")) { if (ImGui.MenuItem("About", "Ctrl-Alt-A", false, true)) { } ImGui.EndMenu(); } ImGui.EndMainMenuBar(); ImGui.Text("Hello,"); ImGui.Text("World!"); ImGui.Text("From ImGui.NET. ...Did that work?"); var pos = ImGui.GetIO().MousePosition; bool leftPressed = ImGui.GetIO().MouseDown[0]; ImGui.Text("Current mouse position: " + pos + ". Pressed=" + leftPressed); if (ImGui.Button("Increment the counter.")) { _pressCount += 1; } ImGui.Text($"Button pressed {_pressCount} times.", new System.Numerics.Vector4(0, 1, 1, 1)); ImGui.InputTextMultiline("Input some text:", _textInputBuffer, (uint)_textInputBufferLength, new System.Numerics.Vector2(360, 240), InputTextFlags.Default, OnTextEdited); ImGui.SliderFloat("SlidableValue", ref _sliderVal, -50f, 100f, $"{_sliderVal.ToString("##0.00")}", 1.0f); ImGui.DragVector3("Vector3", ref _positionValue, -100, 100); if (ImGui.TreeNode("First Item")) { ImGui.Text("Word!"); ImGui.TreePop(); } if (ImGui.TreeNode("Second Item")) { ImGui.ColorButton(_buttonColor, false, true); if (ImGui.Button("Push me to change color", new System.Numerics.Vector2(120, 30))) { _buttonColor = new System.Numerics.Vector4(_buttonColor.Y + .25f, _buttonColor.Z, _buttonColor.X, _buttonColor.W); if (_buttonColor.X > 1.0f) { _buttonColor.X -= 1.0f; } } ImGui.TreePop(); } if (ImGui.Button("Press me!", new System.Numerics.Vector2(100, 30))) { ImGuiNative.igOpenPopup("SmallButtonPopup"); } if (ImGui.BeginPopup("SmallButtonPopup")) { ImGui.Text("Here's a popup menu."); ImGui.Text("With two lines."); ImGui.EndPopup(); } if (ImGui.Button("Open Modal window")) { ImGui.OpenPopup("ModalPopup"); } if (ImGui.BeginPopupModal("ModalPopup")) { ImGui.Text("You can't press on anything else right now."); ImGui.Text("You are stuck here."); if (ImGui.Button("OK", new System.Numerics.Vector2(0, 0))) { } ImGui.SameLine(); ImGui.Dummy(100f, 0f); ImGui.SameLine(); if (ImGui.Button("Please go away", new System.Numerics.Vector2(0, 0))) { ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } ImGui.Text("I have a context menu."); if (ImGui.BeginPopupContextItem("ItemContextMenu")) { if (ImGui.Selectable("How's this for a great menu?")) { } ImGui.Selectable("Just click somewhere to get rid of me."); ImGui.EndPopup(); } ImGui.EndWindow(); _memoryEditor.Draw("Memory editor", _memoryEditorData, _memoryEditorData.Length); if (ImGui.GetIO().AltPressed&& ImGui.GetIO().KeysDown[(int)Key.F4]) { _nativeWindow.Close(); } }
public static void Render() { if (!WindowManager.LootTable) { return; } ImGui.SetNextWindowSize(size, ImGuiCond.Once); if (!ImGui.Begin("Loot Table Editor")) { ImGui.End(); return; } if (ImGui.Button("Save")) { LootTables.Save(); } ImGui.SameLine(); if (ImGui.Button("New##pe")) { ImGui.OpenPopup("Add Item##pe"); } if (selectedTable != null) { ImGui.SameLine(); if (ImGui.Button("Delete")) { LootTables.Defined.Remove(selectedTable); LootTables.Data.Remove(selectedTable); selectedTable = null; } } filter.Draw(""); ImGui.SameLine(); ImGui.Text($"{count}"); if (ImGui.BeginPopupModal("Add Item##pe")) { ImGui.PushItemWidth(300); ImGui.InputText("Id", ref poolName, 64); ImGui.PopItemWidth(); if (ImGui.Button("Add") || Input.Keyboard.WasPressed(Keys.Enter, true)) { selectedTable = poolName; LootTables.Defined[poolName] = new AnyDrop(); LootTables.Data[poolName] = new JsonObject { ["type"] = "any" }; poolName = ""; ImGui.CloseCurrentPopup(); } ImGui.SameLine(); if (ImGui.Button("Cancel") || Input.Keyboard.WasPressed(Keys.Escape, true)) { poolName = ""; ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } if (selectedTable != null) { ImGui.SameLine(); if (ImGui.Button("Remove##pe")) { LootTables.Defined.Remove(selectedTable); selectedTable = null; } } count = 0; ImGui.Separator(); var height = ImGui.GetStyle().ItemSpacing.Y; ImGui.BeginChild("rolingRegionItems##Pe", new System.Numerics.Vector2(0, -height), false, ImGuiWindowFlags.HorizontalScrollbar); foreach (var i in LootTables.Defined) { ImGui.PushID($"{id}___m"); if (filter.PassFilter(i.Key)) { count++; if (ImGui.Selectable($"{i.Key}##ped", i.Key == selectedTable)) { selectedTable = i.Key; } } ImGui.PopID(); id++; } id = 0; ImGui.EndChild(); ImGui.End(); if (selectedTable == null) { return; } var show = true; ImGui.SetNextWindowSize(size, ImGuiCond.Once); if (!ImGui.Begin("Loot Table", ref show)) { ImGui.End(); return; } if (!show) { selectedTable = null; ImGui.End(); return; } LootTables.RenderDrop(LootTables.Data[selectedTable]); ImGui.End(); }