beta
This commit is contained in:
@@ -117,7 +117,7 @@ local properties = {
|
||||
display = L["Orientation"],
|
||||
setter = "SetOrientation",
|
||||
type = "list",
|
||||
values = WeakAuras.orientation_types
|
||||
values = Private.orientation_types
|
||||
},
|
||||
inverse = {
|
||||
display = L["Inverse"],
|
||||
@@ -129,10 +129,9 @@ local properties = {
|
||||
WeakAuras.regionPrototype.AddProperties(properties, default);
|
||||
|
||||
local function GetProperties(data)
|
||||
local overlayInfo = WeakAuras.GetOverlayInfo(data);
|
||||
local overlayInfo = Private.GetOverlayInfo(data);
|
||||
if (overlayInfo and next(overlayInfo)) then
|
||||
local auraProperties = {};
|
||||
WeakAuras.DeepCopy(properties, auraProperties);
|
||||
local auraProperties = CopyTable(properties)
|
||||
|
||||
for id, display in ipairs(overlayInfo) do
|
||||
auraProperties["overlays." .. id] = {
|
||||
@@ -758,11 +757,11 @@ local funcs = {
|
||||
|
||||
selfPoint = selfPoint or "CENTER"
|
||||
|
||||
if not WeakAuras.point_types[selfPoint] then
|
||||
if not Private.point_types[selfPoint] then
|
||||
selfPoint = "CENTER"
|
||||
end
|
||||
|
||||
if not WeakAuras.point_types[anchorPoint] then
|
||||
if not Private.point_types[anchorPoint] then
|
||||
anchorPoint = "CENTER"
|
||||
end
|
||||
|
||||
@@ -988,7 +987,7 @@ local function modify(parent, region, data)
|
||||
-- Localize
|
||||
local bar, iconFrame, icon = region.bar, region.iconFrame, region.icon;
|
||||
|
||||
region.useAuto = data.auto and WeakAuras.CanHaveAuto(data);
|
||||
region.useAuto = data.auto and Private.CanHaveAuto(data);
|
||||
|
||||
-- Adjust region size
|
||||
region:SetWidth(data.width);
|
||||
@@ -1012,9 +1011,10 @@ local function modify(parent, region, data)
|
||||
region.desaturateIcon = data.desaturate
|
||||
region.zoom = data.zoom
|
||||
|
||||
region.overlays = {};
|
||||
if (data.overlays) then
|
||||
WeakAuras.DeepCopy(data.overlays, region.overlays);
|
||||
region.overlays = CopyTable(data.overlays);
|
||||
else
|
||||
region.overlays = {}
|
||||
end
|
||||
|
||||
-- Update texture settings
|
||||
@@ -1084,16 +1084,16 @@ local function modify(parent, region, data)
|
||||
region:UpdateEffectiveOrientation()
|
||||
|
||||
-- Update tooltip availability
|
||||
local tooltipType = WeakAuras.CanHaveTooltip(data);
|
||||
local tooltipType = Private.CanHaveTooltip(data);
|
||||
if tooltipType and data.useTooltip then
|
||||
-- Create and enable tooltip-hover frame
|
||||
if not region.tooltipFrame then
|
||||
region.tooltipFrame = CreateFrame("frame", nil, region);
|
||||
region.tooltipFrame:SetAllPoints(icon);
|
||||
region.tooltipFrame:SetScript("OnEnter", function()
|
||||
WeakAuras.ShowMouseoverTooltip(region, region.tooltipFrame);
|
||||
Private.ShowMouseoverTooltip(region, region.tooltipFrame);
|
||||
end);
|
||||
region.tooltipFrame:SetScript("OnLeave", WeakAuras.HideTooltip);
|
||||
region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip);
|
||||
end
|
||||
|
||||
region.tooltipFrame:EnableMouse(true);
|
||||
|
||||
@@ -95,7 +95,7 @@ local function releaseControlPoint(self, controlPoint)
|
||||
local regionData = controlPoint.regionData
|
||||
if regionData then
|
||||
if self.parent.anchorPerUnit == "UNITFRAME" then
|
||||
WeakAuras.dyngroup_unitframe_monitor[regionData] = nil
|
||||
Private.dyngroup_unitframe_monitor[regionData] = nil
|
||||
end
|
||||
controlPoint.regionData = nil
|
||||
regionData.controlPoint = nil
|
||||
@@ -760,7 +760,7 @@ local function SafeGetPos(region, func)
|
||||
end
|
||||
|
||||
local function modify(parent, region, data)
|
||||
WeakAuras.FixGroupChildrenOrderForGroup(data)
|
||||
Private.FixGroupChildrenOrderForGroup(data)
|
||||
-- Scale
|
||||
region:SetScale(data.scale and data.scale > 0 and data.scale or 1)
|
||||
WeakAuras.regionPrototype.modify(parent, region, data)
|
||||
@@ -854,7 +854,7 @@ local function modify(parent, region, data)
|
||||
local frameStrata = region:GetFrameStrata()
|
||||
childRegion:SetFrameStrata(frameStrata ~= "UNKNOWN" and frameStrata or "BACKGROUND");
|
||||
else
|
||||
childRegion:SetFrameStrata(WeakAuras.frame_strata_types[childData.frameStrata]);
|
||||
childRegion:SetFrameStrata(Private.frame_strata_types[childData.frameStrata]);
|
||||
end
|
||||
return regionData
|
||||
end
|
||||
@@ -877,8 +877,8 @@ local function modify(parent, region, data)
|
||||
function region:ReloadControlledChildren()
|
||||
-- 'forgets' about regions it controls and starts from scratch. Mostly useful when Add()ing the group
|
||||
if not self:IsSuspended() then
|
||||
WeakAuras.StartProfileSystem("dynamicgroup")
|
||||
WeakAuras.StartProfileAura(data.id)
|
||||
Private.StartProfileSystem("dynamicgroup")
|
||||
Private.StartProfileAura(data.id)
|
||||
self.needToReload = false
|
||||
self.sortedChildren = {}
|
||||
self.controlledChildren = {}
|
||||
@@ -903,8 +903,8 @@ local function modify(parent, region, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
WeakAuras.StopProfileSystem("dynamicgroup")
|
||||
WeakAuras.StopProfileAura(data.id)
|
||||
Private.StopProfileSystem("dynamicgroup")
|
||||
Private.StopProfileAura(data.id)
|
||||
self:SortUpdatedChildren()
|
||||
else
|
||||
self.needToReload = true
|
||||
@@ -976,8 +976,8 @@ local function modify(parent, region, data)
|
||||
-- Called when the Group is Resume()d
|
||||
-- uses sort data to determine the correct spot
|
||||
if not self:IsSuspended() then
|
||||
WeakAuras.StartProfileSystem("dynamicgroup")
|
||||
WeakAuras.StartProfileAura(data.id)
|
||||
Private.StartProfileSystem("dynamicgroup")
|
||||
Private.StartProfileAura(data.id)
|
||||
self.needToSort = false
|
||||
local i = 1
|
||||
while self.sortedChildren[i] do
|
||||
@@ -1006,8 +1006,8 @@ local function modify(parent, region, data)
|
||||
end
|
||||
end
|
||||
self.updatedChildren = {}
|
||||
WeakAuras.StopProfileSystem("dynamicgroup")
|
||||
WeakAuras.StopProfileAura(data.id)
|
||||
Private.StopProfileSystem("dynamicgroup")
|
||||
Private.StopProfileAura(data.id)
|
||||
self:PositionChildren()
|
||||
else
|
||||
self.needToSort = true
|
||||
@@ -1063,10 +1063,10 @@ local function modify(parent, region, data)
|
||||
controlPoint:SetWidth(regionData.dimensions.width)
|
||||
controlPoint:SetHeight(regionData.dimensions.height)
|
||||
if self.anchorPerUnit == "UNITFRAME" then
|
||||
WeakAuras.dyngroup_unitframe_monitor[regionData] = frame
|
||||
Private.dyngroup_unitframe_monitor[regionData] = frame
|
||||
end
|
||||
if animate then
|
||||
WeakAuras.CancelAnimation(regionData.controlPoint, true)
|
||||
Private.CancelAnimation(regionData.controlPoint, true)
|
||||
local xPrev = regionData.xOffset or x
|
||||
local yPrev = regionData.yOffset or y
|
||||
local xDelta = xPrev - x
|
||||
@@ -1137,7 +1137,7 @@ local function modify(parent, region, data)
|
||||
}
|
||||
end
|
||||
-- update animated expand & collapse for this child
|
||||
WeakAuras.Animate("controlPoint", data.uid, "controlPoint", anim, regionData.controlPoint, true)
|
||||
Private.Animate("controlPoint", data.uid, "controlPoint", anim, regionData.controlPoint, true)
|
||||
end
|
||||
end
|
||||
regionData.xOffset = x
|
||||
@@ -1147,8 +1147,8 @@ local function modify(parent, region, data)
|
||||
end
|
||||
|
||||
function region:DoPositionChildren()
|
||||
WeakAuras.StartProfileSystem("dynamicgroup")
|
||||
WeakAuras.StartProfileAura(data.id)
|
||||
Private.StartProfileSystem("dynamicgroup")
|
||||
Private.StartProfileAura(data.id)
|
||||
|
||||
local handledRegionData = {}
|
||||
|
||||
@@ -1179,8 +1179,8 @@ local function modify(parent, region, data)
|
||||
end
|
||||
end
|
||||
|
||||
WeakAuras.StopProfileSystem("dynamicgroup")
|
||||
WeakAuras.StopProfileAura(data.id)
|
||||
Private.StopProfileSystem("dynamicgroup")
|
||||
Private.StopProfileAura(data.id)
|
||||
self:Resize()
|
||||
end
|
||||
|
||||
@@ -1190,8 +1190,8 @@ local function modify(parent, region, data)
|
||||
if not self:IsSuspended() then
|
||||
self.needToResize = false
|
||||
-- if self.dynamicAnchor then self:UpdateBorder(); return end
|
||||
WeakAuras.StartProfileSystem("dynamicgroup")
|
||||
WeakAuras.StartProfileAura(data.id)
|
||||
Private.StartProfileSystem("dynamicgroup")
|
||||
Private.StartProfileAura(data.id)
|
||||
local numVisible, minX, maxX, maxY, minY, minLevel = 0
|
||||
for active, regionData in ipairs(self.sortedChildren) do
|
||||
if regionData.shown then
|
||||
@@ -1231,8 +1231,8 @@ local function modify(parent, region, data)
|
||||
if WeakAuras.IsOptionsOpen() then
|
||||
WeakAuras.OptionsFrame().moversizer:ReAnchor()
|
||||
end
|
||||
WeakAuras.StopProfileSystem("dynamicgroup")
|
||||
WeakAuras.StopProfileAura(data.id)
|
||||
Private.StopProfileSystem("dynamicgroup")
|
||||
Private.StopProfileAura(data.id)
|
||||
else
|
||||
self.needToResize = true
|
||||
end
|
||||
|
||||
@@ -110,7 +110,7 @@ local function modify(parent, region, data)
|
||||
region.try = highest;
|
||||
|
||||
-- Adjust frame-level sorting
|
||||
WeakAuras.FixGroupChildrenOrderForGroup(data);
|
||||
Private.FixGroupChildrenOrderForGroup(data);
|
||||
|
||||
-- Control children (does not happen with "group")
|
||||
function region:UpdateBorder(childRegion)
|
||||
|
||||
@@ -145,11 +145,11 @@ local function AnchorSubRegion(self, subRegion, anchorType, selfPoint, anchorPoi
|
||||
anchorXOffset = anchorXOffset or 0
|
||||
anchorYOffset = anchorYOffset or 0
|
||||
|
||||
if not WeakAuras.point_types[selfPoint] then
|
||||
if not Private.point_types[selfPoint] then
|
||||
selfPoint = "CENTER"
|
||||
end
|
||||
|
||||
if not WeakAuras.point_types[anchorPoint] then
|
||||
if not Private.point_types[anchorPoint] then
|
||||
anchorPoint = "CENTER"
|
||||
end
|
||||
|
||||
@@ -256,7 +256,7 @@ local function modify(parent, region, data)
|
||||
|
||||
local button, icon, cooldown = region.button, region.icon, region.cooldown;
|
||||
|
||||
region.useAuto = data.auto and WeakAuras.CanHaveAuto(data);
|
||||
region.useAuto = data.auto and Private.CanHaveAuto(data);
|
||||
|
||||
if MSQ then
|
||||
local masqueId = data.id:lower():gsub(" ", "_");
|
||||
@@ -331,15 +331,15 @@ local function modify(parent, region, data)
|
||||
region.zoom = data.zoom;
|
||||
region:UpdateSize()
|
||||
|
||||
local tooltipType = WeakAuras.CanHaveTooltip(data);
|
||||
local tooltipType = Private.CanHaveTooltip(data);
|
||||
if(tooltipType and data.useTooltip) then
|
||||
if not region.tooltipFrame then
|
||||
region.tooltipFrame = CreateFrame("frame", nil, region);
|
||||
region.tooltipFrame:SetAllPoints(region);
|
||||
region.tooltipFrame:SetScript("OnEnter", function()
|
||||
WeakAuras.ShowMouseoverTooltip(region, region);
|
||||
Private.ShowMouseoverTooltip(region, region);
|
||||
end);
|
||||
region.tooltipFrame:SetScript("OnLeave", WeakAuras.HideTooltip);
|
||||
region.tooltipFrame:SetScript("OnLeave", Private.HideTooltip);
|
||||
end
|
||||
region.tooltipFrame:EnableMouse(true);
|
||||
elseif region.tooltipFrame then
|
||||
|
||||
@@ -120,11 +120,11 @@ local function AcquireModel(region, data)
|
||||
model:RegisterEvent("PLAYER_FOCUS_CHANGED");
|
||||
end
|
||||
model:SetScript("OnEvent", function(self, event, unitId)
|
||||
WeakAuras.StartProfileSystem("model");
|
||||
Private.StartProfileSystem("model");
|
||||
if (event ~= "UNIT_MODEL_CHANGED" or UnitIsUnit(unitId, data.model_path)) then
|
||||
WeakAuras.SetModel(model, data.model_path, data.modelIsUnit, data.modelDisplayInfo)
|
||||
end
|
||||
WeakAuras.StopProfileSystem("model");
|
||||
Private.StopProfileSystem("model");
|
||||
end
|
||||
);
|
||||
else
|
||||
@@ -138,10 +138,10 @@ local function AcquireModel(region, data)
|
||||
if(data.advance) then
|
||||
local elapsed = 0;
|
||||
model:SetScript("OnUpdate", function(self, elaps)
|
||||
WeakAuras.StartProfileSystem("model");
|
||||
Private.StartProfileSystem("model");
|
||||
elapsed = elapsed + (elaps * 1000);
|
||||
model:SetSequenceTime(data.sequence, elapsed);
|
||||
WeakAuras.StopProfileSystem("model");
|
||||
Private.StopProfileSystem("model");
|
||||
end)
|
||||
else
|
||||
model:SetScript("OnUpdate", nil)
|
||||
@@ -263,18 +263,18 @@ end
|
||||
|
||||
-- Work around for movies and world map hiding all models
|
||||
do
|
||||
function WeakAuras.PreShowModels(self, event)
|
||||
WeakAuras.StartProfileSystem("model");
|
||||
function Private.PreShowModels(self, event)
|
||||
Private.StartProfileSystem("model");
|
||||
for id, data in pairs(WeakAuras.regions) do
|
||||
WeakAuras.StartProfileAura(id);
|
||||
Private.StartProfileAura(id);
|
||||
if data.region.toShow then
|
||||
if (data.regionType == "model") then
|
||||
data.region:PreShow();
|
||||
end
|
||||
end
|
||||
WeakAuras.StopProfileAura(id);
|
||||
Private.StopProfileAura(id);
|
||||
end
|
||||
WeakAuras.StopProfileSystem("model");
|
||||
Private.StopProfileSystem("model");
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ end
|
||||
|
||||
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
|
||||
|
||||
function WeakAuras.GetAnchorsForData(parentData, type)
|
||||
function Private.GetAnchorsForData(parentData, type)
|
||||
local result
|
||||
if not parentData.controlledChildren then
|
||||
if not WeakAuras.regionOptions[parentData.regionType] or not WeakAuras.regionOptions[parentData.regionType].getAnchors then
|
||||
@@ -139,8 +139,8 @@ function WeakAuras.regionPrototype:AnchorSubRegion(subRegion, anchorType, selfPo
|
||||
if anchorType == "point" then
|
||||
local xOffset = anchorXOffset or 0
|
||||
local yOffset = anchorYOffset or 0
|
||||
subRegion:SetPoint(WeakAuras.point_types[selfPoint] and selfPoint or "CENTER",
|
||||
self, WeakAuras.point_types[anchorPoint] and anchorPoint or "CENTER",
|
||||
subRegion:SetPoint(Private.point_types[selfPoint] and selfPoint or "CENTER",
|
||||
self, Private.point_types[anchorPoint] and anchorPoint or "CENTER",
|
||||
xOffset, yOffset)
|
||||
else
|
||||
anchorXOffset = anchorXOffset or 0
|
||||
@@ -203,46 +203,46 @@ function WeakAuras.regionPrototype.AddProperties(properties, defaultsForRegion)
|
||||
end
|
||||
|
||||
local function SoundRepeatStop(self)
|
||||
WeakAuras.StartProfileSystem("sound");
|
||||
Private.StartProfileSystem("sound");
|
||||
if (self.soundRepeatTimer) then
|
||||
WeakAuras.timer:CancelTimer(self.soundRepeatTimer);
|
||||
self.soundRepeatTimer = nil;
|
||||
end
|
||||
WeakAuras.StopProfileSystem("sound");
|
||||
Private.StopProfileSystem("sound");
|
||||
end
|
||||
|
||||
local function SoundPlayHelper(self)
|
||||
WeakAuras.StartProfileSystem("sound");
|
||||
Private.StartProfileSystem("sound");
|
||||
local options = self.soundOptions;
|
||||
if (not options or options.sound_type == "Stop") then
|
||||
WeakAuras.StopProfileSystem("sound");
|
||||
Private.StopProfileSystem("sound");
|
||||
return;
|
||||
end
|
||||
|
||||
if (WeakAuras.IsOptionsOpen() or WeakAuras.SquelchingActions()) then
|
||||
WeakAuras.StopProfileSystem("sound");
|
||||
if (WeakAuras.IsOptionsOpen() or Private.SquelchingActions()) then
|
||||
Private.StopProfileSystem("sound");
|
||||
return;
|
||||
end
|
||||
|
||||
if (options.sound == " custom") then
|
||||
if (options.sound_path) then
|
||||
PlaySoundFile(options.sound_path, options.sound_channel or "Master");
|
||||
pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master");
|
||||
end
|
||||
elseif (options.sound == " KitID") then
|
||||
if (options.sound_kit_id) then
|
||||
PlaySound(options.sound_kit_id, options.sound_channel or "Master");
|
||||
pcall(PlaySound, options.sound_kit_id, options.sound_channel or "Master");
|
||||
end
|
||||
else
|
||||
PlaySoundFile(options.sound, options.sound_channel or "Master");
|
||||
pcall(PlaySoundFile, options.sound, options.sound_channel or "Master");
|
||||
end
|
||||
WeakAuras.StopProfileSystem("sound");
|
||||
Private.StopProfileSystem("sound");
|
||||
end
|
||||
|
||||
local function SoundPlay(self, options)
|
||||
if (not options or WeakAuras.IsOptionsOpen()) then
|
||||
return
|
||||
end
|
||||
WeakAuras.StartProfileSystem("sound");
|
||||
Private.StartProfileSystem("sound");
|
||||
self:SoundRepeatStop();
|
||||
|
||||
self.soundOptions = options;
|
||||
@@ -252,7 +252,7 @@ local function SoundPlay(self, options)
|
||||
if (loop and options.sound_repeat) then
|
||||
self.soundRepeatTimer = WeakAuras.timer:ScheduleRepeatingTimer(SoundPlayHelper, options.sound_repeat, self);
|
||||
end
|
||||
WeakAuras.StopProfileSystem("sound");
|
||||
Private.StopProfileSystem("sound");
|
||||
end
|
||||
|
||||
local function SendChat(self, options)
|
||||
@@ -260,7 +260,7 @@ local function SendChat(self, options)
|
||||
return
|
||||
end
|
||||
|
||||
WeakAuras.HandleChatAction(options.message_type, options.message, options.message_dest, options.message_channel, options.r, options.g, options.b, self, options.message_custom, nil, options.message_formaters);
|
||||
Private.HandleChatAction(options.message_type, options.message, options.message_dest, options.message_channel, options.r, options.g, options.b, self, options.message_custom, nil, options.message_formaters);
|
||||
end
|
||||
|
||||
local function RunCode(self, func)
|
||||
@@ -275,7 +275,7 @@ local function GlowExternal(self, options)
|
||||
if (not options or WeakAuras.IsOptionsOpen()) then
|
||||
return
|
||||
end
|
||||
WeakAuras.HandleGlowAction(options, self)
|
||||
Private.HandleGlowAction(options, self)
|
||||
end
|
||||
|
||||
local function UpdatePosition(self)
|
||||
@@ -423,11 +423,23 @@ local function UpdateRegionHasTimerTick(self)
|
||||
self:UpdateTimerTick()
|
||||
end
|
||||
|
||||
local function TimerTickForRegion(region)
|
||||
Private.StartProfileSystem("timer tick")
|
||||
Private.StartProfileAura(region.id);
|
||||
if region.TimerTick then
|
||||
region:TimerTick();
|
||||
end
|
||||
|
||||
region.subRegionEvents:Notify("TimerTick")
|
||||
Private.StopProfileAura(region.id);
|
||||
Private.StopProfileSystem("timer tick")
|
||||
end
|
||||
|
||||
local function UpdateTimerTick(self)
|
||||
if self.triggerProvidesTimer and self.regionHasTimer then
|
||||
if not self:GetScript("OnUpdate") then
|
||||
self:SetScript("OnUpdate", function()
|
||||
WeakAuras.TimerTick(self)
|
||||
TimerTickForRegion(self)
|
||||
end);
|
||||
end
|
||||
else
|
||||
@@ -536,11 +548,11 @@ function WeakAuras.regionPrototype.modify(parent, region, data)
|
||||
or data.regionType == "dynamicgroup"
|
||||
or data.regionType == "group"
|
||||
then
|
||||
WeakAuras.AnchorFrame(data, region, parent);
|
||||
Private.AnchorFrame(data, region, parent);
|
||||
end
|
||||
end
|
||||
|
||||
region.startFormatters = WeakAuras.CreateFormatters(data.actions.start.message, function(key, default)
|
||||
region.startFormatters = Private.CreateFormatters(data.actions.start.message, function(key, default)
|
||||
local fullKey = "message_format_" .. key
|
||||
if data.actions.start[fullKey] == nil then
|
||||
data.actions.start[fullKey] = default
|
||||
@@ -548,7 +560,7 @@ function WeakAuras.regionPrototype.modify(parent, region, data)
|
||||
return data.actions.start[fullKey]
|
||||
end)
|
||||
|
||||
region.finishFormatters = WeakAuras.CreateFormatters(data.actions.finish.message, function(key, default)
|
||||
region.finishFormatters = Private.CreateFormatters(data.actions.finish.message, function(key, default)
|
||||
local fullKey = "message_format_" .. key
|
||||
if data.actions.finish[fullKey] == nil then
|
||||
data.actions.finish[fullKey] = default
|
||||
@@ -561,7 +573,7 @@ function WeakAuras.regionPrototype.modifyFinish(parent, region, data)
|
||||
-- Sync subRegions
|
||||
if region.subRegions then
|
||||
for index, subRegion in pairs(region.subRegions) do
|
||||
WeakAuras.subRegionTypes[subRegion.type].release(subRegion)
|
||||
Private.subRegionTypes[subRegion.type].release(subRegion)
|
||||
end
|
||||
|
||||
wipe(region.subRegions)
|
||||
@@ -571,12 +583,12 @@ function WeakAuras.regionPrototype.modifyFinish(parent, region, data)
|
||||
region.subRegions = region.subRegions or {}
|
||||
local subRegionTypes = {}
|
||||
for index, subRegionData in pairs(data.subRegions) do
|
||||
if WeakAuras.subRegionTypes[subRegionData.type] then
|
||||
local subRegion = WeakAuras.subRegionTypes[subRegionData.type].acquire()
|
||||
if Private.subRegionTypes[subRegionData.type] then
|
||||
local subRegion = Private.subRegionTypes[subRegionData.type].acquire()
|
||||
subRegion.type = subRegionData.type
|
||||
|
||||
if subRegion then
|
||||
WeakAuras.subRegionTypes[subRegionData.type].modify(region, subRegion, data, subRegionData, not subRegionTypes[subRegionData.type])
|
||||
Private.subRegionTypes[subRegionData.type].modify(region, subRegion, data, subRegionData, not subRegionTypes[subRegionData.type])
|
||||
subRegionTypes[subRegionData.type] = true
|
||||
end
|
||||
|
||||
@@ -587,7 +599,7 @@ function WeakAuras.regionPrototype.modifyFinish(parent, region, data)
|
||||
|
||||
region:UpdateRegionHasTimerTick()
|
||||
|
||||
WeakAuras.ApplyFrameLevel(region)
|
||||
Private.ApplyFrameLevel(region)
|
||||
end
|
||||
|
||||
local function SetProgressValue(region, value, total)
|
||||
@@ -597,25 +609,29 @@ local function SetProgressValue(region, value, total)
|
||||
region:SetValue(value - adjustMin, max - adjustMin);
|
||||
end
|
||||
|
||||
function WeakAuras.TimerTick(region)
|
||||
WeakAuras.StartProfileSystem("timer tick")
|
||||
WeakAuras.StartProfileAura(region.id);
|
||||
if region.TimerTick then
|
||||
region:TimerTick();
|
||||
end
|
||||
|
||||
region.subRegionEvents:Notify("TimerTick")
|
||||
WeakAuras.StopProfileAura(region.id);
|
||||
WeakAuras.StopProfileSystem("timer tick")
|
||||
end
|
||||
|
||||
local regionsForFrameTick = {}
|
||||
|
||||
local frameForFrameTick = CreateFrame("FRAME");
|
||||
|
||||
WeakAuras.frames["Frame Tick Frame"] = frameForFrameTick
|
||||
|
||||
function WeakAuras.RegisterForFrameTick(region)
|
||||
local function FrameTick()
|
||||
if WeakAuras.IsOptionsOpen() then
|
||||
return
|
||||
end
|
||||
Private.StartProfileSystem("frame tick")
|
||||
for region in pairs(regionsForFrameTick) do
|
||||
Private.StartProfileAura(region.id);
|
||||
if region.FrameTick then
|
||||
region.FrameTick()
|
||||
end
|
||||
region.subRegionEvents:Notify("FrameTick")
|
||||
Private.StopProfileAura(region.id);
|
||||
end
|
||||
Private.StopProfileSystem("frame tick")
|
||||
end
|
||||
|
||||
local function RegisterForFrameTick(region)
|
||||
-- Check for a Frame Tick function
|
||||
local hasFrameTick = region.FrameTick
|
||||
if not hasFrameTick then
|
||||
@@ -639,30 +655,14 @@ function WeakAuras.RegisterForFrameTick(region)
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.UnRegisterForFrameTick(region)
|
||||
local function UnRegisterForFrameTick(region)
|
||||
regionsForFrameTick[region] = nil
|
||||
if not next(regionsForFrameTick) then
|
||||
frameForFrameTick:SetScript("OnUpdate", nil)
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.FrameTick()
|
||||
if WeakAuras.IsOptionsOpen() then
|
||||
return
|
||||
end
|
||||
WeakAuras.StartProfileSystem("frame tick")
|
||||
for region in pairs(regionsForFrameTick) do
|
||||
WeakAuras.StartProfileAura(region.id);
|
||||
if region.FrameTick then
|
||||
region.FrameTick()
|
||||
end
|
||||
region.subRegionEvents:Notify("FrameTick")
|
||||
WeakAuras.StopProfileAura(region.id);
|
||||
end
|
||||
WeakAuras.StopProfileSystem("frame tick")
|
||||
end
|
||||
|
||||
local function TimerTick(self)
|
||||
local function TimerTickForSetDuration(self)
|
||||
local duration = self.duration
|
||||
local adjustMin = self.adjustedMin or 0;
|
||||
|
||||
@@ -697,7 +697,7 @@ function WeakAuras.regionPrototype.AddSetDurationInfo(region)
|
||||
local adjustMin = region.adjustedMin or 0;
|
||||
region:SetTime((duration ~= 0 and region.adjustedMax or duration) - adjustMin, expirationTime - adjustMin, inverse);
|
||||
|
||||
region.TimerTick = TimerTick
|
||||
region.TimerTick = TimerTickForSetDuration
|
||||
region:UpdateRegionHasTimerTick()
|
||||
end
|
||||
end
|
||||
@@ -714,7 +714,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
|
||||
local inGroup = parentRegionType == "group";
|
||||
|
||||
local startMainAnimation = function()
|
||||
WeakAuras.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true, cloneId);
|
||||
Private.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true, cloneId);
|
||||
end
|
||||
|
||||
function region:OptionsClosed()
|
||||
@@ -769,8 +769,8 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
|
||||
region.toShow = false;
|
||||
region:SetScript("OnUpdate", nil)
|
||||
|
||||
WeakAuras.PerformActions(data, "finish", region);
|
||||
if (not WeakAuras.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then
|
||||
Private.PerformActions(data, "finish", region);
|
||||
if (not Private.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then
|
||||
hideRegion();
|
||||
end
|
||||
|
||||
@@ -778,7 +778,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
|
||||
region:SoundRepeatStop();
|
||||
end
|
||||
|
||||
WeakAuras.UnRegisterForFrameTick(region)
|
||||
UnRegisterForFrameTick(region)
|
||||
end
|
||||
function region:Expand()
|
||||
if (region.toShow) then
|
||||
@@ -792,15 +792,15 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
|
||||
region.subRegionEvents:Notify("PreShow")
|
||||
|
||||
region.justCreated = nil;
|
||||
WeakAuras.ApplyFrameLevel(region)
|
||||
Private.ApplyFrameLevel(region)
|
||||
region:Show();
|
||||
WeakAuras.PerformActions(data, "start", region);
|
||||
if not(WeakAuras.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then
|
||||
Private.PerformActions(data, "start", region);
|
||||
if not(Private.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then
|
||||
startMainAnimation();
|
||||
end
|
||||
parent:ActivateChild(data.id, cloneId);
|
||||
|
||||
WeakAuras.RegisterForFrameTick(region)
|
||||
RegisterForFrameTick(region)
|
||||
region:UpdateTimerTick()
|
||||
end
|
||||
elseif not(data.controlledChildren) then
|
||||
@@ -811,8 +811,8 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
|
||||
region.toShow = false;
|
||||
region:SetScript("OnUpdate", nil)
|
||||
|
||||
WeakAuras.PerformActions(data, "finish", region);
|
||||
if (not WeakAuras.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then
|
||||
Private.PerformActions(data, "finish", region);
|
||||
if (not Private.Animate("display", data.uid, "finish", data.animation.finish, region, false, hideRegion, nil, cloneId)) then
|
||||
hideRegion();
|
||||
end
|
||||
|
||||
@@ -824,14 +824,14 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
|
||||
region:SoundRepeatStop();
|
||||
end
|
||||
|
||||
WeakAuras.UnRegisterForFrameTick(region)
|
||||
UnRegisterForFrameTick(region)
|
||||
end
|
||||
function region:Expand()
|
||||
if data.anchorFrameType == "SELECTFRAME"
|
||||
or data.anchorFrameType == "CUSTOM"
|
||||
or data.anchorFrameType == "UNITFRAME"
|
||||
then
|
||||
WeakAuras.AnchorFrame(data, region, parent);
|
||||
Private.AnchorFrame(data, region, parent);
|
||||
end
|
||||
|
||||
if (region.toShow) then
|
||||
@@ -846,10 +846,10 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
|
||||
|
||||
region.subRegionEvents:Notify("PreShow")
|
||||
|
||||
WeakAuras.ApplyFrameLevel(region)
|
||||
Private.ApplyFrameLevel(region)
|
||||
region:Show();
|
||||
WeakAuras.PerformActions(data, "start", region);
|
||||
if not(WeakAuras.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then
|
||||
Private.PerformActions(data, "start", region);
|
||||
if not(Private.Animate("display", data.uid, "start", data.animation.start, region, true, startMainAnimation, nil, cloneId)) then
|
||||
startMainAnimation();
|
||||
end
|
||||
|
||||
@@ -857,7 +857,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
|
||||
parent:UpdateBorder(region);
|
||||
end
|
||||
|
||||
WeakAuras.RegisterForFrameTick(region)
|
||||
RegisterForFrameTick(region)
|
||||
region:UpdateTimerTick()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -274,13 +274,13 @@ local function modify(parent, region, data)
|
||||
local function onUpdate()
|
||||
if (not region.startTime) then return end
|
||||
|
||||
WeakAuras.StartProfileAura(region.id);
|
||||
WeakAuras.StartProfileSystem("stopmotion")
|
||||
Private.StartProfileAura(region.id);
|
||||
Private.StartProfileSystem("stopmotion")
|
||||
local timeSinceStart = (GetTime() - region.startTime);
|
||||
local newCurrentFrame = floor(timeSinceStart * (data.frameRate or 15));
|
||||
if (newCurrentFrame == region.currentFrame) then
|
||||
WeakAuras.StopProfileAura(region.id);
|
||||
WeakAuras.StopProfileSystem("stopmotion")
|
||||
Private.StopProfileAura(region.id);
|
||||
Private.StopProfileSystem("stopmotion")
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -339,8 +339,8 @@ local function modify(parent, region, data)
|
||||
end
|
||||
region.foreground:SetFrame(data.foregroundTexture, frame);
|
||||
|
||||
WeakAuras.StopProfileAura(region.id);
|
||||
WeakAuras.StopProfileSystem("stopmotion")
|
||||
Private.StopProfileAura(region.id);
|
||||
Private.StopProfileSystem("stopmotion")
|
||||
end;
|
||||
|
||||
region.FrameTick = onUpdate;
|
||||
|
||||
@@ -75,7 +75,7 @@ local function modify(parent, region, data)
|
||||
WeakAuras.regionPrototype.modify(parent, region, data);
|
||||
local text = region.text;
|
||||
|
||||
region.useAuto = WeakAuras.CanHaveAuto(data);
|
||||
region.useAuto = Private.CanHaveAuto(data);
|
||||
|
||||
local fontPath = SharedMedia:Fetch("font", data.font);
|
||||
text:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline);
|
||||
@@ -158,7 +158,7 @@ local function modify(parent, region, data)
|
||||
end
|
||||
|
||||
local UpdateText
|
||||
if WeakAuras.ContainsAnyPlaceHolders(data.displayText) then
|
||||
if Private.ContainsAnyPlaceHolders(data.displayText) then
|
||||
local getter = function(key, default)
|
||||
local fullKey = "displayText_format_" .. key
|
||||
if (data[fullKey] == nil) then
|
||||
@@ -166,10 +166,10 @@ local function modify(parent, region, data)
|
||||
end
|
||||
return data[fullKey]
|
||||
end
|
||||
local formatters = WeakAuras.CreateFormatters(data.displayText, getter)
|
||||
local formatters = Private.CreateFormatters(data.displayText, getter)
|
||||
UpdateText = function()
|
||||
local textStr = data.displayText;
|
||||
textStr = WeakAuras.ReplacePlaceHolders(textStr, region, nil, false, formatters);
|
||||
textStr = Private.ReplacePlaceHolders(textStr, region, nil, false, formatters);
|
||||
if (textStr == nil or textStr == "") then
|
||||
textStr = " ";
|
||||
end
|
||||
@@ -179,7 +179,7 @@ local function modify(parent, region, data)
|
||||
end
|
||||
|
||||
local customTextFunc = nil
|
||||
if(WeakAuras.ContainsCustomPlaceHolder(data.displayText) and data.customText) then
|
||||
if(Private.ContainsCustomPlaceHolder(data.displayText) and data.customText) then
|
||||
customTextFunc = WeakAuras.LoadFunction("return "..data.customText, region.id, "custom text")
|
||||
end
|
||||
|
||||
@@ -187,7 +187,7 @@ local function modify(parent, region, data)
|
||||
if customTextFunc then
|
||||
if UpdateText then
|
||||
Update = function()
|
||||
region.values.custom = WeakAuras.RunCustomTextFunc(region, customTextFunc)
|
||||
region.values.custom = Private.RunCustomTextFunc(region, customTextFunc)
|
||||
UpdateText()
|
||||
end
|
||||
end
|
||||
@@ -196,14 +196,14 @@ local function modify(parent, region, data)
|
||||
end
|
||||
|
||||
local TimerTick
|
||||
if WeakAuras.ContainsPlaceHolders(data.displayText, "p") then
|
||||
if Private.ContainsPlaceHolders(data.displayText, "p") then
|
||||
TimerTick = UpdateText
|
||||
end
|
||||
|
||||
local FrameTick
|
||||
if customTextFunc and data.customTextUpdate == "update" then
|
||||
FrameTick = function()
|
||||
region.values.custom = WeakAuras.RunCustomTextFunc(region, customTextFunc)
|
||||
region.values.custom = Private.RunCustomTextFunc(region, customTextFunc)
|
||||
UpdateText()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user