This repository was archived by the owner on Jun 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcastBar.lua
More file actions
executable file
·804 lines (611 loc) · 18.2 KB
/
castBar.lua
File metadata and controls
executable file
·804 lines (611 loc) · 18.2 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
local AddonName, Addon = ...
local Dominos = _G.Dominos
local LSM = LibStub('LibSharedMedia-3.0')
--[[ global references ]]--
local _G = _G
local min = math.min
local max = math.max
local GetSpellInfo = _G.GetSpellInfo
local GetTime = _G.GetTime
local GetNetStats = _G.GetNetStats
local UnitCastingInfo = _G.UnitCastingInfo
local UnitChannelInfo = _G.UnitChannelInfo
local IsHarmfulSpell = _G.IsHarmfulSpell
local IsHelpfulSpell = _G.IsHelpfulSpell
--[[ constants ]]--
local LATENCY_BAR_ALPHA = 0.7
local SPARK_ALPHA = 0.7
--[[ casting bar ]]--
local CastBar = Dominos:CreateClass('Frame', Dominos.Frame)
function CastBar:New(id, units, ...)
local bar = CastBar.proto.New(self, id, ...)
bar.units = type(units) == "table" and units or {units}
bar:Layout()
bar:RegisterEvents()
return bar
end
function CastBar:OnCreate()
self:SetFrameStrata('HIGH')
self:SetScript('OnEvent', self.OnEvent)
local container = CreateFrame('Frame', nil, self)
container:SetAllPoints(container:GetParent())
container:SetAlpha(0)
self.container = container
local fout = container:CreateAnimationGroup()
fout:SetLooping('NONE')
fout:SetScript('OnFinished', function() container:SetAlpha(0); self:OnFinished() end)
local a = fout:CreateAnimation('Alpha')
a:SetFromAlpha(1)
a:SetToAlpha(0)
a:SetDuration(0.5)
self.fout = fout
local fin = container:CreateAnimationGroup()
fin:SetLooping('NONE')
fin:SetScript('OnFinished', function() container:SetAlpha(1) end)
local a = fin:CreateAnimation('Alpha')
a:SetFromAlpha(0)
a:SetToAlpha(1)
a:SetDuration(0.2)
self.fin = fin
local bg = container:CreateTexture(nil, 'BACKGROUND')
bg:SetVertexColor(0, 0, 0, 0.5)
self.bg = bg
local icon = container:CreateTexture(nil, 'ARTWORK')
icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
self.icon = icon
local lb = container:CreateTexture(nil, 'OVERLAY')
lb:SetBlendMode('ADD')
self.latencyBar = lb
local sb = CreateFrame('StatusBar', nil, container)
sb:SetScript('OnValueChanged', function(s, value) self:OnValueChanged(value) end)
local timeText = sb:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
timeText:SetJustifyH('RIGHT')
self.timeText = timeText
local labelText = sb:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
labelText:SetJustifyH('LEFT')
self.labelText = labelText
local spark = CreateFrame('StatusBar', nil, sb)
local st = spark:CreateTexture(nil, 'ARTWORK')
st:SetColorTexture(1, 1, 1, SPARK_ALPHA)
st:SetGradientAlpha('HORIZONTAL', 0, 0, 0, 0, 1, 1, 1, SPARK_ALPHA)
st:SetBlendMode('BLEND')
st:SetHorizTile(true)
spark:SetStatusBarTexture(st)
spark:SetAllPoints(sb)
self.spark = spark
self.statusBar = sb
local border = CreateFrame('Frame', nil, container)
border:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b)
border:SetFrameLevel(sb:GetFrameLevel() + 3)
border:SetAllPoints(container)
border:SetBackdrop{
edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]],
edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 },
}
self.border = border
self.props = {}
return self
end
function CastBar:OnFree()
self:UnregisterAllEvents()
LSM.UnregisterAllCallbacks(self)
end
function CastBar:OnLoadSettings()
if not self.sets.display then
self.sets.display = {
icon = false,
time = true,
border = true
}
end
self:SetProperty("font", self:GetFontID())
self:SetProperty("texture", self:GetTextureID())
self:SetProperty("reaction", "neutral")
end
function CastBar:GetDefaults()
return {
point = 'CENTER',
x = 0,
y = 30,
padW = 1,
padH = 1,
texture = 'blizzard',
font = 'Friz Quadrata TT',
display = {
icon = false,
time = true,
border = true
}
}
end
--[[ frame events ]]--
function CastBar:OnEvent(event, ...)
local func = self[event]
if func then
func(self, event, ...)
end
end
function CastBar:OnUpdateCasting(elapsed)
local sb = self.statusBar
local vmin, vmax = sb:GetMinMaxValues()
local v = sb:GetValue() + elapsed
if v < vmax then
sb:SetValue(v)
else
sb:SetValue(vmax)
self:SetProperty('state', nil)
end
end
function CastBar:OnUpdateChanneling(elapsed)
local sb = self.statusBar
local vmin, vmax = sb:GetMinMaxValues()
local v = sb:GetValue() - elapsed
if v > vmin then
sb:SetValue(v)
else
sb:SetValue(vmin)
self:SetProperty('state', nil)
end
end
function CastBar:OnValueChanged(value)
self.timeText:SetFormattedText('%.1f', value)
self.spark:SetValue(value)
end
function CastBar:OnFinished()
self:Reset()
end
--[[ game events ]]--
function CastBar:RegisterEvents()
local registerUnitEvents = function(...)
self:RegisterUnitEvent('UNIT_SPELLCAST_CHANNEL_START', ...)
self:RegisterUnitEvent('UNIT_SPELLCAST_CHANNEL_UPDATE', ...)
self:RegisterUnitEvent('UNIT_SPELLCAST_CHANNEL_STOP', ...)
self:RegisterUnitEvent('UNIT_SPELLCAST_START', ...)
self:RegisterUnitEvent('UNIT_SPELLCAST_STOP', ...)
self:RegisterUnitEvent('UNIT_SPELLCAST_FAILED', ...)
self:RegisterUnitEvent('UNIT_SPELLCAST_FAILED_QUIET', ...)
self:RegisterUnitEvent('UNIT_SPELLCAST_INTERRUPTED', ...)
self:RegisterUnitEvent('UNIT_SPELLCAST_DELAYED', ...)
end
registerUnitEvents(unpack(self.units))
LSM.RegisterCallback(self, 'LibSharedMedia_Registered')
end
-- channeling events
function CastBar:UNIT_SPELLCAST_CHANNEL_START(event, unit, name, rank, castID, spellID)
-- if unit ~= self.unit then return end
self:SetProperty("unit", unit)
self:UpdateChannelling(true)
self:SetProperty("castID", castID)
self:SetProperty("state", "start")
end
function CastBar:UNIT_SPELLCAST_CHANNEL_UPDATE(event, unit, name, rank, castID, spellID)
if castID ~= self:GetProperty('castID') then return end
self:UpdateChannelling()
end
function CastBar:UNIT_SPELLCAST_CHANNEL_STOP(event, unit, name, rank, castID, spellID)
if castID ~= self:GetProperty('castID') then return end
self:SetProperty("state", nil)
end
function CastBar:UNIT_SPELLCAST_START(event, unit, name, rank, castID, spellID)
-- if unit ~= self.unit then return end
self:SetProperty("unit", unit)
self:UpdateCasting(true)
self:SetProperty("castID", castID)
self:SetProperty("state", "start")
end
function CastBar:UNIT_SPELLCAST_STOP(event, unit, name, rank, castID, spellID)
if castID ~= self:GetProperty('castID') then return end
self:SetProperty("state", nil)
end
function CastBar:UNIT_SPELLCAST_FAILED(event, unit, name, rank, castID, spellID)
if castID ~= self:GetProperty('castID') then return end
self:SetProperty("reaction", "failed")
self:SetProperty("label", _G.FAILED)
self:SetProperty("state", nil)
end
CastBar.UNIT_SPELLCAST_FAILED_QUIET = CastBar.UNIT_SPELLCAST_FAILED
function CastBar:UNIT_SPELLCAST_INTERRUPTED(event, unit, name, rank, castID, spellID)
if castID ~= self:GetProperty('castID') then return end
self:SetProperty("reaction", "interrupted")
self:SetProperty("label", _G.INTERRUPTED)
self:SetProperty("state", nil)
end
function CastBar:UNIT_SPELLCAST_DELAYED(event, unit, name, rank, castID, spellID)
if castID ~= self:GetProperty('castID') then return end
self:UpdateCasting()
end
function CastBar:LibSharedMedia_Registered(event, mediaType, key)
if mediaType == LSM.MediaType.STATUSBAR and key == self:GetTextureID() then
self:texture_update(key)
elseif mediaType == LSM.MediaType.FONT and key == self:GetFontID() then
self:font_update(key)
end
end
--[[ attribute events ]]--
function CastBar:mode_update(mode)
if mode == 'cast' then
self:SetScript('OnUpdate', self.OnUpdateCasting)
elseif mode == 'channel' then
self:SetScript('OnUpdate', self.OnUpdateChanneling)
elseif mode == 'demo' then
self:SetupDemo()
end
end
function CastBar:state_update(state)
if state == 'start' then
self.fout:Stop()
self.fin:Play()
else
self:SetScript('OnUpdate', nil)
self.fin:Stop()
self.fout:Play()
end
end
function CastBar:label_update(text)
self.labelText:SetText(text or '')
end
function CastBar:time_update(text)
self.timeText:SetText(text or '')
end
function CastBar:icon_update(texture)
self.icon:SetTexture(texture)
end
function CastBar:spell_update(spellID)
if spellID and IsHelpfulSpell(spellID) then
self:SetProperty("reaction", "help")
elseif spellID and IsHarmfulSpell(spellID) then
self:SetProperty("reaction", "harm")
else
self:SetProperty("reaction", "neutral")
end
end
function CastBar:reaction_update(reaction)
if reaction == "failed" or reaction == "interrupted" then
self.statusBar:SetStatusBarColor(1, 0, 0)
self.latencyBar:SetVertexColor(1, 0, 0, 0, LATENCY_BAR_ALPHA)
elseif reaction == "help" then
self.statusBar:SetStatusBarColor(0.31, 0.78, 0.47)
self.latencyBar:SetVertexColor(0.78, 0.31, 0.62, LATENCY_BAR_ALPHA)
elseif reaction == "harm" then
self.statusBar:SetStatusBarColor(0.63, 0.36, 0.94)
self.latencyBar:SetVertexColor(0.67, 0.94, 0.36, LATENCY_BAR_ALPHA)
else
self.statusBar:SetStatusBarColor(1, 0.7, 0)
self.latencyBar:SetVertexColor(0, 0.3, 1, LATENCY_BAR_ALPHA)
end
end
function CastBar:font_update(fontID)
self.sets.font = fontID
local newFont = LSM:Fetch(LSM.MediaType.FONT, fontID)
local oldFont, fontSize, fontFlags = self.labelText:GetFont()
if newFont and newFont ~= oldFont then
self.labelText:SetFont(newFont, fontSize, fontFlags)
self.timeText:SetFont(newFont, fontSize, fontFlags)
end
end
function CastBar:texture_update(textureID)
local texture = LSM:Fetch(LSM.MediaType.STATUSBAR, self:GetTextureID())
self.statusBar:SetStatusBarTexture(texture)
self.bg:SetTexture(texture)
self.latencyBar:SetTexture(texture)
end
--[[ updates ]]--
function CastBar:SetProperty(key, value)
local prev = self.props[key]
if prev ~= value then
self.props[key] = value
local func = self[key .. '_update']
if func then
func(self, value, prev)
end
end
end
function CastBar:GetProperty(key)
return self.props[key]
end
function CastBar:Layout()
local padding = self:GetPadding()
local width, height = self:GetDesiredWidth(), self:GetDesiredHeight()
local displayingIcon = self:Displaying('icon')
local displayingTime = self:Displaying('time')
local displayingBorder = self:Displaying('border')
local border = self.border
local bg = self.bg
local sb = self.statusBar
local time = self.timeText
local label = self.labelText
local icon = self.icon
local insets = border:GetBackdrop().insets.left / 2
self:TrySetSize(width, height)
if displayingBorder then
border:SetPoint('TOPLEFT', padding - insets, -(padding - insets))
border:SetPoint('BOTTOMRIGHT', -(padding - insets), padding - insets)
border:Show()
padding = padding + insets/2
bg:SetPoint('TOPLEFT', padding, -padding)
bg:SetPoint('BOTTOMRIGHT', -padding, padding)
else
border:Hide()
bg:SetPoint('TOPLEFT')
bg:SetPoint('BOTTOMRIGHT')
end
local widgetSize = height - padding*2
if displayingIcon then
icon:SetPoint('LEFT', padding, 0)
icon:SetSize(widgetSize, widgetSize)
icon:SetAlpha(1)
sb:SetPoint('LEFT', icon, 'RIGHT', 1)
else
icon:SetAlpha(0)
sb:SetPoint('LEFT', padding, 0)
end
sb:SetPoint('RIGHT', -padding, 0)
sb:SetHeight(widgetSize)
local textoffset = 2 + (displayingBorder and insets or 0)
label:SetPoint('LEFT', textoffset, 0)
if displayingTime then
time:SetPoint('RIGHT', -textoffset, 0)
time:SetAlpha(1)
label:SetPoint('RIGHT', time, 'LEFT', -textoffset, 0)
else
time:SetAlpha(0)
label:SetPoint('RIGHT', -textoffset, 0)
end
if displayingIcon or displayingTime then
label:SetJustifyH('LEFT')
else
label:SetJustifyH('CENTER')
end
return self
end
function CastBar:UpdateChannelling(reset)
if reset then
self:Reset()
end
local name, nameSubtext, text, texture, startTime, endTime = UnitChannelInfo(self:GetProperty("unit"))
if name then
self:SetProperty('mode', 'channel')
self:SetProperty('label', name or text)
self:SetProperty('icon', texture)
self:SetProperty('spell', GetSpellInfo(name))
local vmin = 0
local vmax = (endTime - startTime) / 1000
local v = endTime / 1000 - GetTime()
local sb = self.statusBar
sb:SetMinMaxValues(0, (endTime - startTime) / 1000)
sb:SetValue(v)
local spark = self.spark
spark:SetMinMaxValues(vmin, vmax)
spark:SetValue(v)
self.latencyBar:Hide()
return true
end
return false
end
function CastBar:UpdateCasting(reset)
if reset then
self:Reset()
end
local name, nameSubtext, text, texture, startTime, endTime = UnitCastingInfo(self:GetProperty("unit"))
if name then
self:SetProperty('mode', 'cast')
self:SetProperty('label', text)
self:SetProperty('icon', texture)
self:SetProperty('spell', GetSpellInfo(name))
local vmin = 0
local vmax = (endTime - startTime) / 1000
local v = GetTime() - startTime / 1000
local latency = self:GetLatency()
local sb = self.statusBar
sb:SetMinMaxValues(vmin, vmax)
sb:SetValue(v)
local spark = self.spark
spark:SetMinMaxValues(vmin, vmax)
spark:SetValue(v)
local lb = self.latencyBar
lb:SetPoint('TOPRIGHT', sb)
lb:SetPoint('BOTTOMRIGHT', sb)
lb:SetWidth(min(latency / vmax, 1) * sb:GetWidth())
lb:SetHorizTile(true)
lb:Show()
return true
end
return false
end
function CastBar:Reset()
self:SetProperty('state', nil)
self:SetProperty('mode', nil)
self:SetProperty('label', nil)
self:SetProperty('icon', nil)
self:SetProperty('spell', nil)
self:SetProperty('reaction', nil)
end
function CastBar:SetupDemo()
local spellID = self:GetRandomspellID()
local name, rank, icon = GetSpellInfo(spellID)
self:SetProperty('mode', 'demo')
self:SetProperty("label", name)
self:SetProperty("icon", icon)
self:SetProperty("spell", spellID)
self.statusBar:SetMinMaxValues(0, 1)
self.statusBar:SetValue(0.75)
self.spark:SetMinMaxValues(0, 1)
self.spark:SetValue(0.75)
local lb = self.latencyBar
lb:SetPoint('TOPRIGHT', self.statusBar)
lb:SetPoint('BOTTOMRIGHT', self.statusBar)
lb:SetWidth(0.15 * self.statusBar:GetWidth())
lb:Show()
end
function CastBar:GetRandomspellID()
local spells = {}
local offset = 0
for i = 1, GetNumSpellTabs() do
local offset, numSpells = select(3, GetSpellTabInfo(i))
local tabEnd = offset + numSpells
for j = offset, tabEnd - 1 do
local _, spellID = GetSpellBookItemInfo(j, 'player')
if spellID then
table.insert(spells, spellID)
end
end
end
return spells[math.random(1, #spells)]
end
-- the latency indicator in the castbar is meant to tell you when you can
-- safely cast a spell, so we
function CastBar:GetLatency()
local down, up, lagHome, lagWorld = GetNetStats()
return (max(lagHome, lagWorld) + self:GetLatencyPadding()) / 1000
end
--[[ settings ]]--
function CastBar:SetDesiredWidth(width)
self.sets.w = tonumber(width)
self:Layout()
end
function CastBar:GetDesiredWidth()
return self.sets.w or 240
end
function CastBar:SetDesiredHeight(height)
self.sets.h = tonumber(height)
self:Layout()
end
function CastBar:GetDesiredHeight()
return self.sets.h or 32
end
--font
function CastBar:SetFontID(fontID)
self.sets.font = fontID
self:SetProperty('font', self:GetFontID())
return self
end
function CastBar:GetFontID()
return self.sets.font or 'Friz Quadrata TT'
end
--texture
function CastBar:SetTextureID(textureID)
self.sets.texture = textureID
self:SetProperty('texture', self:GetTextureID())
return self
end
function CastBar:GetTextureID()
return self.sets.texture or 'blizzard'
end
--display
function CastBar:SetDisplay(part, enable)
self.sets.display[part] = enable
self:Layout()
end
function CastBar:Displaying(part)
return self.sets.display[part]
end
--latency padding
function CastBar:SetLatencyPadding(value)
self.sets.latencyPadding = value
end
function CastBar:GetLatencyPadding()
return self.sets.latencyPadding or 0
end
--[[ menu ]]--
do
function CastBar:CreateMenu()
local menu = Dominos:NewMenu(self.id)
self:AddLayoutPanel(menu)
self:AddTexturePanel(menu)
self:AddFontPanel(menu)
self.menu = menu
self.menu:HookScript('OnShow', function()
self:SetupDemo()
self:SetProperty("state", "start")
end)
self.menu:HookScript('OnHide', function()
if self:GetProperty("mode") == "demo" then
self:SetProperty("state", nil)
end
end)
return menu
end
function CastBar:AddLayoutPanel(menu)
local panel = menu:NewPanel(LibStub('AceLocale-3.0'):GetLocale('Dominos-Config').Layout)
local l = LibStub('AceLocale-3.0'):GetLocale('Dominos-CastBar')
for _, part in ipairs{'icon', 'time', 'border'} do
panel:NewCheckButton{
name = l['Display_' .. part],
get = function() return panel.owner:Displaying(part) end,
set = function(_, enable) panel.owner:SetDisplay(part, enable) end
}
end
panel.widthSlider = panel:NewSlider{
name = l.Width,
min = 1,
max = function()
return math.ceil(_G.UIParent:GetWidth() / panel.owner:GetScale())
end,
get = function()
return panel.owner:GetDesiredWidth()
end,
set = function(_, value)
panel.owner:SetDesiredWidth(value)
end,
}
panel.heightSlider = panel:NewSlider{
name = l.Height,
min = 1,
max = function()
return math.ceil(_G.UIParent:GetHeight() / panel.owner:GetScale())
end,
get = function()
return panel.owner:GetDesiredHeight()
end,
set = function(_, value)
panel.owner:SetDesiredHeight(value)
end,
}
panel.paddingSlider = panel:NewPaddingSlider()
panel.scaleSlider = panel:NewScaleSlider()
panel.opacitySlider = panel:NewOpacitySlider()
panel.fadeSlider = panel:NewFadeSlider()
panel.latencySlider = panel:NewSlider{
name = l.LatencyPadding,
min = 0,
max = function()
return 500
end,
get = function()
return panel.owner:GetLatencyPadding()
end,
set = function(_, value)
panel.owner:SetLatencyPadding(value)
end,
}
end
function CastBar:AddFontPanel(menu)
local l = LibStub('AceLocale-3.0'):GetLocale('Dominos-CastBar')
local panel = menu:NewPanel(l.Font)
panel.fontSelector = Dominos.Options.FontSelector:New{
parent = panel,
get = function()
return panel.owner:GetFontID()
end,
set = function(_, value)
panel.owner:SetFontID(value)
end,
}
end
function CastBar:AddTexturePanel(menu)
local l = LibStub('AceLocale-3.0'):GetLocale('Dominos-CastBar')
local panel = menu:NewPanel(l.Texture)
panel.textureSelector = Dominos.Options.TextureSelector:New{
parent = panel,
get = function()
return panel.owner:GetTextureID()
end,
set = function(_, value)
panel.owner:SetTextureID(value)
end,
}
end
end
--[[ exports ]]--
Addon.CastBar = CastBar