This commit is contained in:
Bunny67
2018-06-03 13:39:40 +03:00
parent 3a0f15b393
commit 1e38c5b657
11 changed files with 39 additions and 908 deletions
+2 -3
View File
@@ -6,7 +6,7 @@
<Script file="leaderindicator.lua"/>
<Script file="combatindicator.lua"/>
<Script file="restingindicator.lua"/>
<!--<Script file="pvpindicator.lua"/>-->
<Script file="pvpindicator.lua"/>
<Script file="portrait.lua"/>
<!--
<Script file="range.lua"/>-->
@@ -14,8 +14,7 @@
<Script file="tags.lua"/>
<Script file="masterlooterindicator.lua"/>
<Script file="assistantindicator.lua"/>
<!--<Script file="readycheckindicator.lua"/>
<Script file="combopoints.lua"/>
<!--<Script file="combopoints.lua"/>
<Script file="raidroleindicator.lua"/>
<Script file="happinessindicator.lua"/>
-->
@@ -87,7 +87,7 @@ local function Path(self, ...)
* event - the event triggering the update (string)
* ... - the arguments accompanying the event
--]]
return (self.PvPIndicator.Override or Update) (self, ...)
return (self.PvPIndicator.Override or Update) (self, unpack(arg))
end
local function ForceUpdate(element)
@@ -1,152 +0,0 @@
--[[
# Element: Ready Check Indicator
Handles the visibility and updating of an indicator based on the unit's ready check status.
## Widget
ReadyCheckIndicator - A `Texture` representing ready check status.
## Notes
This element updates by changing the texture.
Default textures will be applied if the layout does not provide custom ones. See Options.
## Options
.finishedTime - For how many seconds the icon should stick after a check has completed. Defaults to 10 (number).
.fadeTime - For how many seconds the icon should fade away after the stick duration has completed. Defaults to
1.5 (number).
.readyTexture - Path to an alternate texture for the ready check "ready" status.
.notReadyTexture - Path to an alternate texture for the ready check "notready" status.
.waitingTexture - Path to an alternate texture for the ready check "waiting" status.
## Attributes
.status - the unit"s ready check status (string?)["ready", "noready", "waiting"]
## Examples
-- Position and size
local ReadyCheckIndicator = self:CreateTexture(nil, "OVERLAY")
ReadyCheckIndicator:SetSize(16, 16)
ReadyCheckIndicator:SetPoint("TOP")
-- Register with oUF
self.ReadyCheckIndicator = ReadyCheckIndicator
--]]
local ns = oUF
local oUF = ns.oUF
local sub = string.sub
local GetReadyCheckStatus = GetReadyCheckStatus
local UnitExists = UnitExists
local function OnFinished(self)
local element = self:GetParent()
element:Hide()
--[[ Callback: ReadyCheckIndicator:PostUpdateFadeOut()
Called after the element has been faded out.
* self - the ReadyCheckIndicator element
--]]
if(element.PostUpdateFadeOut) then
element:PostUpdateFadeOut()
end
end
local function Update(self, event)
local element = self.ReadyCheckIndicator
--[[ Callback: ReadyCheckIndicator:PreUpdate()
Called before the element has been updated.
* self - the ReadyCheckIndicator element
--]]
if(element.PreUpdate) then
element:PreUpdate()
end
local unit = self.unit
local status = GetReadyCheckStatus(unit)
if(UnitExists(unit) and status) then
if(status == "ready") then
element:SetTexture(element.readyTexture)
elseif(status == "notready") then
element:SetTexture(element.notReadyTexture)
else
element:SetTexture(element.waitingTexture)
end
element.status = status
element:Show()
elseif(event ~= "READY_CHECK_FINISHED") then
element.status = nil
element:Hide()
end
if(event == "READY_CHECK_FINISHED") then
if(element.status == "waiting") then
element:SetTexture(element.notReadyTexture)
end
end
--[[ Callback: ReadyCheckIndicator:PostUpdate(status)
Called after the element has been updated.
* self - the ReadyCheckIndicator element
* status - the unit"s ready check status (string?)["ready", "notready", "waiting"]
--]]
if(element.PostUpdate) then
return element:PostUpdate(status)
end
end
local function Path(self, ...)
--[[ Override: ReadyCheckIndicator.Override(self, event, ...)
Used to completely override the internal update function.
* self - the parent object
* event - the event triggering the update (string)
* ... - the arguments accompanying the event
--]]
return (self.ReadyCheckIndicator.Override or Update) (self, ...)
end
local function ForceUpdate(element)
return Path(element.__owner, "ForceUpdate")
end
local function Enable(self, unit)
local element = self.ReadyCheckIndicator
if(element and (unit and (sub(unit, 1, 5) == "party" or sub(unit, 1, 4) == "raid"))) then
element.__owner = self
element.ForceUpdate = ForceUpdate
element.readyTexture = element.readyTexture or READY_CHECK_READY_TEXTURE
element.notReadyTexture = element.notReadyTexture or READY_CHECK_NOT_READY_TEXTURE
element.waitingTexture = element.waitingTexture or READY_CHECK_WAITING_TEXTURE
self:RegisterEvent("READY_CHECK", Path, true)
self:RegisterEvent("READY_CHECK_CONFIRM", Path, true)
self:RegisterEvent("READY_CHECK_FINISHED", Path, true)
return true
end
end
local function Disable(self)
local element = self.ReadyCheckIndicator
if(element) then
element:Hide()
self:UnregisterEvent("READY_CHECK", Path)
self:UnregisterEvent("READY_CHECK_CONFIRM", Path)
self:UnregisterEvent("READY_CHECK_FINISHED", Path)
end
end
oUF:AddElement("ReadyCheckIndicator", Path, Enable, Disable)
+2 -2
View File
@@ -615,8 +615,8 @@ local function Tag(self, fs, tagstr)
tinsert(self.__mousetags, fs)
fs:SetAlpha(0)
if not self.__HookFunc then
self:HookScript('OnEnter', OnEnter)
self:HookScript('OnLeave', OnLeave)
HookScript(self, 'OnEnter', function() OnEnter(this) end)
HookScript(self, 'OnLeave', function() OnLeave(this) end)
self.__HookFunc = true;
end
tagstr = string.gsub(tagstr, '%[mouseover%]', '')
+3 -3
View File
@@ -273,8 +273,8 @@ local function togglemenu(self, unit)
ToggleDropDownMenu(1, nil, secureDropdown, "cursor")
end
local function onShow()
return this:UpdateAllElements("OnShow")
local function onShow(self)
return self:UpdateAllElements("OnShow")
end
local function initObject(unit, style, styleFunc, header, ...)
@@ -332,7 +332,7 @@ local function initObject(unit, style, styleFunc, header, ...)
styleFunc(object, objectUnit, not header)
--object:SetScript("OnAttributeChanged", onAttributeChanged)
object:SetScript("OnShow", onShow)
object:SetScript("OnShow", function() onShow(this) end)
activeElements[object] = {}
for element in next, elements do