From a4c728779cf071b66d9c12bd6c97f759988f60d6 Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Thu, 30 Jul 2020 15:40:18 -0400 Subject: [PATCH] feat: add ability to rename layouts --- HudSwap/PluginUI.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/HudSwap/PluginUI.cs b/HudSwap/PluginUI.cs index 535136c..4b863e2 100644 --- a/HudSwap/PluginUI.cs +++ b/HudSwap/PluginUI.cs @@ -31,6 +31,7 @@ namespace HudSwap { } private string importName = ""; + private string renameName = ""; private Guid selectedLayout = Guid.Empty; private static bool configErrorOpen = true; @@ -93,6 +94,7 @@ namespace HudSwap { foreach (KeyValuePair> entry in this.plugin.config.Layouts) { if (ImGui.Selectable(entry.Value.Item1, this.selectedLayout == entry.Key)) { this.selectedLayout = entry.Key; + this.renameName = entry.Value.Item1; } } ImGui.ListBoxFooter(); @@ -113,6 +115,14 @@ namespace HudSwap { this.selectedLayout = Guid.Empty; this.plugin.config.Save(); } + + ImGui.InputText("##rename-input", ref this.renameName, 100); + ImGui.SameLine(); + if (ImGui.Button("Rename") && this.renameName != "" && this.selectedLayout != null) { + Tuple entry = this.plugin.config.Layouts[this.selectedLayout]; ; + this.plugin.config.Layouts[this.selectedLayout] = new Tuple(this.renameName, entry.Item2); + this.plugin.config.Save(); + } } ImGui.Separator();