advanced setting for multiselect in raid; unload ammo more places

This commit is contained in:
Tyfon
2024-06-23 15:20:34 -07:00
parent 1654e8741e
commit bd004aea9f
7 changed files with 112 additions and 5 deletions

View File

@@ -66,6 +66,7 @@ namespace UIFixes
// Inventory
public static ConfigEntry<bool> EnableMultiSelect { get; set; }
public static ConfigEntry<bool> EnableMultiSelectInRaid { get; set; }
public static ConfigEntry<KeyboardShortcut> SelectionBoxKey { get; set; }
public static ConfigEntry<MultiSelectStrategy> MultiSelectStrat { get; set; }
public static ConfigEntry<bool> ShowMultiSelectDebug { get; set; } // Advanced
@@ -306,6 +307,15 @@ namespace UIFixes
null,
new ConfigurationManagerAttributes { })));
configEntries.Add(EnableMultiSelectInRaid = config.Bind(
InventorySection,
"Enable Multiselect In Raid",
true,
new ConfigDescription(
"Enable multiselect functionality in raid.",
null,
new ConfigurationManagerAttributes { IsAdvanced = true })));
configEntries.Add(SelectionBoxKey = config.Bind(
InventorySection,
"Selection Box Key",
@@ -564,6 +574,9 @@ namespace UIFixes
RecalcOrder(configEntries);
MakeExclusive(EnableMultiSelect, AutoOpenSortingTable);
MakeDependent(EnableMultiSelect, EnableMultiSelectInRaid);
MakeDependent(EnableMultiSelect, ShowMultiSelectDebug, false);
}
private static void RecalcOrder(List<ConfigEntryBase> configEntries)
@@ -604,5 +617,40 @@ namespace UIFixes
}
};
}
private static void MakeDependent(ConfigEntry<bool> primaryConfig, ConfigEntry<bool> dependentConfig, bool primaryEnablesDependent = true)
{
if (!primaryConfig.Value)
{
dependentConfig.Value = false;
if (dependentConfig.Description.Tags[0] is ConfigurationManagerAttributes attributes)
{
attributes.ReadOnly = true;
}
}
primaryConfig.SettingChanged += (_, _) =>
{
if (primaryConfig.Value)
{
if (primaryEnablesDependent)
{
dependentConfig.Value = true;
}
}
else
{
dependentConfig.Value = false;
}
};
dependentConfig.SettingChanged += (_, _) =>
{
if (!primaryConfig.Value)
{
dependentConfig.Value = false;
}
};
}
}
}