forked from wowgaming/3.3.5-interface-files
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ComboFrame.lua
73 lines (67 loc) · 2.13 KB
/
ComboFrame.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
COMBOFRAME_FADE_IN = 0.3;
COMBOFRAME_FADE_OUT = 0.5;
COMBOFRAME_HIGHLIGHT_FADE_IN = 0.4;
COMBOFRAME_SHINE_FADE_IN = 0.3;
COMBOFRAME_SHINE_FADE_OUT = 0.4;
COMBO_FRAME_LAST_NUM_POINTS = 0;
function ComboFrame_OnEvent(self, event, ...)
if ( event == "PLAYER_TARGET_CHANGED" ) then
ComboFrame_Update();
elseif ( event == "UNIT_COMBO_POINTS" ) then
local unit = ...;
if ( unit == PlayerFrame.unit ) then
ComboFrame_Update();
end
end
end
function ComboFrame_Update()
local comboPoints = GetComboPoints(PlayerFrame.unit, "target");
local comboPoint, comboPointHighlight, comboPointShine;
if ( comboPoints > 0 ) then
if ( not ComboFrame:IsShown() ) then
ComboFrame:Show();
UIFrameFadeIn(ComboFrame, COMBOFRAME_FADE_IN);
end
for i=1, MAX_COMBO_POINTS do
local fadeInfo = {};
comboPoint = _G["ComboPoint" .. i];
comboPoint:Show();
comboPointHighlight = _G["ComboPoint"..i.."Highlight"];
comboPointShine = _G["ComboPoint"..i.."Shine"];
if ( i <= comboPoints ) then
if ( i > COMBO_FRAME_LAST_NUM_POINTS ) then
-- Fade in the highlight and set a function that triggers when it is done fading
fadeInfo.mode = "IN";
fadeInfo.timeToFade = COMBOFRAME_HIGHLIGHT_FADE_IN;
fadeInfo.finishedFunc = ComboPointShineFadeIn;
fadeInfo.finishedArg1 = comboPointShine;
UIFrameFade(comboPointHighlight, fadeInfo);
end
else
if ( ENABLE_COLORBLIND_MODE == "1" ) then
comboPoint:Hide();
end
comboPointHighlight:SetAlpha(0);
comboPointShine:SetAlpha(0);
end
end
else
ComboPoint1Highlight:SetAlpha(0);
ComboPoint1Shine:SetAlpha(0);
ComboFrame:Hide();
end
COMBO_FRAME_LAST_NUM_POINTS = comboPoints;
end
function ComboPointShineFadeIn(frame)
-- Fade in the shine and then fade it out with the ComboPointShineFadeOut function
local fadeInfo = {};
fadeInfo.mode = "IN";
fadeInfo.timeToFade = COMBOFRAME_SHINE_FADE_IN;
fadeInfo.finishedFunc = ComboPointShineFadeOut;
fadeInfo.finishedArg1 = frame;
UIFrameFade(frame, fadeInfo);
end
--hack since a frame can't have a reference to itself in it
function ComboPointShineFadeOut(frame)
UIFrameFadeOut(frame, COMBOFRAME_SHINE_FADE_OUT);
end