working on simplifying the options creation

This commit is contained in:
Buurazu authored and GitHub committed 2021-11-19 21:10:03 -05:00
1 parent 2aee604fd1
commit 11e4b966dc
1 file changed
+54 -32
+54 -32
View File
@@ -65,7 +65,33 @@ function EID:buildColorArray()
table.sort(colorNameArray) table.sort(colorNameArray)
end end
function EID:AddHotkeySetting(category, isController, optionName, displayText, infoText) function EID:AddBooleanSetting(category, optionName, displayText, onText, offText, infoText)
if (type(infoText) == "string") then infoText = {infoText} end
MCM.AddSetting(
"EID",
category,
{
Type = ModConfigMenu.OptionType.BOOLEAN,
CurrentSetting = function()
return EID.Config[optionName]
end,
Display = function()
local onOff = offText
if EID.Config[optionName] then
onOff = onText
end
return displayText .. ": " .. onOff
end,
OnChange = function(currentBool)
EID.Config[optionName] = currentBool
end,
Info = infoText
}
)
end
function EID:AddHotkeySetting(category, optionName, displayText, infoText, isController)
if (type(infoText) == "string") then infoText = {infoText} end
local optionType = ModConfigMenu.OptionType.KEYBIND_KEYBOARD local optionType = ModConfigMenu.OptionType.KEYBIND_KEYBOARD
local hotkeyToString = InputHelper.KeyboardToString local hotkeyToString = InputHelper.KeyboardToString
local deviceString = "keyboard" local deviceString = "keyboard"
@@ -103,7 +129,7 @@ function EID:AddHotkeySetting(category, isController, optionName, displayText, i
end end
return "Press a button on your "..deviceString.." to change this setting.$newline$newline" .. keepSettingString .. "Press "..backString.." to go back and clear this setting." return "Press a button on your "..deviceString.." to change this setting.$newline$newline" .. keepSettingString .. "Press "..backString.." to go back and clear this setting."
end, end,
Info = {infoText} Info = infoText
} }
) )
end end
@@ -178,8 +204,8 @@ if MCMLoaded then
) )
-- Hide Key -- Hide Key
EID:AddHotkeySetting("General", false, "HideKey", "Toggle (Keyboard)", "Press this key to toggle the description display") EID:AddHotkeySetting("General", "HideKey", "Toggle (Keyboard)", "Press this key to toggle the description display", false)
EID:AddHotkeySetting("General", true, "HideButton", "Toggle (Controller)", "Press this button to toggle the description display (Left Stick or Right Stick recommended; most other buttons will not work)") EID:AddHotkeySetting("General", "HideButton", "Toggle (Controller)", "Press this button to toggle the description display (Left Stick or Right Stick recommended; most other buttons will not work)", true)
MCM.AddSpace("EID", "General") MCM.AddSpace("EID", "General")
@@ -1059,9 +1085,9 @@ if MCMLoaded then
return EID.Config["BagOfCraftingHideInBattle"] return EID.Config["BagOfCraftingHideInBattle"]
end, end,
Display = function() Display = function()
local onOff = "False" local onOff = "No"
if EID.Config["BagOfCraftingHideInBattle"] then if EID.Config["BagOfCraftingHideInBattle"] then
onOff = "True" onOff = "Yes"
end end
return "Hide in Battle: " .. onOff return "Hide in Battle: " .. onOff
end, end,
@@ -1072,31 +1098,19 @@ if MCMLoaded then
} }
) )
-- Bag of Crafting No Recipes Mode -- Bag of Crafting No Recipes Mode
MCM.AddSetting( EID:AddBooleanSetting("Crafting",
"EID", "BagOfCraftingSimplifiedMode",
"Crafting", "No Recipes Mode", "On", "Off",
{ "No Recipes Mode shows quality and item pool percentages instead of exact recipes, for a more intended experience")
Type = ModConfigMenu.OptionType.BOOLEAN, -- Bag of Crafting 8 icons toggle
CurrentSetting = function() EID:AddBooleanSetting("Crafting",
return EID.Config["BagOfCraftingSimplifiedMode"] "BagOfCraftingDisplayIcons",
end, "Show Recipes as", "8 Icons", "Groups",
Display = function() "Choose if you want recipes (and the Best Quality bag in No Recipes Mode) shown as 8 icons, or as grouped ingredients")
local onOff = "Off"
if EID.Config["BagOfCraftingSimplifiedMode"] then
onOff = "On"
end
return "No Recipes Mode: " .. onOff
end,
OnChange = function(currentBool)
EID.Config["BagOfCraftingSimplifiedMode"] = currentBool
end,
Info = {"No Recipes Mode shows quality and item pool percentages instead of exact recipes, for a more intended experience"}
}
)
MCM.AddSpace("EID", "Crafting") MCM.AddSpace("EID", "Crafting")
-- Bag of Crafting results -- Bag of Crafting results per page
MCM.AddSetting( MCM.AddSetting(
"EID", "EID",
"Crafting", "Crafting",
@@ -1180,11 +1194,19 @@ if MCMLoaded then
MCM.AddSpace("EID", "Crafting") MCM.AddSpace("EID", "Crafting")
EID:AddHotkeySetting("Crafting", false, "CraftingHideKey", "Toggle (Keyboard)", "Press this key to toggle the crafting display, allowing you to check descriptions of items/pickups on the floor") EID:AddHotkeySetting("Crafting",
EID:AddHotkeySetting("Crafting", true, "CraftingHideButton", "Toggle (Controller)", "Press this button to toggle the crafting display (Left Stick or Right Stick recommended; most other buttons will not work)") "CraftingHideKey", "Toggle (Keyboard)",
"Press this key to toggle the crafting display, allowing you to check descriptions of items/pickups on the floor", false)
EID:AddHotkeySetting("Crafting",
"CraftingHideButton", "Toggle (Controller)",
"Press this button to toggle the crafting display (Left Stick or Right Stick recommended; most other buttons will not work)", true)
EID:AddHotkeySetting("Crafting", false, "CraftingResultKey", "Result Toggle (Keyboard)", "Press this key to toggle the description of the item ready to be crafted") EID:AddHotkeySetting("Crafting",
EID:AddHotkeySetting("Crafting", true, "CraftingResultButton", "Result Toggle (Controller)", "Press this button to toggle the description of the item ready to be crafted (Left Stick or Right Stick recommended; most other buttons will not work)") "CraftingResultKey", "Result Toggle (Keyboard)",
"Press this key to toggle the description of the item ready to be crafted", false)
EID:AddHotkeySetting("Crafting",
"CraftingResultButton", "Result Toggle (Controller)",
"Press this button to toggle the description of the item ready to be crafted (Left Stick or Right Stick recommended; most other buttons will not work)", true)
MCM.AddSpace("EID", "Crafting") MCM.AddSpace("EID", "Crafting")
--------Clear bag--------- --------Clear bag---------