v1.0.2.0: Restore Hotbar Layout, fix config right-click menu, hotbar fallback

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-01-31 02:29:13 -05:00
parent c63c054c5b
commit 6e0eb32a24
11 changed files with 101 additions and 16 deletions
+57 -1
View File
@@ -1,6 +1,7 @@
using HSUI.Config;
using HSUI.Config.Attributes;
using HSUI.Enums;
using HSUI.Helpers;
using HSUI.Interface;
using System.Numerics;
using Dalamud.Bindings.ImGui;
@@ -83,7 +84,7 @@ namespace HSUI.Interface.GeneralElements
return config;
}
protected static void ApplyDefaults(HotbarBarConfig config, int hotbarIndex)
public static void ApplyDefaults(HotbarBarConfig config, int hotbarIndex)
{
var viewport = ImGui.GetMainViewport().Size;
float yOffset = 60 + (hotbarIndex - 1) * 50;
@@ -106,7 +107,62 @@ namespace HSUI.Interface.GeneralElements
[NestedConfig("Drag & Drop Options", 5, separator = true, collapseWith = null)]
public HotbarsGeneralOptionsConfig GeneralOptions = new();
[ManualDraw]
public bool DrawRestoreHotbarsButton(ref bool changed)
{
ImGuiHelper.DrawSeparator(2, 1);
if (ImGui.Button("Restore Hotbar Layout", new Vector2(200, 24)))
{
RestoreAllHotbarsToDefaults();
changed = true;
return true;
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Reset positions and re-enable all hotbars. Use if your hotbars disappeared after an update.");
return false;
}
public new static HotbarsConfig DefaultConfig() => new HotbarsConfig();
private static void RestoreAllHotbarsToDefaults()
{
var cfg = ConfigurationManager.Instance;
if (cfg == null) return;
var bars = new (HotbarBarConfig config, int index)[]
{
(cfg.GetConfigObject<Hotbar1BarConfig>(), 1),
(cfg.GetConfigObject<Hotbar2BarConfig>(), 2),
(cfg.GetConfigObject<Hotbar3BarConfig>(), 3),
(cfg.GetConfigObject<Hotbar4BarConfig>(), 4),
(cfg.GetConfigObject<Hotbar5BarConfig>(), 5),
(cfg.GetConfigObject<Hotbar6BarConfig>(), 6),
(cfg.GetConfigObject<Hotbar7BarConfig>(), 7),
(cfg.GetConfigObject<Hotbar8BarConfig>(), 8),
(cfg.GetConfigObject<Hotbar9BarConfig>(), 9),
(cfg.GetConfigObject<Hotbar10BarConfig>(), 10)
};
foreach (var (bar, idx) in bars)
{
if (bar == null) continue;
bar.Enabled = true;
HotbarBarConfig.ApplyDefaults(bar, idx);
}
var vis = cfg.GetConfigObject<HotbarsVisibilityConfig>();
if (vis != null)
{
var defaults = new VisibilityConfig();
vis.HotbarConfig1.CopyFrom(defaults);
vis.HotbarConfig2.CopyFrom(defaults);
vis.HotbarConfig3.CopyFrom(defaults);
vis.HotbarConfig4.CopyFrom(defaults);
vis.HotbarConfig5.CopyFrom(defaults);
vis.HotbarConfig6.CopyFrom(defaults);
vis.HotbarConfig7.CopyFrom(defaults);
vis.HotbarConfig8.CopyFrom(defaults);
vis.HotbarConfig9.CopyFrom(defaults);
vis.HotbarConfig10.CopyFrom(defaults);
}
}
}
public enum ComboHighlightLineStyle