feat: allow configuring staging slot
This commit is contained in:
parent
3b3a14e7b1
commit
bc2187144f
|
@ -15,6 +15,8 @@ namespace HudSwap {
|
|||
|
||||
public bool SwapsEnabled { get; set; } = false;
|
||||
|
||||
public HudSlot StagingSlot { get; set; } = HudSlot.Four;
|
||||
|
||||
public Guid defaultLayout = Guid.Empty;
|
||||
|
||||
public Guid combatLayout = Guid.Empty;
|
||||
|
|
|
@ -111,6 +111,20 @@ namespace HudSwap {
|
|||
}
|
||||
ImGui.Text("Note: Disable swaps when editing your HUD.");
|
||||
|
||||
ImGui.Spacing();
|
||||
string staging = ((int)this.plugin.config.StagingSlot + 1).ToString();
|
||||
if (ImGui.BeginCombo("Staging slot", staging)) {
|
||||
foreach (HudSlot slot in Enum.GetValues(typeof(HudSlot))) {
|
||||
if (ImGui.Selectable(((int)slot + 1).ToString())) {
|
||||
this.plugin.config.StagingSlot = slot;
|
||||
this.plugin.config.Save();
|
||||
}
|
||||
}
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
HelpMarker("The staging slot is the HUD layout slot that will be used as your HUD layout. All changes will be written to this slot when swaps are enabled.");
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.Text("This is the default layout. If none of the below conditions are\nsatisfied, this layout will be enabled.");
|
||||
|
@ -150,6 +164,17 @@ namespace HudSwap {
|
|||
}
|
||||
}
|
||||
|
||||
private void HelpMarker(string text) {
|
||||
ImGui.TextDisabled("(?)");
|
||||
if (ImGui.IsItemHovered()) {
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.PushTextWrapPos(ImGui.GetFontSize() * 20f);
|
||||
ImGui.TextUnformatted(text);
|
||||
ImGui.PopTextWrapPos();
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
private string LayoutNameOrDefault(Guid key) {
|
||||
Tuple<string, byte[]> tuple;
|
||||
if (this.plugin.config.Layouts.TryGetValue(key, out tuple)) {
|
||||
|
@ -319,8 +344,8 @@ namespace HudSwap {
|
|||
if (layoutBytes == null) {
|
||||
return; // FIXME: do something better
|
||||
}
|
||||
this.plugin.hud.WriteLayout(HudSlot.Four, layoutBytes);
|
||||
this.plugin.hud.SelectSlot(HudSlot.Four, true);
|
||||
this.plugin.hud.WriteLayout(this.plugin.config.StagingSlot, entry.Item2);
|
||||
this.plugin.hud.SelectSlot(this.plugin.config.StagingSlot, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue