feat: add ability to rename layouts

This commit is contained in:
Anna 2020-07-30 15:40:18 -04:00
parent 63b9daaa30
commit 3bea865b90
1 changed files with 10 additions and 0 deletions

View File

@ -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<Guid, Tuple<string, byte[]>> 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<string, byte[]> entry = this.plugin.config.Layouts[this.selectedLayout]; ;
this.plugin.config.Layouts[this.selectedLayout] = new Tuple<string, byte[]>(this.renameName, entry.Item2);
this.plugin.config.Save();
}
}
ImGui.Separator();