from retail
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -2701,6 +2701,10 @@ Private.author_option_media_controls = {
|
||||
font = "LSM30_Font"
|
||||
}
|
||||
|
||||
Private.author_option_media_itemControls = {
|
||||
sound = "WeakAurasMediaSound"
|
||||
}
|
||||
|
||||
Private.array_entry_name_types = {
|
||||
[-1] = L["Fixed Names"],
|
||||
[0] = L["Entry Order"],
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
WeakAurasMediaSound Widget
|
||||
|
||||
This code come from https://www.curseforge.com/wow/addons/libddi-1-0 by Funkeh under "Ace3 Style BSD" licence
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "WeakAurasMediaSound", 1
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then
|
||||
return
|
||||
end
|
||||
local L = WeakAuras.L
|
||||
local media = LibStub("LibSharedMedia-3.0")
|
||||
local prototype = LibStub("AceGUI-3.0-DropDown-ItemBase"):GetItemBase()
|
||||
|
||||
local ignore = {
|
||||
[" " ..L["Custom"]] = true,
|
||||
[" " ..L["Sound by Kit ID"]] = true,
|
||||
[L["None"]] = true
|
||||
}
|
||||
|
||||
local function updateToggle(self)
|
||||
if self.value then
|
||||
self.check:Show()
|
||||
else
|
||||
self.check:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function updateSndButton(self)
|
||||
local text = self.obj.text:GetText()
|
||||
if text == nil or ignore[text] then
|
||||
self.sndButton:Hide()
|
||||
else
|
||||
self.sndButton:Show()
|
||||
end
|
||||
end
|
||||
|
||||
local function onRelease(self)
|
||||
prototype.OnRelease(self)
|
||||
self:SetValue(nil)
|
||||
end
|
||||
|
||||
local function onClick(frame)
|
||||
local self = frame.obj
|
||||
if self.disabled then return end
|
||||
self.value = not self.value
|
||||
if self.value then
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
else
|
||||
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
|
||||
end
|
||||
updateToggle(self)
|
||||
self:Fire("OnValueChanged", self.value)
|
||||
end
|
||||
|
||||
local function setValue(self, value)
|
||||
self.value = value
|
||||
updateToggle(self)
|
||||
end
|
||||
|
||||
local function getValue(self)
|
||||
return self.value
|
||||
end
|
||||
|
||||
local function soundOnClick(self)
|
||||
local snd = media:Fetch("sound", self.sound:GetText())
|
||||
if snd then PlaySoundFile(snd, "Master") end
|
||||
end
|
||||
|
||||
local function constructor()
|
||||
local self = prototype.Create(Type)
|
||||
self.frame:SetScript("OnShow", updateSndButton)
|
||||
self.frame:SetScript("OnClick", onClick)
|
||||
self.SetValue = setValue
|
||||
self.GetValue = getValue
|
||||
self.OnRelease = onRelease
|
||||
local frame = self.frame
|
||||
|
||||
local sndButton = CreateFrame("Button", nil, frame)
|
||||
sndButton:SetWidth(16)
|
||||
sndButton:SetHeight(16)
|
||||
sndButton:SetPoint("RIGHT", frame, "RIGHT", -3, -1)
|
||||
sndButton:SetScript("OnClick", soundOnClick)
|
||||
sndButton.sound = frame.obj.text
|
||||
frame.sndButton = sndButton
|
||||
|
||||
local icon = sndButton:CreateTexture(nil, "BACKGROUND")
|
||||
icon:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\VoiceChat-Speaker") --"Interface\\Common\\VoiceChat-Speaker"
|
||||
icon:SetAllPoints(sndButton)
|
||||
|
||||
local highlight = sndButton:CreateTexture(nil, "HIGHLIGHT")
|
||||
highlight:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\VoiceChat-On") --"Interface\\Common\\VoiceChat-On"
|
||||
highlight:SetAllPoints(sndButton)
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
AceGUI:RegisterWidgetType(Type, constructor, Version)
|
||||
@@ -218,6 +218,7 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Sound"],
|
||||
order = 8.4,
|
||||
itemControl = "WeakAurasMediaSound",
|
||||
values = OptionsPrivate.Private.sound_types,
|
||||
sorting = OptionsPrivate.Private.SortOrderForValues(OptionsPrivate.Private.sound_types),
|
||||
disabled = function() return not data.actions.start.do_sound end,
|
||||
@@ -599,6 +600,7 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Sound"],
|
||||
order = 28.1,
|
||||
itemControl = "WeakAurasMediaSound",
|
||||
values = OptionsPrivate.Private.sound_types,
|
||||
sorting = OptionsPrivate.Private.SortOrderForValues(OptionsPrivate.Private.sound_types),
|
||||
disabled = function() return not data.actions.finish.do_sound end,
|
||||
|
||||
@@ -1016,6 +1016,7 @@ typeControlAdders = {
|
||||
end
|
||||
end,
|
||||
dialogControl = OptionsPrivate.Private.author_option_media_controls[option.mediaType],
|
||||
itemControl = OptionsPrivate.Private.author_option_media_itemControls[option.mediaType],
|
||||
order = order(),
|
||||
get = get(option, "default"),
|
||||
set = function(_, value)
|
||||
@@ -2346,6 +2347,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
elseif optionType == "media" then
|
||||
userOption.type = "select"
|
||||
userOption.dialogControl = OptionsPrivate.Private.author_option_media_controls[option.mediaType]
|
||||
userOption.itemControl = OptionsPrivate.Private.author_option_media_itemControls[option.mediaType]
|
||||
userOption.values = function()
|
||||
if option.mediaType == "sound" then
|
||||
return OptionsPrivate.Private.sound_file_types
|
||||
|
||||
@@ -581,6 +581,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
|
||||
width = WeakAuras.normalWidth,
|
||||
values = OptionsPrivate.Private.sound_types,
|
||||
sorting = OptionsPrivate.Private.SortOrderForValues(OptionsPrivate.Private.sound_types),
|
||||
itemControl = "WeakAurasMediaSound",
|
||||
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "sound", L["Differences"]),
|
||||
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound", propertyType, OptionsPrivate.Private.sound_types),
|
||||
order = order,
|
||||
|
||||
@@ -95,3 +95,4 @@ AceGUI-Widgets\AceGUIWidget-WeakAurasSpacer.lua
|
||||
AceGUI-Widgets\AceGuiWidget-WeakAurasProgressBar.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasSpinBox.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasInputFocus.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasMediaSound.lua
|
||||
|
||||
Reference in New Issue
Block a user