More fixes

This commit is contained in:
Tercio Jose
2024-07-11 15:43:43 -03:00
committed by andrew6180
parent d012c2c6d2
commit f7c52f821e
4 changed files with 55 additions and 2 deletions
+9
View File
@@ -755,6 +755,8 @@ local parseOptionsTypes = function(menuOptions)
widgetTable.type = "selectoutline"
elseif (widgetTable.type == "anchordropdown") then
widgetTable.type = "selectanchor"
elseif (widgetTable.type == "audiodropdown") then
widgetTable.type = "selectaudio"
elseif (widgetTable.type == "dropdown") then
widgetTable.type = "select"
@@ -1102,6 +1104,10 @@ function detailsFramework:BuildMenuVolatile(parent, menuOptions, xOffset, yOffse
elseif (widgetTable.type == "selectoutline") then
local func = detailsFramework:CreateOutlineListGenerator(widgetTable.set)
dropdown:SetFunction(func)
elseif (widgetTable.type == "selectaudio") then
local func = detailsFramework:CreateAudioListGenerator(widgetTable.set)
dropdown:SetFunction(func)
else
dropdown:SetFunction(widgetTable.values)
end
@@ -1352,6 +1358,9 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh
elseif (widgetTable.type == "selectoutline") then
dropdown = detailsFramework:CreateOutlineDropDown(parent, widgetTable.set, widgetTable.get(), widgetWidth or 140, widgetHeight or defaultHeight, nil, "$parentWidget" .. index, dropdownTemplate)
elseif (widgetTable.type == "selectaudio") then
dropdown = detailsFramework:CreateAudioDropDown(parent, widgetTable.set, widgetTable.get(), widgetWidth or 140, widgetHeight or defaultHeight, nil, "$parentWidget" .. index, dropdownTemplate)
else
dropdown = detailsFramework:NewDropDown(parent, nil, "$parentWidget" .. index, nil, widgetWidth or 140, widgetHeight or defaultHeight, widgetTable.values, widgetTable.get(), dropdownTemplate)
end
+40
View File
@@ -1206,6 +1206,40 @@ function DF:CreateAnchorPointListGenerator(callback)
return newGenerator
end
function DF:CreateAudioListGenerator(callback)
local newGenerator = function()
local dropdownOptions = {
{
label = "--x--x--",
value = "",
onclick = callback
}
}
--fetch all audio cues from the libsharedmedia
DF.AudioCues = {}
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
for audioName, audioPath in pairs(SharedMedia:HashTable("sound")) do
DF.AudioCues[#DF.AudioCues+1] = {audioName, audioPath}
end
--sort the audio cues by name
table.sort(DF.AudioCues, function(t1, t2) return t1[1] < t2[1] end)
for i, audioInfo in ipairs(DF.AudioCues) do
table.insert(dropdownOptions, {
label = audioInfo[1],
value = audioInfo[2],
onclick = callback
})
end
return dropdownOptions
end
return newGenerator
end
---create a dropdown object with a list of fonts
---@param parent frame
---@param callback function
@@ -1240,6 +1274,12 @@ function DF:CreateAnchorPointDropDown(parent, callback, default, width, height,
return dropDownObject
end
function DF:CreateAudioDropDown(parent, callback, default, width, height, member, name, template)
local func = DF:CreateAudioListGenerator(callback)
local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template)
return dropDownObject
end
---create a dropdown object
---@param parent frame
---@param func function
+2 -2
View File
@@ -19,8 +19,8 @@
local addonName, Details222 = ...
local version = GetBuildInfo()
Details.build_counter = 12802
Details.alpha_build_counter = 12802 --if this is higher than the regular counter, use it instead
Details.build_counter = 12803
Details.alpha_build_counter = 12803 --if this is higher than the regular counter, use it instead
Details.dont_open_news = true
Details.game_version = version
Details.userversion = version .. " " .. Details.build_counter
+4
View File
@@ -471,3 +471,7 @@ function Details:SchedulePetUpdate(seconds)
Details.Schedules.NewTimer(seconds, Details.UpdatePets, Details)
end
function Details:GetPetInfo(petGuid)
return petContainer.GetPetInfo(petGuid)
end