wuira 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/lib/platform/forever.d.ts +2 -1
- package/lib/rendering/layout.lua +2 -2
- package/lib/rendering/progress.lua +9 -3
- package/lib/rendering/widgets.lua +8 -1
- package/lib/ui/Cell.d.ts +1 -1
- package/lib/ui/FlowLayout.d.ts +16 -4
- package/lib/ui/GridLayout.d.ts +10 -1
- package/lib/ui/ScrollHost.lua +9 -4
- package/lib/ui/decorations/backgroundTextures.d.ts +2 -22
- package/lib/ui/decorations/backgroundTextures.lua +3 -7
- package/lib/ui/decorations/borderTextures.d.ts +2 -37
- package/lib/ui/decorations/borderTextures.lua +3 -9
- package/lib/ui/decorations/statusBarTextures.d.ts +5 -12
- package/lib/ui/decorations/statusBarTextures.lua +83 -4
- package/lib/ui/index.d.ts +5 -0
- package/lib/ui/index.lua +15 -0
- package/lib/ui/layout/calculateFlow.d.ts +16 -4
- package/lib/ui/layout/calculateFlow.lua +153 -46
- package/lib/ui/layout/calculateGrid.d.ts +6 -5
- package/lib/ui/layout/calculateGrid.lua +80 -6
- package/lib/ui/layout/measureLayout.lua +118 -39
- package/lib/ui/media/clientMedia.d.ts +177 -0
- package/lib/ui/media/clientMedia.lua +49 -0
- package/lib/ui/overlayGlow.d.ts +21 -0
- package/lib/ui/overlayGlow.lua +350 -0
- package/package.json +1 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/** Client files shipped with WoW. Names are catalog keys; paths are what the game resolves. */
|
|
2
|
+
export interface ClientMedia {
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ClientBorder extends ClientMedia {
|
|
7
|
+
readonly edgeSize: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const progressTextures: {
|
|
10
|
+
readonly solid: {
|
|
11
|
+
readonly label: "Solid";
|
|
12
|
+
readonly path: "Interface\\Buttons\\WHITE8X8";
|
|
13
|
+
};
|
|
14
|
+
readonly blizzard: {
|
|
15
|
+
readonly label: "Blizzard";
|
|
16
|
+
readonly path: "Interface\\TargetingFrame\\UI-StatusBar";
|
|
17
|
+
};
|
|
18
|
+
readonly skills: {
|
|
19
|
+
readonly label: "Blizzard Character Skills Bar";
|
|
20
|
+
readonly path: "Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar";
|
|
21
|
+
};
|
|
22
|
+
readonly raid: {
|
|
23
|
+
readonly label: "Blizzard Raid Bar";
|
|
24
|
+
readonly path: "Interface\\RaidFrame\\Raid-Bar-Hp-Fill";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const backgroundTextures: {
|
|
28
|
+
readonly solid: {
|
|
29
|
+
readonly label: "Solid";
|
|
30
|
+
readonly path: "Interface\\Buttons\\WHITE8X8";
|
|
31
|
+
};
|
|
32
|
+
readonly tooltip: {
|
|
33
|
+
readonly label: "Blizzard Tooltip";
|
|
34
|
+
readonly path: "Interface\\Tooltips\\UI-Tooltip-Background";
|
|
35
|
+
};
|
|
36
|
+
readonly dialog: {
|
|
37
|
+
readonly label: "Blizzard Dialog";
|
|
38
|
+
readonly path: "Interface\\DialogFrame\\UI-DialogBox-Background";
|
|
39
|
+
};
|
|
40
|
+
readonly dialogDark: {
|
|
41
|
+
readonly label: "Blizzard Dialog Dark";
|
|
42
|
+
readonly path: "Interface\\DialogFrame\\UI-DialogBox-Background-Dark";
|
|
43
|
+
};
|
|
44
|
+
readonly dialogGold: {
|
|
45
|
+
readonly label: "Blizzard Dialog Gold";
|
|
46
|
+
readonly path: "Interface\\DialogFrame\\UI-DialogBox-Gold-Background";
|
|
47
|
+
};
|
|
48
|
+
readonly collections: {
|
|
49
|
+
readonly label: "Blizzard Collections";
|
|
50
|
+
readonly path: "Interface\\Collections\\CollectionsBackgroundTile";
|
|
51
|
+
};
|
|
52
|
+
readonly garrison: {
|
|
53
|
+
readonly label: "Blizzard Garrison";
|
|
54
|
+
readonly path: "Interface\\Garrison\\GarrisonUIBackground";
|
|
55
|
+
};
|
|
56
|
+
readonly garrisonAlt: {
|
|
57
|
+
readonly label: "Blizzard Garrison 2";
|
|
58
|
+
readonly path: "Interface\\Garrison\\GarrisonUIBackground2";
|
|
59
|
+
};
|
|
60
|
+
readonly garrisonMission: {
|
|
61
|
+
readonly label: "Blizzard Garrison Mission";
|
|
62
|
+
readonly path: "Interface\\Garrison\\GarrisonMissionUIInfoBoxBackgroundTile";
|
|
63
|
+
};
|
|
64
|
+
readonly lowHealth: {
|
|
65
|
+
readonly label: "Blizzard Low Health";
|
|
66
|
+
readonly path: "Interface\\FullScreenTextures\\LowHealth";
|
|
67
|
+
};
|
|
68
|
+
readonly marble: {
|
|
69
|
+
readonly label: "Blizzard Marble";
|
|
70
|
+
readonly path: "Interface\\FrameGeneral\\UI-Background-Marble";
|
|
71
|
+
};
|
|
72
|
+
readonly outOfControl: {
|
|
73
|
+
readonly label: "Blizzard Out of Control";
|
|
74
|
+
readonly path: "Interface\\FullScreenTextures\\OutOfControl";
|
|
75
|
+
};
|
|
76
|
+
readonly parchment: {
|
|
77
|
+
readonly label: "Blizzard Parchment";
|
|
78
|
+
readonly path: "Interface\\AchievementFrame\\UI-Achievement-Parchment-Horizontal";
|
|
79
|
+
};
|
|
80
|
+
readonly parchmentGuild: {
|
|
81
|
+
readonly label: "Blizzard Parchment Guild";
|
|
82
|
+
readonly path: "Interface\\AchievementFrame\\UI-GuildAchievement-Parchment-Horizontal";
|
|
83
|
+
};
|
|
84
|
+
readonly rock: {
|
|
85
|
+
readonly label: "Blizzard Rock";
|
|
86
|
+
readonly path: "Interface\\FrameGeneral\\UI-Background-Rock";
|
|
87
|
+
};
|
|
88
|
+
readonly tabard: {
|
|
89
|
+
readonly label: "Blizzard Tabard";
|
|
90
|
+
readonly path: "Interface\\TabardFrame\\TabardFrameBackground";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export declare const borderTextures: {
|
|
94
|
+
readonly solid: {
|
|
95
|
+
readonly label: "Solid";
|
|
96
|
+
readonly path: "";
|
|
97
|
+
readonly edgeSize: 1;
|
|
98
|
+
};
|
|
99
|
+
readonly tooltip: {
|
|
100
|
+
readonly label: "Blizzard Tooltip";
|
|
101
|
+
readonly path: "Interface\\Tooltips\\UI-Tooltip-Border";
|
|
102
|
+
readonly edgeSize: 16;
|
|
103
|
+
};
|
|
104
|
+
readonly dialog: {
|
|
105
|
+
readonly label: "Blizzard Dialog";
|
|
106
|
+
readonly path: "Interface\\DialogFrame\\UI-DialogBox-Border";
|
|
107
|
+
readonly edgeSize: 32;
|
|
108
|
+
};
|
|
109
|
+
readonly dialogGold: {
|
|
110
|
+
readonly label: "Blizzard Dialog Gold";
|
|
111
|
+
readonly path: "Interface\\DialogFrame\\UI-DialogBox-Gold-Border";
|
|
112
|
+
readonly edgeSize: 32;
|
|
113
|
+
};
|
|
114
|
+
readonly achievementWood: {
|
|
115
|
+
readonly label: "Blizzard Achievement Wood";
|
|
116
|
+
readonly path: "Interface\\AchievementFrame\\UI-Achievement-WoodBorder";
|
|
117
|
+
readonly edgeSize: 16;
|
|
118
|
+
};
|
|
119
|
+
readonly chatBubble: {
|
|
120
|
+
readonly label: "Blizzard Chat Bubble";
|
|
121
|
+
readonly path: "Interface\\Tooltips\\ChatBubble-Backdrop";
|
|
122
|
+
readonly edgeSize: 16;
|
|
123
|
+
};
|
|
124
|
+
readonly party: {
|
|
125
|
+
readonly label: "Blizzard Party";
|
|
126
|
+
readonly path: "Interface\\CHARACTERFRAME\\UI-Party-Border";
|
|
127
|
+
readonly edgeSize: 16;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
/** Latin-capable faces present in every client locale. Cyrillic duplicates stay out. */
|
|
131
|
+
export declare const clientFonts: {
|
|
132
|
+
readonly friz: {
|
|
133
|
+
readonly label: "Friz Quadrata";
|
|
134
|
+
readonly path: "Fonts\\FRIZQT__.TTF";
|
|
135
|
+
};
|
|
136
|
+
readonly arialNarrow: {
|
|
137
|
+
readonly label: "Arial Narrow";
|
|
138
|
+
readonly path: "Fonts\\ARIALN.TTF";
|
|
139
|
+
};
|
|
140
|
+
readonly morpheus: {
|
|
141
|
+
readonly label: "Morpheus";
|
|
142
|
+
readonly path: "Fonts\\MORPHEUS.TTF";
|
|
143
|
+
};
|
|
144
|
+
readonly skurri: {
|
|
145
|
+
readonly label: "Skurri";
|
|
146
|
+
readonly path: "Fonts\\SKURRI.TTF";
|
|
147
|
+
};
|
|
148
|
+
readonly twoThousand: {
|
|
149
|
+
readonly label: "2002";
|
|
150
|
+
readonly path: "Fonts\\2002.TTF";
|
|
151
|
+
};
|
|
152
|
+
readonly twoThousandBold: {
|
|
153
|
+
readonly label: "2002 Bold";
|
|
154
|
+
readonly path: "Fonts\\2002B.TTF";
|
|
155
|
+
};
|
|
156
|
+
readonly hei: {
|
|
157
|
+
readonly label: "AR CrystalzcuheiGBK Demibold";
|
|
158
|
+
readonly path: "Fonts\\ARHei.TTF";
|
|
159
|
+
};
|
|
160
|
+
readonly zhongkaiCombat: {
|
|
161
|
+
readonly label: "AR ZhongkaiGBK Medium (Combat)";
|
|
162
|
+
readonly path: "Fonts\\ARKai_C.TTF";
|
|
163
|
+
};
|
|
164
|
+
readonly zhongkai: {
|
|
165
|
+
readonly label: "AR ZhongkaiGBK Medium";
|
|
166
|
+
readonly path: "Fonts\\ARKai_T.TTF";
|
|
167
|
+
};
|
|
168
|
+
readonly mok: {
|
|
169
|
+
readonly label: "MoK";
|
|
170
|
+
readonly path: "Fonts\\K_Pagetext.TTF";
|
|
171
|
+
};
|
|
172
|
+
readonly nimrod: {
|
|
173
|
+
readonly label: "Nimrod MT";
|
|
174
|
+
readonly path: "Fonts\\NIM_____.ttf";
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
export declare function resolveMediaPath(catalog: Readonly<Record<string, ClientMedia>>, value: string): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
____exports.progressTextures = {solid = {label = "Solid", path = "Interface\\Buttons\\WHITE8X8"}, blizzard = {label = "Blizzard", path = "Interface\\TargetingFrame\\UI-StatusBar"}, skills = {label = "Blizzard Character Skills Bar", path = "Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar"}, raid = {label = "Blizzard Raid Bar", path = "Interface\\RaidFrame\\Raid-Bar-Hp-Fill"}}
|
|
4
|
+
____exports.backgroundTextures = {
|
|
5
|
+
solid = {label = "Solid", path = "Interface\\Buttons\\WHITE8X8"},
|
|
6
|
+
tooltip = {label = "Blizzard Tooltip", path = "Interface\\Tooltips\\UI-Tooltip-Background"},
|
|
7
|
+
dialog = {label = "Blizzard Dialog", path = "Interface\\DialogFrame\\UI-DialogBox-Background"},
|
|
8
|
+
dialogDark = {label = "Blizzard Dialog Dark", path = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark"},
|
|
9
|
+
dialogGold = {label = "Blizzard Dialog Gold", path = "Interface\\DialogFrame\\UI-DialogBox-Gold-Background"},
|
|
10
|
+
collections = {label = "Blizzard Collections", path = "Interface\\Collections\\CollectionsBackgroundTile"},
|
|
11
|
+
garrison = {label = "Blizzard Garrison", path = "Interface\\Garrison\\GarrisonUIBackground"},
|
|
12
|
+
garrisonAlt = {label = "Blizzard Garrison 2", path = "Interface\\Garrison\\GarrisonUIBackground2"},
|
|
13
|
+
garrisonMission = {label = "Blizzard Garrison Mission", path = "Interface\\Garrison\\GarrisonMissionUIInfoBoxBackgroundTile"},
|
|
14
|
+
lowHealth = {label = "Blizzard Low Health", path = "Interface\\FullScreenTextures\\LowHealth"},
|
|
15
|
+
marble = {label = "Blizzard Marble", path = "Interface\\FrameGeneral\\UI-Background-Marble"},
|
|
16
|
+
outOfControl = {label = "Blizzard Out of Control", path = "Interface\\FullScreenTextures\\OutOfControl"},
|
|
17
|
+
parchment = {label = "Blizzard Parchment", path = "Interface\\AchievementFrame\\UI-Achievement-Parchment-Horizontal"},
|
|
18
|
+
parchmentGuild = {label = "Blizzard Parchment Guild", path = "Interface\\AchievementFrame\\UI-GuildAchievement-Parchment-Horizontal"},
|
|
19
|
+
rock = {label = "Blizzard Rock", path = "Interface\\FrameGeneral\\UI-Background-Rock"},
|
|
20
|
+
tabard = {label = "Blizzard Tabard", path = "Interface\\TabardFrame\\TabardFrameBackground"}
|
|
21
|
+
}
|
|
22
|
+
____exports.borderTextures = {
|
|
23
|
+
solid = {label = "Solid", path = "", edgeSize = 1},
|
|
24
|
+
tooltip = {label = "Blizzard Tooltip", path = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16},
|
|
25
|
+
dialog = {label = "Blizzard Dialog", path = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 32},
|
|
26
|
+
dialogGold = {label = "Blizzard Dialog Gold", path = "Interface\\DialogFrame\\UI-DialogBox-Gold-Border", edgeSize = 32},
|
|
27
|
+
achievementWood = {label = "Blizzard Achievement Wood", path = "Interface\\AchievementFrame\\UI-Achievement-WoodBorder", edgeSize = 16},
|
|
28
|
+
chatBubble = {label = "Blizzard Chat Bubble", path = "Interface\\Tooltips\\ChatBubble-Backdrop", edgeSize = 16},
|
|
29
|
+
party = {label = "Blizzard Party", path = "Interface\\CHARACTERFRAME\\UI-Party-Border", edgeSize = 16}
|
|
30
|
+
}
|
|
31
|
+
--- Latin-capable faces present in every client locale. Cyrillic duplicates stay out.
|
|
32
|
+
____exports.clientFonts = {
|
|
33
|
+
friz = {label = "Friz Quadrata", path = "Fonts\\FRIZQT__.TTF"},
|
|
34
|
+
arialNarrow = {label = "Arial Narrow", path = "Fonts\\ARIALN.TTF"},
|
|
35
|
+
morpheus = {label = "Morpheus", path = "Fonts\\MORPHEUS.TTF"},
|
|
36
|
+
skurri = {label = "Skurri", path = "Fonts\\SKURRI.TTF"},
|
|
37
|
+
twoThousand = {label = "2002", path = "Fonts\\2002.TTF"},
|
|
38
|
+
twoThousandBold = {label = "2002 Bold", path = "Fonts\\2002B.TTF"},
|
|
39
|
+
hei = {label = "AR CrystalzcuheiGBK Demibold", path = "Fonts\\ARHei.TTF"},
|
|
40
|
+
zhongkaiCombat = {label = "AR ZhongkaiGBK Medium (Combat)", path = "Fonts\\ARKai_C.TTF"},
|
|
41
|
+
zhongkai = {label = "AR ZhongkaiGBK Medium", path = "Fonts\\ARKai_T.TTF"},
|
|
42
|
+
mok = {label = "MoK", path = "Fonts\\K_Pagetext.TTF"},
|
|
43
|
+
nimrod = {label = "Nimrod MT", path = "Fonts\\NIM_____.ttf"}
|
|
44
|
+
}
|
|
45
|
+
function ____exports.resolveMediaPath(self, catalog, value)
|
|
46
|
+
local ____opt_0 = catalog[value]
|
|
47
|
+
return ____opt_0 and ____opt_0.path or value
|
|
48
|
+
end
|
|
49
|
+
return ____exports
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type OverlayGlowKind = "buttonOverlay" | "Pixel" | "ACShine" | "Proc";
|
|
2
|
+
export interface OverlayGlowOptions {
|
|
3
|
+
kind: OverlayGlowKind;
|
|
4
|
+
color?: {
|
|
5
|
+
r: number;
|
|
6
|
+
g: number;
|
|
7
|
+
b: number;
|
|
8
|
+
a?: number;
|
|
9
|
+
};
|
|
10
|
+
lines?: number;
|
|
11
|
+
frequency?: number;
|
|
12
|
+
length?: number;
|
|
13
|
+
thickness?: number;
|
|
14
|
+
scale?: number;
|
|
15
|
+
border?: boolean;
|
|
16
|
+
x?: number;
|
|
17
|
+
y?: number;
|
|
18
|
+
duration?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Additive overlay. Addon code cannot install a shader, so each style is drawn with colored textures. */
|
|
21
|
+
export declare function startOverlayGlow(frame: wuiraNativeFrame, options: OverlayGlowOptions): () => void;
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
-- Lua Library inline imports
|
|
3
|
+
local function __TS__NumberIsFinite(value)
|
|
4
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
5
|
+
end
|
|
6
|
+
-- End of Lua Library inline imports
|
|
7
|
+
local ____exports = {}
|
|
8
|
+
local function finite(self, value, fallback)
|
|
9
|
+
return type(value) == "number" and __TS__NumberIsFinite(value) and value or fallback
|
|
10
|
+
end
|
|
11
|
+
local function count(self, value, fallback, limit)
|
|
12
|
+
local number = math.floor(finite(nil, value, fallback))
|
|
13
|
+
if number < 1 then
|
|
14
|
+
return 1
|
|
15
|
+
end
|
|
16
|
+
return number > limit and limit or number
|
|
17
|
+
end
|
|
18
|
+
local function quad(self, parent)
|
|
19
|
+
local texture = parent:CreateTexture(nil, "OVERLAY")
|
|
20
|
+
if texture.SetColorTexture ~= nil then
|
|
21
|
+
texture:SetColorTexture(1, 1, 1, 1)
|
|
22
|
+
else
|
|
23
|
+
texture:SetTexture("Interface\\Buttons\\WHITE8X8")
|
|
24
|
+
end
|
|
25
|
+
texture:SetBlendMode("ADD")
|
|
26
|
+
return texture
|
|
27
|
+
end
|
|
28
|
+
--- Additive overlay. Addon code cannot install a shader, so each style is drawn with colored textures.
|
|
29
|
+
function ____exports.startOverlayGlow(self, frame, options)
|
|
30
|
+
local kind = options.kind
|
|
31
|
+
if kind ~= "buttonOverlay" and kind ~= "Pixel" and kind ~= "ACShine" and kind ~= "Proc" then
|
|
32
|
+
return function()
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
local host
|
|
36
|
+
do
|
|
37
|
+
local function ____catch()
|
|
38
|
+
return true, function()
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
local ____try, ____hasReturned, ____returnValue = pcall(function()
|
|
42
|
+
host = CreateFrame("Frame", nil, frame)
|
|
43
|
+
end)
|
|
44
|
+
if not ____try then
|
|
45
|
+
____hasReturned, ____returnValue = ____catch()
|
|
46
|
+
end
|
|
47
|
+
if ____hasReturned then
|
|
48
|
+
return ____returnValue
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
host:SetAllPoints(frame)
|
|
52
|
+
local level = frame:GetFrameLevel()
|
|
53
|
+
if type(level) == "number" then
|
|
54
|
+
host:SetFrameLevel(level + 6)
|
|
55
|
+
end
|
|
56
|
+
host:EnableMouse(false)
|
|
57
|
+
host:Show()
|
|
58
|
+
local color = options.color
|
|
59
|
+
local red = finite(nil, color and color.r, 0.95)
|
|
60
|
+
local green = finite(nil, color and color.g, 0.95)
|
|
61
|
+
local blue = finite(nil, color and color.b, 0.32)
|
|
62
|
+
local alpha = finite(nil, color and color.a, 1)
|
|
63
|
+
local frequency = finite(nil, options.frequency, 0.25)
|
|
64
|
+
local xOffset = finite(nil, options.x, 0)
|
|
65
|
+
local yOffset = finite(nil, options.y, 0)
|
|
66
|
+
local pieces = {}
|
|
67
|
+
local phase = 0
|
|
68
|
+
local running = true
|
|
69
|
+
local function paint(____, texture, amount)
|
|
70
|
+
return texture:SetVertexColor(red, green, blue, alpha * amount)
|
|
71
|
+
end
|
|
72
|
+
if kind == "buttonOverlay" then
|
|
73
|
+
local thickness = math.max(
|
|
74
|
+
1,
|
|
75
|
+
finite(nil, options.thickness, 3)
|
|
76
|
+
)
|
|
77
|
+
do
|
|
78
|
+
local index = 0
|
|
79
|
+
while index < 4 do
|
|
80
|
+
pieces[#pieces + 1] = quad(nil, host)
|
|
81
|
+
index = index + 1
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
host:SetScript(
|
|
85
|
+
"OnUpdate",
|
|
86
|
+
function(_host, elapsed)
|
|
87
|
+
if not running then
|
|
88
|
+
return
|
|
89
|
+
end
|
|
90
|
+
phase = phase + elapsed * frequency
|
|
91
|
+
local pulse = 0.35 + 0.65 * (0.5 + 0.5 * math.sin(phase * 6.28318))
|
|
92
|
+
local width = host:GetWidth()
|
|
93
|
+
local height = host:GetHeight()
|
|
94
|
+
if width <= 0 or height <= 0 then
|
|
95
|
+
return
|
|
96
|
+
end
|
|
97
|
+
local top = pieces[1]
|
|
98
|
+
local bottom = pieces[2]
|
|
99
|
+
local left = pieces[3]
|
|
100
|
+
local right = pieces[4]
|
|
101
|
+
top:ClearAllPoints()
|
|
102
|
+
top:SetSize(width + xOffset * 2, thickness)
|
|
103
|
+
top:SetPoint(
|
|
104
|
+
"TOPLEFT",
|
|
105
|
+
host,
|
|
106
|
+
"TOPLEFT",
|
|
107
|
+
-xOffset,
|
|
108
|
+
yOffset
|
|
109
|
+
)
|
|
110
|
+
bottom:ClearAllPoints()
|
|
111
|
+
bottom:SetSize(width + xOffset * 2, thickness)
|
|
112
|
+
bottom:SetPoint(
|
|
113
|
+
"BOTTOMLEFT",
|
|
114
|
+
host,
|
|
115
|
+
"BOTTOMLEFT",
|
|
116
|
+
-xOffset,
|
|
117
|
+
-yOffset
|
|
118
|
+
)
|
|
119
|
+
left:ClearAllPoints()
|
|
120
|
+
left:SetSize(thickness, height)
|
|
121
|
+
left:SetPoint(
|
|
122
|
+
"TOPLEFT",
|
|
123
|
+
host,
|
|
124
|
+
"TOPLEFT",
|
|
125
|
+
-xOffset,
|
|
126
|
+
yOffset
|
|
127
|
+
)
|
|
128
|
+
right:ClearAllPoints()
|
|
129
|
+
right:SetSize(thickness, height)
|
|
130
|
+
right:SetPoint(
|
|
131
|
+
"TOPRIGHT",
|
|
132
|
+
host,
|
|
133
|
+
"TOPRIGHT",
|
|
134
|
+
xOffset,
|
|
135
|
+
yOffset
|
|
136
|
+
)
|
|
137
|
+
for ____, texture in ipairs(pieces) do
|
|
138
|
+
paint(nil, texture, pulse)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
)
|
|
142
|
+
elseif kind == "Pixel" then
|
|
143
|
+
local lines = count(nil, options.lines, 8, 24)
|
|
144
|
+
local length = math.max(
|
|
145
|
+
2,
|
|
146
|
+
finite(nil, options.length, 10)
|
|
147
|
+
)
|
|
148
|
+
local thickness = math.max(
|
|
149
|
+
1,
|
|
150
|
+
finite(nil, options.thickness, 2)
|
|
151
|
+
)
|
|
152
|
+
do
|
|
153
|
+
local index = 0
|
|
154
|
+
while index < lines do
|
|
155
|
+
pieces[#pieces + 1] = quad(nil, host)
|
|
156
|
+
index = index + 1
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
local edges = options.border == true and ({
|
|
160
|
+
quad(nil, host),
|
|
161
|
+
quad(nil, host),
|
|
162
|
+
quad(nil, host),
|
|
163
|
+
quad(nil, host)
|
|
164
|
+
}) or ({})
|
|
165
|
+
host:SetScript(
|
|
166
|
+
"OnUpdate",
|
|
167
|
+
function(_host, elapsed)
|
|
168
|
+
if not running then
|
|
169
|
+
return
|
|
170
|
+
end
|
|
171
|
+
phase = phase + elapsed * frequency
|
|
172
|
+
local width = host:GetWidth() + xOffset * 2
|
|
173
|
+
local height = host:GetHeight() + yOffset * 2
|
|
174
|
+
local perimeter = (width + height) * 2
|
|
175
|
+
if perimeter <= 0 then
|
|
176
|
+
return
|
|
177
|
+
end
|
|
178
|
+
if #edges == 4 then
|
|
179
|
+
local edge = math.max(1, thickness)
|
|
180
|
+
edges[1]:ClearAllPoints()
|
|
181
|
+
edges[1]:SetSize(width, edge)
|
|
182
|
+
edges[1]:SetPoint(
|
|
183
|
+
"TOPLEFT",
|
|
184
|
+
host,
|
|
185
|
+
"TOPLEFT",
|
|
186
|
+
-xOffset,
|
|
187
|
+
yOffset
|
|
188
|
+
)
|
|
189
|
+
edges[2]:ClearAllPoints()
|
|
190
|
+
edges[2]:SetSize(width, edge)
|
|
191
|
+
edges[2]:SetPoint(
|
|
192
|
+
"BOTTOMLEFT",
|
|
193
|
+
host,
|
|
194
|
+
"BOTTOMLEFT",
|
|
195
|
+
-xOffset,
|
|
196
|
+
-yOffset
|
|
197
|
+
)
|
|
198
|
+
edges[3]:ClearAllPoints()
|
|
199
|
+
edges[3]:SetSize(edge, height)
|
|
200
|
+
edges[3]:SetPoint(
|
|
201
|
+
"TOPLEFT",
|
|
202
|
+
host,
|
|
203
|
+
"TOPLEFT",
|
|
204
|
+
-xOffset,
|
|
205
|
+
yOffset
|
|
206
|
+
)
|
|
207
|
+
edges[4]:ClearAllPoints()
|
|
208
|
+
edges[4]:SetSize(edge, height)
|
|
209
|
+
edges[4]:SetPoint(
|
|
210
|
+
"TOPRIGHT",
|
|
211
|
+
host,
|
|
212
|
+
"TOPRIGHT",
|
|
213
|
+
xOffset,
|
|
214
|
+
yOffset
|
|
215
|
+
)
|
|
216
|
+
for ____, texture in ipairs(edges) do
|
|
217
|
+
paint(nil, texture, 0.35)
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
do
|
|
221
|
+
local index = 0
|
|
222
|
+
while index < lines do
|
|
223
|
+
local distance = ((phase + index / lines) % 1 + 1) % 1 * perimeter
|
|
224
|
+
local x = 0
|
|
225
|
+
local y = 0
|
|
226
|
+
local horizontal = true
|
|
227
|
+
if distance <= width then
|
|
228
|
+
x = distance
|
|
229
|
+
y = 0
|
|
230
|
+
horizontal = true
|
|
231
|
+
elseif distance <= width + height then
|
|
232
|
+
x = width
|
|
233
|
+
y = distance - width
|
|
234
|
+
horizontal = false
|
|
235
|
+
elseif distance <= width * 2 + height then
|
|
236
|
+
x = width - (distance - width - height)
|
|
237
|
+
y = height
|
|
238
|
+
horizontal = true
|
|
239
|
+
else
|
|
240
|
+
x = 0
|
|
241
|
+
y = height - (distance - width * 2 - height)
|
|
242
|
+
horizontal = false
|
|
243
|
+
end
|
|
244
|
+
local texture = pieces[index + 1]
|
|
245
|
+
texture:ClearAllPoints()
|
|
246
|
+
texture:SetSize(horizontal and length or thickness, horizontal and thickness or length)
|
|
247
|
+
texture:SetPoint(
|
|
248
|
+
"CENTER",
|
|
249
|
+
host,
|
|
250
|
+
"TOPLEFT",
|
|
251
|
+
x - xOffset,
|
|
252
|
+
-(y - yOffset)
|
|
253
|
+
)
|
|
254
|
+
paint(nil, texture, 1)
|
|
255
|
+
index = index + 1
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
)
|
|
260
|
+
elseif kind == "ACShine" then
|
|
261
|
+
local lines = count(nil, options.lines, 4, 16)
|
|
262
|
+
local scale = math.max(
|
|
263
|
+
0.2,
|
|
264
|
+
finite(nil, options.scale, 1)
|
|
265
|
+
)
|
|
266
|
+
local size = 6 * scale
|
|
267
|
+
do
|
|
268
|
+
local index = 0
|
|
269
|
+
while index < lines do
|
|
270
|
+
pieces[#pieces + 1] = quad(nil, host)
|
|
271
|
+
index = index + 1
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
host:SetScript(
|
|
275
|
+
"OnUpdate",
|
|
276
|
+
function(_host, elapsed)
|
|
277
|
+
if not running then
|
|
278
|
+
return
|
|
279
|
+
end
|
|
280
|
+
phase = phase + elapsed * frequency
|
|
281
|
+
local radiusX = host:GetWidth() / 2 + xOffset
|
|
282
|
+
local radiusY = host:GetHeight() / 2 + yOffset
|
|
283
|
+
if radiusX == 0 and radiusY == 0 then
|
|
284
|
+
return
|
|
285
|
+
end
|
|
286
|
+
do
|
|
287
|
+
local index = 0
|
|
288
|
+
while index < lines do
|
|
289
|
+
local angle = phase * 6.28318 + index * 6.28318 / lines
|
|
290
|
+
local spark = 0.35 + 0.65 * (0.5 + 0.5 * math.sin(angle * 2))
|
|
291
|
+
local texture = pieces[index + 1]
|
|
292
|
+
texture:ClearAllPoints()
|
|
293
|
+
texture:SetSize(size, size)
|
|
294
|
+
texture:SetPoint(
|
|
295
|
+
"CENTER",
|
|
296
|
+
host,
|
|
297
|
+
"CENTER",
|
|
298
|
+
math.cos(angle) * radiusX,
|
|
299
|
+
math.sin(angle) * radiusY
|
|
300
|
+
)
|
|
301
|
+
paint(nil, texture, spark)
|
|
302
|
+
index = index + 1
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
)
|
|
307
|
+
else
|
|
308
|
+
local duration = math.max(
|
|
309
|
+
0.2,
|
|
310
|
+
finite(nil, options.duration, 1)
|
|
311
|
+
)
|
|
312
|
+
local burst = quad(nil, host)
|
|
313
|
+
pieces[#pieces + 1] = burst
|
|
314
|
+
host:SetScript(
|
|
315
|
+
"OnUpdate",
|
|
316
|
+
function(_host, elapsed)
|
|
317
|
+
if not running then
|
|
318
|
+
return
|
|
319
|
+
end
|
|
320
|
+
phase = phase + elapsed
|
|
321
|
+
local cycle = phase % duration / duration
|
|
322
|
+
local width = host:GetWidth()
|
|
323
|
+
local height = host:GetHeight()
|
|
324
|
+
if width <= 0 or height <= 0 then
|
|
325
|
+
return
|
|
326
|
+
end
|
|
327
|
+
local grow = 0.85 + cycle * 0.5
|
|
328
|
+
burst:ClearAllPoints()
|
|
329
|
+
burst:SetSize((width + xOffset * 2) * grow, (height + yOffset * 2) * grow)
|
|
330
|
+
burst:SetPoint(
|
|
331
|
+
"CENTER",
|
|
332
|
+
host,
|
|
333
|
+
"CENTER",
|
|
334
|
+
0,
|
|
335
|
+
0
|
|
336
|
+
)
|
|
337
|
+
paint(nil, burst, 1 - cycle)
|
|
338
|
+
end
|
|
339
|
+
)
|
|
340
|
+
end
|
|
341
|
+
return function()
|
|
342
|
+
running = false
|
|
343
|
+
host:SetScript("OnUpdate", nil)
|
|
344
|
+
for ____, texture in ipairs(pieces) do
|
|
345
|
+
texture:Hide()
|
|
346
|
+
end
|
|
347
|
+
host:Hide()
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
return ____exports
|