feat: add ability to rename layouts
This commit is contained in:
parent
ffb77765c2
commit
a4c728779c
@ -31,6 +31,7 @@ namespace HudSwap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string importName = "";
|
private string importName = "";
|
||||||
|
private string renameName = "";
|
||||||
private Guid selectedLayout = Guid.Empty;
|
private Guid selectedLayout = Guid.Empty;
|
||||||
|
|
||||||
private static bool configErrorOpen = true;
|
private static bool configErrorOpen = true;
|
||||||
@ -93,6 +94,7 @@ namespace HudSwap {
|
|||||||
foreach (KeyValuePair<Guid, Tuple<string, byte[]>> entry in this.plugin.config.Layouts) {
|
foreach (KeyValuePair<Guid, Tuple<string, byte[]>> entry in this.plugin.config.Layouts) {
|
||||||
if (ImGui.Selectable(entry.Value.Item1, this.selectedLayout == entry.Key)) {
|
if (ImGui.Selectable(entry.Value.Item1, this.selectedLayout == entry.Key)) {
|
||||||
this.selectedLayout = entry.Key;
|
this.selectedLayout = entry.Key;
|
||||||
|
this.renameName = entry.Value.Item1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui.ListBoxFooter();
|
ImGui.ListBoxFooter();
|
||||||
@ -113,6 +115,14 @@ namespace HudSwap {
|
|||||||
this.selectedLayout = Guid.Empty;
|
this.selectedLayout = Guid.Empty;
|
||||||
this.plugin.config.Save();
|
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();
|
ImGui.Separator();
|
||||||
|
Loading…
Reference in New Issue
Block a user