Skip to content

Commit

Permalink
Merge pull request #559 from FFXIV-CombatReborn/percentbar
Browse files Browse the repository at this point in the history
Fix config saving and update percent format
  • Loading branch information
LTS-FFXIV authored Jan 11, 2025
2 parents 82fa045 + 3c2fac2 commit 3a0854a
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ public static void DisplayMacro(this MacroInfo info)
// Display a draggable integer input for the macro index
if (ImGui.DragInt($"{UiString.ConfigWindow_Events_MacroIndex.GetDescription()}##MacroIndex{info.GetHashCode()}", ref info.MacroIndex, 1, -1, 99))
{
SaveConfig();
Service.Config.Save();
}

// Display a checkbox for the shared macro option
ImGui.SameLine();
if (ImGui.Checkbox($"{UiString.ConfigWindow_Events_ShareMacro.GetDescription()}##ShareMacro{info.GetHashCode()}", ref info.IsShared))
{
SaveConfig();
Service.Config.Save();
}
}

Expand All @@ -87,7 +87,7 @@ public static void DisplayEvent(this ActionEventInfo info)
if (ImGui.InputText($"{UiString.ConfigWindow_Events_ActionName.GetDescription()}##ActionName{info.GetHashCode()}", ref name, 100))
{
info.Name = name;
SaveConfig();
Service.Config.Save();
}

info.DisplayMacro();
Expand Down Expand Up @@ -527,7 +527,7 @@ public static bool IsInRect(Vector2 leftTop, Vector2 size)
ConfigUnitType.Degree => " °",
ConfigUnitType.Pixels => " p",
ConfigUnitType.Yalms => " y",
ConfigUnitType.Percent => " %",
ConfigUnitType.Percent => " %%",
_ => string.Empty,
};

Expand All @@ -552,16 +552,4 @@ public static void Draw(this CombatType type)
ImGui.TextColored(ImGuiColors.DalamudRed, " None of PvE or PvP!");
}
}

private static void SaveConfig()
{
try
{
Service.Config.Save();
}
catch (Exception ex)
{
Svc.Log.Warning(ex, "Failed to save configuration.");
}
}
}

0 comments on commit 3a0854a

Please sign in to comment.