Prevent adding conditions when no layouts exist

Also externalized the condition table draw logic for the sake of
readability.
This commit is contained in:
Zacharie Day 2020-09-02 19:36:54 -04:00 committed by Anna
parent a3d65ec43b
commit 819ba7cf45

View File

@ -215,8 +215,25 @@ namespace HudSwap {
ImGui.Separator();
if (this.plugin.Config.Layouts2.Count == 0) {
ImGui.Text("Create at least one layout to begin setting up swaps.");
} else {
ImGui.Text("Add conditions below for when to swap.\nThe topmost condition in the list has priority.");
this.DrawConditionsTable();
}
ImGui.EndTabItem();
}
ImGui.EndTabBar();
}
ImGui.End();
}
}
private void DrawConditionsTable()
{
ImGui.Columns(4);
var conditions = new List<HudConditionMatch>(plugin.Config.HudConditionMatches);
@ -311,6 +328,8 @@ namespace HudSwap {
ImGui.Columns();
ImGui.Separator();
if (ImGui.Button("Add##condition")) {
this.editingConditionIndex = this.plugin.Config.HudConditionMatches.Count;
this.editingCondition = new HudConditionMatch();
@ -339,15 +358,6 @@ namespace HudSwap {
}
}
}
ImGui.EndTabItem();
}
ImGui.EndTabBar();
}
ImGui.End();
}
}
private static void HelpMarker(string text) {