forked from kvirt/KHMRaidFrames
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VirtualFrames.lua
executable file
·99 lines (73 loc) · 2.99 KB
/
VirtualFrames.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
local KHMRaidFrames = LibStub("AceAddon-3.0"):GetAddon("KHMRaidFrames")
local UnitIsPlayer, CreateFrame, UIParent = UnitIsPlayer, CreateFrame, UIParent
function KHMRaidFrames:GetVirtualFrames()
local frame, texture, text
for frameType in self.IterateSubFrameTypes() do
for i=1, self.maxFrames do
frame = CreateFrame("Button", nil, UIParent)
self.virtual.frames[frameType][i] = frame
texture = frame:CreateTexture(nil, "BACKGROUND")
texture:SetAllPoints(frame)
frame.texture = texture
text = frame:CreateFontString(frame, "OVERLAY", "GameTooltipText")
text:SetFont("Fonts\\FRIZQT__.TTF", 11, "THICKOUTLINE, MONOCHROME")
text:SetPoint("CENTER", 0, 0)
text:SetText(i)
frame.text = text
if frameType == "buffFrames" then
texture:SetTexture("Interface\\Icons\\ability_rogue_sprint")
elseif frameType == "debuffFrames" then
texture:SetTexture("Interface\\Icons\\ability_rogue_kidneyshot")
else
texture:SetTexture("Interface\\RaidFrame\\Raid-Icon-DebuffMagic")
end
frame:Hide()
end
end
end
function KHMRaidFrames:ShowVirtual()
local frame
for _frame in self.IterateCompactFrames() do
if _frame.displayedUnit and UnitIsPlayer(_frame.displayedUnit) then
frame = _frame
break
end
end
if frame == nil then
return
end
self.virtual.shown = true
self.virtual.frame = frame
self:SetUpVirtual("buffFrames", self.virtual.groupType, self.componentScale(self.virtual.groupType))
self:SetUpVirtual("debuffFrames", self.virtual.groupType, self.componentScale(self.virtual.groupType), true)
self:SetUpVirtual("dispelDebuffFrames", self.virtual.groupType, 1)
end
function KHMRaidFrames:SetUpVirtual(subFrameType, groupType, resize, bigSized)
if self.virtual.shown == false then return end
local db = self.db.profile[groupType][subFrameType]
local typedframes = self.virtual.frames[subFrameType]
for frameNum=1, #typedframes do
if frameNum > db.num then
typedframes[frameNum]:Hide()
elseif frameNum <= db.num then
typedframes[frameNum]:Show()
end
end
self:SetUpSubFramesPositionsAndSize(self.virtual.frame, subFrameType, groupType, true)
if db.showBigDebuffs and bigSized then
typedframes[1].isBossAura = true
local size = db.bigDebuffSize * resize
typedframes[1]:SetSize(size, size)
if db.smartAnchoring then
self:SmartAnchoring(self.virtual.frame, groupType, true)
end
end
end
function KHMRaidFrames:HideVirtual()
for _, group in pairs(self.virtual.frames) do
for _, frame in ipairs(group) do
frame:Hide()
end
end
self.virtual.shown = false
end