Prevent adding conditions when no layouts exist
Also externalized the condition table draw logic for the sake of readability.
This commit is contained in:
parent
3ec6366320
commit
19f1934de0
@ -215,8 +215,25 @@ namespace HudSwap {
|
|||||||
|
|
||||||
ImGui.Separator();
|
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.");
|
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);
|
ImGui.Columns(4);
|
||||||
|
|
||||||
var conditions = new List<HudConditionMatch>(plugin.Config.HudConditionMatches);
|
var conditions = new List<HudConditionMatch>(plugin.Config.HudConditionMatches);
|
||||||
@ -311,6 +328,8 @@ namespace HudSwap {
|
|||||||
|
|
||||||
ImGui.Columns();
|
ImGui.Columns();
|
||||||
|
|
||||||
|
ImGui.Separator();
|
||||||
|
|
||||||
if (ImGui.Button("Add##condition")) {
|
if (ImGui.Button("Add##condition")) {
|
||||||
this.editingConditionIndex = this.plugin.Config.HudConditionMatches.Count;
|
this.editingConditionIndex = this.plugin.Config.HudConditionMatches.Count;
|
||||||
this.editingCondition = new HudConditionMatch();
|
this.editingCondition = new HudConditionMatch();
|
||||||
@ -339,15 +358,6 @@ namespace HudSwap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndTabItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.EndTabBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.End();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HelpMarker(string text) {
|
private static void HelpMarker(string text) {
|
||||||
|
Loading…
Reference in New Issue
Block a user